簡體   English   中英

js-test-driver-如何在setUp方法中獲取正在運行的Test和TestCase的名稱?

[英]js-test-driver - How to get name of the running Test and TestCase in the setUp method?

我想知道我們如何獲取正在運行的測試的名稱,測試用例的名稱以及測試結果(測試是否通過或失敗)。

以下是代碼示例:

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 TestRunner一起使用了,它可以顯示正在運行的測試的名稱,測試用例的名稱以及測試結果(測試是否通過或失敗)。

http://qunitjs.com/

以下是適配器:

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

JsTestDriver有一個名為--testOutput的標志,該標志指定存儲結果的路徑。 您可以在此處找到測試名稱,測試用例以及是否通過或失敗。 它以xml的形式出現。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM