【问题标题】:Easy way to get result of a test spec获取测试规范结果的简单方法
【发布时间】:2016-01-30 19:13:06
【问题描述】:

我想我遗漏了一些明显的东西,有没有办法轻松接收测试运行的结果?

我正在使用简单的run(new my.TestClass) 进行最大规模的运行

有什么方法可以取回测试结果?还是在测试失败后运行代码的某种方式?

我在 scaladoc 中找到的唯一方法是使用返回 Status 的 Suite.run() 运行测试,但它也需要 Args,我还没有找到任何关于我应该使用什么 Args 的示例。

【问题讨论】:

    标签: scala scalatest


    【解决方案1】:

    好的,所以我在文档中找到了执行测试失败功能:

    override def withFixture(test: NoArgTest) = {
    
        super.withFixture(test) match {
          case failed: Failed =>
            info("failed")
            //some code when tests fail
            failed
    
          case other => other
        }
      }
    

    但我想 Args 示例仍然是有益的 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-08
      • 1970-01-01
      • 1970-01-01
      • 2012-02-06
      • 1970-01-01
      • 2017-09-17
      相关资源
      最近更新 更多