我正在使用 SBT 和 Play!框架.目前,我们的管道中有一个提交阶段,我们发布到工件我们的二进制文件.二进制文件是使用 dist 任务生成的.然后管道运行用 scala 编写的冒烟和验收测试.它们使用 sbt 运行.
Im working with SBT and Play! Framework. Currently we have a commit stage in our pipeline where we publish to artifactory our binaries. The binaries are generated with the dist task. The pipeline then runs smoke and acceptance tests that are written in scala. They are run with sbt.
我想做的是编译冒烟测试和验收测试以及二进制文件并将它们发布到工件.这将允许管道下载这些二进制文件(测试套件)并运行它们,而不是每次都重新编译它们,这需要很长时间.
What I want to do is to compile the smoke and acceptance tests as well as the binary and publish them to artifactory. That will allow the pipeline to download these binaries (the test suites) and run them, instead of recompiling them every time, which takes a long time.
我尝试了生成 jar 的 sbt test:compile,但是我找不到运行测试的方法.
I tried sbt test:compile which generates the jar, but then I cant find a way to run the tests.
推荐答案sbt dont publish test in artifacts
sbt dont publish test in artifacts
publishArtifact in GlobalScope in Test:== false来源:github/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来源:www.scala-sbt/release/docs/Detailed-Topics/Artifacts
运行测试
scala -classpath pipeline.jar classpath scalatest-<version>.jar org.scalatest.tools.Runner -p compiled_tests其中 pipeline.jar 是您从管道收到的测试工件
where pipeline.jar is the test artifact you receive from the pipeline
或者你可以通过 sbt 设置一个测试项目
or you can setup a test projet via sbt
www.scala-sbt/release/docs/Detailed-Topics/Testing.html
更多推荐
使用 SBT 编译测试并将它们打包以便稍后运行
发布评论