【问题标题】:js-test-driver - How to get name of the running Test and TestCase in the setUp method?js-test-driver - 如何在 setUp 方法中获取正在运行的 Test 和 TestCase 的名称?
【发布时间】:2013-10-07 16:11:02
【问题描述】:

我想知道如何获取正在运行的测试的名称、测试用例的名称和测试结果(测试是通过还是失败)。

以下是代码示例:

MyTestCase= TestCase("MyTestCase");

MyTestCase.prototype.setUp = function()
{
 // print name of the test => testA
 // print name of the testcase => MyTestCase
}

MyTestCase.prototype.testA= function()
{
  //do something    
}


MyTestCase.prototype.tearDown = function()
{
  //result of the test => passed or failed??
}

【问题讨论】:

    标签: javascript unit-testing js-test-driver


    【解决方案1】:

    我已经将 JSTestDriver 与 QUnit 测试运行器一起使用,它显示正在运行的测试的名称、测试用例的名称和测试结果(测试是通过还是失败)。

    http://qunitjs.com/

    下面是适配器:

    https://code.google.com/p/js-test-driver/wiki/QUnitAdapter

    【讨论】:

      【解决方案2】:

      JsTestDriver 有一个名为 --testOutput 的标志,它指定存储结果的路径。您可以在那里找到测试名称、测试用例以及它是通过还是失败。它以 xml 的形式出现。

      【讨论】:

        猜你喜欢
        • 2021-02-08
        • 2013-06-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-06-18
        • 2016-08-15
        • 1970-01-01
        • 2018-07-16
        相关资源
        最近更新 更多