2011-01-12 14 views
15

運行應用程序測試(即在設備上)時,我的OCUnit測試套件存在一些問題。偶爾,我會遇到一個似乎從OCUnit類拋出的棘手錯誤。我一直在試圖查看添加到測試套件中的文件,但無法解決它。在設備上運行OCUnit應用程序測試套件時偶爾會出現錯誤

我已經按照蘋果的文檔和設置時,我的測試目標,造成了以下目標(並有凹痕的依賴)看着其他教程:

LogicTests

MyApp的 LogicTests

ApplicationTests MyApp

MyAppTesting ApplicationTests

最後一個(MyAppTesting)是我在設備上運行以啓動測試套件的人。

而且如前所述,測試無法啓動,有時扔我在控制檯下面的輸出:

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' 

有誰知道什麼地方出錯了?

感謝任何幫助, 的Kristofer

附:我已經發布了這個應用開發論壇,但還沒有任何運氣:https://devforums.apple.com/message/333890

+0

只是打這個莫名其妙..對我來說乾淨,然後重試工作。 – canhazbits 2013-10-09 04:15:48

回答

19

你有NSZombieEnabled?我有這個問題當我在我的單元測試啓動目標的參數中將NSZombieEnabled設置爲YES時,我試過了所有的東西(清理/退出XCode/res仿真模擬器內容)。 到目前爲止唯一的解決方案是在我的單元測試發佈中禁用殭屍

0

我想我只是想出了爲什麼我得到這個錯誤 - 也許同樣的事情是發生在您身上:

我有兩個產品設置,一個用於內部測試(包含偏好窗格)和一個用於應用商店發佈。兩個產品目標都使用相同的產品名稱(建立設置中的PRODUCT_NAME)。

這在XCode 3.x中運行良好,但XCode 4在某種程度上試圖在我每次構建測試版產品時構建商店產品。我認爲這是由於XCode放置派生文件的地方發生了變化 - XCode 4以相同的路徑存儲測試版和存儲產品,因此,當構建測試版產品時,存儲輸出文件發生了變化,需要重新構建。 ..

反正...改變Beta產品名稱 已經固定 暫時固定這個問題......我也改變了包標識符Info.plist中,因此這兩種產品有不同的標識符。現在,當我構建一個產品時,另一個不能同時構建,但在測試運行時我仍然會崩潰:-(

我現在唯一的想法是完全重新創建新項目,複製整個設置和文件是否XCode的4做不同的東西。這和提交支持事件蘋果...

乾杯,

亞當

+0

感謝您的回覆,亞當!不幸的是,這並沒有解決我的問題。目標有不同的產品名稱......另外,自從XCode 3.2.4以來,我遇到了同樣的問題,所以我不認爲它與XCode 4發佈有關。 :( – 2011-04-05 08:37:20

+2

唉,我說的太快了 - 我仍然得到錯誤。有時它會消失後,我分別清理兩個目標,然後建立和運行從頭開始單元測試,但有時它不... ...我我正在向蘋果提交一份支持事件,所以我們會看到它在做什麼! – adamcohenrose 2011-04-05 13:36:54

0

我不是100%確定,但似乎可以通過爲每個測試目標創建不同的方案來解決此問題。 今天下午我有很多這個錯誤,但是在我爲不同的測試目標創建單獨的方案後,它一段時間沒有發生。

0

只是對可能遇到這個問題就像我人有:

KIFTester在加載
斷言失敗 - [SenTestClassEnumerator的init],/SourceCache/OCUnit/OCUnit-5315/SourceCode/SenTestingKit/SenTestClassEnumerator.m :136
由於未捕獲的異常'NSInternalInconsistencyException'而終止應用程序,原因是:'objc_getClassList返回了比它應該有的更多的類。'

的問題竟然是Google分析3.0 已更新至3.0.3,但仍擁有這兩個庫的相同的問題 libGoogleAnalytics_debug.a libGoogleAnalyticsServices.a

去解決它,我只是不包括他們進行測試。

相關問題