Scalatest 套件没有详细的测试状态输出
Scalatest Suites do not have detailed test status output
当我 运行 使用 sbt 进行以下简单测试时,我得到了我期望的输出:
import org.scalatest.{FlatSpec, Matchers, Suites}
class TestSimple extends FlatSpec with Matchers {
"a" should "do" in {
Array(1,3) should equal (Array(1,2))
}
}
输出:
[info] TestSimple:
[info] a
[info] - should do *** FAILED ***
[info] Array(1, 3) did not equal Array(1, 2) (SimpleTest.scala:5)
[info] ScalaTest
[info] Run completed in 980 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error] TestSimple
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
当测试包含在套件中并使用 DoNotDiscover 进行注释时:
import org.scalatest.{DoNotDiscover, FlatSpec, Matchers, Suites}
class FullTestSuite extends Suites(new TestSimple)
@DoNotDiscover
class TestSimple extends FlatSpec with Matchers {
"a" should "do" in {
Array(1,3) should equal (Array(1,2))
}
}
然后输出不包括每个测试的成功和失败,而是只有整体结果:
[info] ScalaTest
[info] Run completed in 975 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 2, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error] FullTestSuite
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
如何在 Suites 实例中获取 运行 测试以输出失败的位置和方式?
谢谢
我猜你遇到了一个错误 #916
。您还应该尝试版本 >=3.0.0-M15
并向开发人员提供反馈。
当我 运行 使用 sbt 进行以下简单测试时,我得到了我期望的输出:
import org.scalatest.{FlatSpec, Matchers, Suites}
class TestSimple extends FlatSpec with Matchers {
"a" should "do" in {
Array(1,3) should equal (Array(1,2))
}
}
输出:
[info] TestSimple:
[info] a
[info] - should do *** FAILED ***
[info] Array(1, 3) did not equal Array(1, 2) (SimpleTest.scala:5)
[info] ScalaTest
[info] Run completed in 980 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error] TestSimple
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
当测试包含在套件中并使用 DoNotDiscover 进行注释时:
import org.scalatest.{DoNotDiscover, FlatSpec, Matchers, Suites}
class FullTestSuite extends Suites(new TestSimple)
@DoNotDiscover
class TestSimple extends FlatSpec with Matchers {
"a" should "do" in {
Array(1,3) should equal (Array(1,2))
}
}
然后输出不包括每个测试的成功和失败,而是只有整体结果:
[info] ScalaTest
[info] Run completed in 975 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 2, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error] FullTestSuite
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
如何在 Suites 实例中获取 运行 测试以输出失败的位置和方式?
谢谢
我猜你遇到了一个错误 #916
。您还应该尝试版本 >=3.0.0-M15
并向开发人员提供反馈。