【发布时间】:2022-01-02 20:03:03
【问题描述】:
我是 scala 的新手, scala 项目包含 scala 和 java 单元测试用例。
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import itest.Level2;
@RunWith(Suite.class)
@Suite.SuiteClasses({Level2.class}) // Level2.class is contains @test method
class OrganizationRegexModelComponentTester implements ITest{
}
itest.jar 包含文件 Level2.class。 我加了
libraryDependencies += "junit" % "junit" % "4.11" % "test" // already added
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
testOnly company.extraction.api.util.TestJunitTwo
[info] ScalaTest
[info] Run completed in 313 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] No tests were executed.
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[success] Total time: 7 s, completed Nov 24, 2021 1:17:53 PM
当我运行时 - sbt test 它只运行 scala 测试而不是 java 测试。
如何同时运行 java 和 scala 测试来运行。
【问题讨论】:
-
可能与 stackoverflow.com/questions/28174243/run-junit-tests-with-sbt 相关。您的
sbt test正在运行不基于 JUnit 的 ScalaTest。
标签: java scala unit-testing sbt