Ios 关于Kiwi单元测试的一个错误
我正在学习单元测试。我将使用Ios 关于Kiwi单元测试的一个错误,ios,objective-c,unit-testing,kiwi,Ios,Objective C,Unit Testing,Kiwi,我正在学习单元测试。我将使用Kiwi框架。我使用Kiwi编写了一个简单的测试代码: #import <Kiwi/Kiwi.h> SPEC_BEGIN(SimpleStringSpec) describe(@"SimpleString", ^{ context(@"when assigned to 'Hello world'", ^{ NSString *greeting = @"Hello world"; it(@"should exist
Kiwi
框架。我使用Kiwi编写了一个简单的测试代码:
#import <Kiwi/Kiwi.h>
SPEC_BEGIN(SimpleStringSpec)
describe(@"SimpleString", ^{
context(@"when assigned to 'Hello world'", ^{
NSString *greeting = @"Hello world";
it(@"should exist", ^{
[[greeting shouldNot] beNil];
});
it(@"should equal to 'Hello world'", ^{
[[greeting should] equal:@"Hello world"];
});
});
});
SPEC_END
怎么了 我在使用Specta和KIF的Xcode 7.3.1中遇到了完全相同的错误。测试正在运行,然后我将两个现有的
it
子句包装在一个新的上下文中,并得到了这个错误。清理构建、从模拟器中删除应用程序以及重新启动模拟器都没有起到任何作用。重新启动Xcode是我修复它的唯一方法&现在我也无法复制它。。。
12:26:50.842 XCTest_Demo[8053:93923] _XCT_testBundleReadyWithProtocolVersion:minimumVersion: reply received
12:26:50.852 XCTest_Demo[8053:93923] _IDE_startExecutingTestPlanWithProtocolVersion:16
2016-05-25 12:26:50.856 XCTest_Demo[8053:93891] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSInvocation _invocationWithMethodSignature:frame:]: method signature argument cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109a4dd85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000107949deb objc_exception_throw + 48
2 CoreFoundation 0x000000010990d71d +[NSInvocation _invocationWithMethodSignature:frame:] + 333
3 XCTest 0x0000000111b38ea9 -[XCTestCase initWithSelector:] + 167
4 XCTest 0x0000000111b38f08 +[XCTestCase testCaseWithSelector:] + 43
5 XCTest 0x0000000111b374cb +[XCTestSuite testSuiteForTestCaseWithName:] + 344
6 XCTest 0x0000000111b38181 -[XCTestSuite _initWithTestConfiguration:] + 508
7 XCTest 0x0000000111b38674 +[XCTestSuite testSuiteForTestConfiguration:] + 50
8 XCTest 0x0000000111b24979 -[XCTestDriver _runSuite] + 233
9 XCTest 0x0000000111b257d1 -[XCTestDriver _checkForTestManager] + 259
10 XCTest 0x0000000111b6fa9a _XCTestMain + 628
11 CoreFoundation 0x00000001099732ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
12 CoreFoundation 0x0000000109968f75 __CFRunLoopDoBlocks + 341
13 CoreFoundation 0x00000001099686d2 __CFRunLoopRun + 850
14 CoreFoundation 0x00000001099680f8 CFRunLoopRunSpecific + 488
15 GraphicsServices 0x000000010b74bad2 GSEventRunModal + 161
16 UIKit 0x0000000107daef09 UIApplicationMain + 171
17 XCTest_Demo 0x0000000107456c5f main + 111
18 libdyld.dylib 0x000000010a6a592d start + 1
19 ??? 0x0000000000000005 0x0 + 5
)
libc++abi.dylib: terminating with uncaught exception of type NSException