加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-16 10:00:58 所属栏目:安全 来源:网络整理
导读:当我使用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:[in
当我使用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,Suites}

class FullTestSuite extends Suites(new TestSimple)

@DoNotDiscover
class TestSimple extends FlatSpec with Matchers {
  "a" should "do" in {
    Array(1,2))
  }
}

然后输出不包括每个测试的成功和失败,而是只有整体结果:

[info] ScalaTest
[info] Run completed in 975 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 2,Passed 0
[error] Failed tests:
[error]         FullTestSuite
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful

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

谢谢

解决方法

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读