与SBT编译测试,并将其打包稍后运行(Compile tests with SBT and pack

2019-09-02 01:14发布

林与SBT工作和玩! 框架。 目前我们已经提交级在我们的管道,我们发布到artifactory的我们的二进制文件。 二进制文件与DIST任务生成。 该管道然后运行所用Scala编写的烟雾和验收测试。 它们与SBT运行。

我想要做的就是编译烟雾和验收测试,以及二进制和发布他们artifactory的。 这将允许管道下载这些二进制文件(测试套件),并运行它们,而不是每一次,这需要很长的时间重新编译他们。

我试图SBT测试:编译生成的罐子,但后来我不能找到一种方法来运行测试。

Answer 1:

SBT不发布在文物测试

publishArtifact in GlobalScope in Test:== false

来源: https://github.com/sbt/sbt/blob/a7413f6415687f32e6365598680f3bb8545c46b5/main/src/main/scala/sbt/Defaults.scala#L1118

这是如何使它

// enable publishing the jar produced by `test:package`
publishArtifact in (Test, packageBin) := true

// enable publishing the test API jar
publishArtifact in (Test, packageDoc) := true

// enable publishing the test sources jar
publishArtifact in (Test, packageSrc) := true

来源: http://www.scala-sbt.org/release/docs/Detailed-Topics/Artifacts

运行测试

scala -classpath pipeline.jar classpath scalatest-<version>.jar org.scalatest.tools.Runner -p compiled_tests

其中pipeline.jar是测试工件从管道接收

或者你可以设置通过SBT测试谟

http://www.scala-sbt.org/release/docs/Detailed-Topics/Testing.html



文章来源: Compile tests with SBT and package them to be run later