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.
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
publishArtifact in GlobalScope in Test:== false
source: https://github.com/sbt/sbt/blob/a7413f6415687f32e6365598680f3bb8545c46b5/main/src/main/scala/sbt/Defaults.scala#L1118
this is how to enable it
// 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
source: http://www.scala-sbt.org/release/docs/Detailed-Topics/Artifacts
run the test
scala -classpath pipeline.jar classpath scalatest-<version>.jar org.scalatest.tools.Runner -p compiled_tests
where pipeline.jar
is the test artifact you receive from the pipeline
or you can setup a test projet via sbt
http://www.scala-sbt.org/release/docs/Detailed-Topics/Testing.html