gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 20:20:23 26 4
gpt4 key购买 nike

当我使用 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并向开发人员提供您的反馈。

关于Scalatest 套件没有详细的测试状态输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39016755/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com