Scalatest Suites没有详细的测试状态输出

时间:2016-08-18 11:14:03

标签: scala sbt scalatest

当我使用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

如何在Suite实例中运行测试以输出它们失败的位置和方式?

由于

1 个答案:

答案 0 :(得分:3)

我猜您正面临一个错误#916。您还应该尝试版本>=3.0.0-M15并向开发人员提供反馈。