在设备上运行OCUnit应用程序测试套件时偶尔出现错误 [英] Occasional errors when running OCUnit application test suite on device
问题描述
在运行应用程序测试(即在设备上)时,我的OCUnit测试套件出现了一些问题.有时,我会收到一个棘手的错误,似乎是从OCUnit类抛出的.我一直在尝试查看添加到测试套件中的文件,但无法解决.
I'm having some problems with my OCUnit test suite, when running application tests (i.e. on the device). Occasionally, I get a tricky error that seems to be thrown from the OCUnit classes. I've been trying to look through the files added to the test suites, but can't get my head around it.
在设置测试目标时,我遵循了Apple文档并查看了其他教程,从而产生了以下目标(以及缩进的依赖项):
I've followed the Apple documentation and looked at other tutorials when setting up my test targets, resulting in the following targets (and indented dependencies):
LogicTests
LogicTests
MyApp 逻辑测试
MyApp LogicTests
ApplicationTests MyApp
ApplicationTests MyApp
MyAppTesting ApplicationTests
MyAppTesting ApplicationTests
最后一个(MyAppTesting)是我在设备上运行以启动测试套件的一个.
The last (MyAppTesting) is the one I run on the device to start the test suite.
并且如上所述,测试无法开始,有时会在控制台中向我抛出以下输出:
And as mentioned, the tests fail to start sometimes throwing me the following output in the console:
2010-11-17 12:02:48.537 VCCTesting[12018:307] *** Assertion failure in -[SenTestClassEnumerator init], /SourceCache/OCUnit/OCUnit-1685/SourceCode/SenTestingKit/SenTestClassEnumerator.m:137
2010-11-17 12:02:48.556 VCCTesting[12018:307] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'objc_getClassList returned more classes than it should have.'
*** Call stack at first throw:
(
0 CoreFoundation 0x30897ed3 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3002f811 objc_exception_throw + 24
2 CoreFoundation 0x30897d15 +[NSException raise:format:arguments:] + 68
3 Foundation 0x349f932f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 62
4 SenTestingKit 0x20107c29 -[SenTestClassEnumerator init] + 292
5 SenTestingKit 0x201079fd +[SenTestClassEnumerator classEnumerator] + 24
6 SenTestingKit 0x2010777d +[NSObject(SenTestRuntimeUtilities) senAllSubclasses] + 92
7 SenTestingKit 0x201067b5 +[SenTestSuite updateCache] + 28
8 SenTestingKit 0x20106753 +[SenTestSuite suiteForBundleCache] + 54
9 SenTestingKit 0x201065db +[SenTestSuite structuredTests] + 14
10 SenTestingKit 0x201065a1 +[SenTestSuite allTests] + 40
11 SenTestingKit 0x20106573 +[SenTestSuite defaultTestSuite] + 14
12 SenTestingKit 0x201057a3 +[SenTestProbe specifiedTestSuite] + 106
13 SenTestingKit 0x20105d83 +[SenTestProbe runTests:] + 94
14 Foundation 0x349c7e8d __NSFireDelayedPerform + 368
15 CoreFoundation 0x3084e7fb __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
16 CoreFoundation 0x3084e2ad __CFRunLoopDoTimer + 860
17 CoreFoundation 0x3081f7a5 __CFRunLoopRun + 1088
18 CoreFoundation 0x3081f277 CFRunLoopRunSpecific + 230
19 CoreFoundation 0x3081f17f CFRunLoopRunInMode + 58
20 GraphicsServices 0x31e445f3 GSEventRunModal + 114
21 GraphicsServices 0x31e4469f GSEventRun + 62
22 UIKit 0x31e51123 -[UIApplication _run] + 402
23 UIKit 0x31e4f12f UIApplicationMain + 670
24 VCCTesting 0x000234ff main + 70
25 VCCTesting 0x00002538 start + 40
)
terminate called after throwing an instance of 'NSException'
有人知道怎么了吗?
非常感谢您的帮助, 克里斯托弗
Thankful for any help, Kristofer
P.S.我已经在App开发者论坛上发布了此文件,但还没有运气: https://devforums.apple.com/message/333890
P.S. I've posted this on the App dev forums, but haven't had any luck with it yet: https://devforums.apple.com/message/333890
推荐答案
您有NSZombieEnabled吗?当我将我的单元测试启动目标的参数中的NSZombieEnabled设置为YES时,我遇到了这个问题.我已经尝试了一切(清理/退出XCode/restting模拟器内容). 到目前为止,唯一的解决方案是在我的单元测试启动中禁用僵尸
Do you have NSZombieEnabled? I had this issue when I had NSZombieEnabled set to YES in my arguments for my unit test launch target. I've tried everything (cleaning/quitting XCode/restting simulator content). The only solution so far was to disable zombie in my unit test launch
这篇关于在设备上运行OCUnit应用程序测试套件时偶尔出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!