2013-02-21 110 views
0

我想完全瞭解從我的單元測試生成的最終控制檯輸出:瞭解SenTestingKit日誌輸出

Test Suite 'Multiple Selected Tests' finished at 2013-02-21 22:54:57 +0000. 
Executed 6 tests, with 0 failures (0 unexpected) in 0.034 (0.052) seconds 

大部分是自我解釋,但最後我不確定。具體in 0.034 (0.052) seconds。因爲每個測試顯示類似以下的輸出不能是平均:

Test Suite 'MMProductLogicTests' started at 2013-02-21 22:54:57 +0000 Test Case 
-[MMProductLogicTests testProductMissingFormURL]' started. 
Test Case '-[MMProductLogicTests testProductMissingFormURL]' passed (0.005 seconds). 
Test Suite 'MMProductLogicTests' finished at 2013-02-21 22:54:57 +0000. 

所有六個測試表明passed (0.005 seconds)這樣的平均是沒有意義的。 0.034似乎是執行的總時間,我很困惑(0.052)代表什麼?

回答

1

0.034是'testDuration'; 0.052是'totalDuration'。

這裏是SenTestingKit源代碼(舊版本):代碼

+ (void) testSuiteDidStop:(NSNotification *) aNotification 
    { 
     SenTestRun *run = [aNotification run]; 
     testlog ([NSString stringWithFormat:@"Test Suite '%@' finished at %@.\nPassed %d test%s, with %d failure%s (%d unexpected) in %.3f (%.3f) seconds\n", 
      [run test], 
      [run stopDate], 
      [run testCaseCount], ([run testCaseCount] != 1 ? "s" : ""), 
      [run totalFailureCount], ([run totalFailureCount] != 1 ? "s" : ""), 
      [run unexpectedExceptionCount], 
      [run testDuration], 
      [run totalDuration]]); 
    } 

不幸的是進一步的檢查沒有揭示兩者之間的差異。