2013-02-21 95 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]]); 
    } 

不幸的是进一步的检查没有揭示两者之间的差异。