我想知道如何获取正在运行的测试的名称,测试用例的名称和测试结果(测试是通过还是失败)。
下面是代码示例:
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??
}
我已经将JSTestDriver与QUnit测试运行器一起使用,它显示正在运行的测试的名称,测试用例的名称和测试结果(无论测试是通过还是失败)。
http://qunitjs.com/
下面是适配器:
https://code.google.com/p/js-test-driver/wiki/QUnitAdapter
JsTestDriver 有一个名为 --testOutput 的标志,它指定了存储结果的路径。您可以在那里找到测试名称、测试用例以及它是否通过或失败。它以 xml 的形式出现。