0

我正在尝试完全理解我的单元测试生成的最终控制台输出:

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)代表什么感到困惑?

4

1 回答 1

1

0.034 是“测试持续时间”;0.052 是“总持续时间”。

这是 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]]);
    }

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

于 2013-02-21T23:34:57.457 回答