编辑:我终于开始工作!
它需要在pom.xml中组合JUnit,在我的.scala中需要三个语句:
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
Run Code Online (Sandbox Code Playgroud)
出于某种原因,尝试配置Surefire会使测试再次停止运行.
我在IntelliJ中编码,试图通过Maven(mvn test)构建过程运行一个简单的ScalaTest测试.没有任何错误,但遗憾的是没有测试运行.
这是我的.scala文件:
import org.scalatest.FunSuite
import org.scalatest.BeforeAndAfter
class ExampleSuite extends FunSuite with BeforeAndAfter {
before {
println("Doing setup tasks...")
}
test("Example test of checking the browser title") {
val expected_title = "Company Platform"
var actual_title = "Company Platform"
assert(actual_title == expected_title)
}
after {
println("Doing teardown tasks...")
}
}
Run Code Online (Sandbox Code Playgroud)
这是Maven的输出:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for JoeTestDemo:JoeTestDemo:jar:1.0
[WARNING] 'build.plugins.plugin.version' for …Run Code Online (Sandbox Code Playgroud)