【发布时间】:2015-11-25 09:38:41
【问题描述】:
我有多个具有 build.sbt 文件和 scalatest 代码的 IntelliJ (Scala) 模块。
我还为它们中的每一个创建了 ScalaTest 配置。
我可以从sbt test的执行中一一运行测试。
是否可以一次执行所有测试?我可以考虑制作一个 Python/Bash 脚本,但我想知道是否有一种简单的方法可以做到这一点。
for d in dirs:
execute("sbt test")
添加
根据 Alexey Romanov 的回答,我在根目录中创建了 build.sbt,内容如下
lazy val root = (project in file(".")).aggregate(context, contextProcessor)
lazy val context = project
lazy val contextProcessor = project
然后,我执行set test 以使所有测试运行。
[info] ContextTest:
[info] - Create context
[info] - Create context 2
[info] Run completed in 195 milliseconds.
[info] Total number of tests run: 2
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[info] Compiling 1 Scala source to /Users/smcho/Desktop/code/ContextSharingSimulation/contextProcessor/target/scala-2.11/test-classes...
[info] DatabaseTest:
[info] - Create test
[info] - Create test2
[info] Run completed in 147 milliseconds.
[info] Total number of tests run: 2
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 5 s, completed Aug 12, 2015 3:03:41 PM
参考 - http://www.scala-sbt.org/0.13.5/docs/Getting-Started/Multi-Project.html
【问题讨论】: