编辑:我终于开始工作!
它需要在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) 我们正在使用Scala + Maven + ScalaTest runner + Jenkins.我们在这里有JUnit样式的XML输出:
test_dir/target/scalatest-reports/
Run Code Online (Sandbox Code Playgroud)
现在我们可以看到整个构建通过/失败,或者通过详细的控制台输出来查看测试通过/失败(不理想),但我确信有更好的方法.
我已经尝试了几个后期构建步骤,例如:
但无法获得一份测试结果表.
你有什么想法?谢谢.
continuous-integration automated-tests qa jenkins jenkins-plugins
我成功了!我把这里的Java逐行逐字翻译成Scala:
https://github.com/junit-team/junit/blob/master/doc/ReleaseNotes4.8.md
大多数情况下,它意味着执行 Array(classOf[ClassName])、删除“public”关键字等。我的 IntelliJ IDE 提供了很多建议。
我希望能够运行各类测试,因此我可能会将一类测试标记为“Version2dot3”和“SlowTest”,然后能够仅运行“慢速测试”,或运行“慢速测试和 2.3 测试”。
我一直在尝试使这篇文章适应我的 Scala 测试:
http://weblogs.java.net/blog/johnsmart/archive/2010/04/25/grouping-tests-using-junit-categories-0
java.lang.Exception: No runnable methods我有一个几乎可以工作的基本 shell 设置,但是当我尝试运行 testSuite 时遇到错误。
有想法吗?我已经成功地能够使用 SuiteClasses 仅运行某些测试类,但无法运行测试类别(@Category 注释)。
import org.junit.experimental.categories.{Categories, Category}
import org.junit.runners.Suite.SuiteClasses
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
@Category(Array(classOf[SlowTests]))
class FunSuiteTest extends FunSuite with DemoHelpers {
test("demoTest1") {
println("\n\nrunning DemoTest1...\n\n")
}
}
@RunWith(classOf[JUnitRunner])
@Category(Array(classOf[SlowTests]))
class FunSuiteTest2 extends FunSuite with DemoHelpers {
test("demoTest2") {
println("\n\nrunning DemoTest2...\n\n")
}
}
@RunWith(classOf[Categories])
@SuiteClasses(Array(classOf[SlowTests]))
class testSuite {
}
Run Code Online (Sandbox Code Playgroud) 我不想花任何钱.我知道微软过去常常维护一些可以导入到VirtualBox /等中的.VPC图像,但是我正在读另一个说不再起作用的StackOverflow--强制激活.
想法?