6

在 Xcode 5 中使用 XCTest 运行测试时,有什么方法可以禁用一些额外的控制台消息?每次我运行测试时,Xcode 都会打印出一些关于我没有运行的测试的无用行:

Test Suite 'xxxxViewTests' started at 2014-01-13 17:10:48 +0000
Test Suite 'xxxxViewTests' finished at 2014-01-13 17:10:48 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'yyyyyyViewTests' started at 2014-01-13 17:10:48 +0000
Test Suite 'yyyyyyViewTests' finished at 2014-01-13 17:10:48 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'zzzzzzzViewTests' started at 2014-01-13 17:10:48 +0000
Test Suite 'zzzzzzzViewTests' finished at 2014-01-13 17:10:48 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'xyxyViewTests' started at 2014-01-13 17:10:48 +0000
Test Suite 'xyxyViewTests' finished at 2014-01-13 17:10:48 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'xzxzxzScreenTests' started at 2014-01-13 17:10:48 +0000
Test Suite 'xzxzxzScreenTests' finished at 2014-01-13 17:10:48 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'yzyzyzyzyzTests' started at 2014-01-13 17:10:48 +0000
Test Suite 'yzyzyzyzyzTests' finished at 2014-01-13 17:10:48 +0000.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
....
4

1 回答 1

1

编辑您的项目方案并取消选中您不想运行的测试类。选择Product > Scheme... > Edit Scheme...菜单项,在左栏中选择Test ,并取消选中不相关的测试类:

在此处输入图像描述

确保在以后需要它们时再次启用它们。如果取消选中所有测试类,产品 > 测试菜单项(及其 Cmd-U 快捷方式)将被禁用。

于 2014-02-15T00:22:28.570 回答