我正在尝试完全理解从单元测试中生成的最终控制台输出:
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)
所代表的内容感到困惑?
答案 0 :(得分: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]]);
}
不幸的是,对代码的进一步检查并没有揭示两者之间的差异。