multi-jvm-test docs need improvement
I believe these additional points will help the newer user avoid build frustration.
0) The multi-jvm build environment currently only supports Scala (full) build configs, not build.sbt.
(As a personal note, though, I have a build.sbt that almost works).
1) The correct command to execute multi-jvm tests only is: multi-jvm:execute-tests
2) By default, the test task in sbt only runs regular, not multi-jvm, tests. If you want to have the test task (as well as multi-jvm:test) run both regular and multi-jvm tests, you need this block in your Build.scala:
executeTests in Test <<= ((executeTests in Test),
(executeTests in MultiJvm)) map {
case ((_, testResults), (_, multiJvmResults)) =>
val results = testResults ++ multiJvmResults
(Tests.overall(results.values), results)
}
(A comment should also be added to the code example in multi-jvm-tests docs, that this block makes the test task execute both regular and multi-jvm tests).
3) The default directory for multi-jvm test source is src/multi-jvm/{scala, java}, which can be overridden.... like this:
unmanagedSourceDirectories in MultiJvm <<= Seq(baseDirectory(_ / "multi_node_test")).join
This setting needs to come AFTER the multi-JVM settings are added, or else it will be overridden by the multi-jvm defaults.
4) The following block of code in the multi-jvm build file contains references outside the example, maybe it should be taken out:
dependencies = Seq(remote, actorTests % "test->test",
testkit % "test->test"),
It is only relevant specifically for the Akka project build as it references other Akka sub-projects.
I can attach an example of my Build.scala, which I believe is much more helpful than the current example as it is taken from an independent project outside Akka.
Points 1 and 3 are I believe the biggest stumbling blocks to new users to multi-jvm getting it up and running.
0) The multi-jvm build environment currently only supports Scala (full) build configs, not build.sbt.
(As a personal note, though, I have a build.sbt that almost works).
1) The correct command to execute multi-jvm tests only is: multi-jvm:execute-tests
2) By default, the test task in sbt only runs regular, not multi-jvm, tests. If you want to have the test task (as well as multi-jvm:test) run both regular and multi-jvm tests, you need this block in your Build.scala:
executeTests in Test <<= ((executeTests in Test),
(executeTests in MultiJvm)) map {
case ((_, testResults), (_, multiJvmResults)) =>
val results = testResults ++ multiJvmResults
(Tests.overall(results.values), results)
}
(A comment should also be added to the code example in multi-jvm-tests docs, that this block makes the test task execute both regular and multi-jvm tests).
3) The default directory for multi-jvm test source is src/multi-jvm/{scala, java}, which can be overridden.... like this:
unmanagedSourceDirectories in MultiJvm <<= Seq(baseDirectory(_ / "multi_node_test")).join
This setting needs to come AFTER the multi-JVM settings are added, or else it will be overridden by the multi-jvm defaults.
4) The following block of code in the multi-jvm build file contains references outside the example, maybe it should be taken out:
dependencies = Seq(remote, actorTests % "test->test",
testkit % "test->test"),
It is only relevant specifically for the Akka project build as it references other Akka sub-projects.
I can attach an example of my Build.scala, which I believe is much more helpful than the current example as it is taken from an independent project outside Akka.
Points 1 and 3 are I believe the biggest stumbling blocks to new users to multi-jvm getting it up and running.
Leave a comment
on 2012-11-01 07:14 *
By bjorn.antonsson@typesafe.com
Assigned to set to bjorn.antonsson@typesafe.com
Status changed from New to Accepted
Thanks for reporting this. I've rewritten the example in the docs completely.
- 0) If you would be willing to sign the Typesafe CLA and make the build.sbt work, then that would be a great addition to the docs. http://www.typesafe.com/contribute/cla
- 1) This is right out broken. I've fixed the multi-jvm-plugin and pushed an update 0.3.4 version, where multi-jvm:test does the right thing
- 2) That code has been corrected in the sample. Thanks for the catch.
- 3) The default directory is in the docs further down, but is now mentioned at the top as well. The configuration change is added to the docs further down.
- 4) Those dependencies have been removed.
Merged to master and cherry-picked to release-2.1