Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using Quick for testing #241

Open
eduardbosch opened this issue Apr 17, 2018 · 2 comments
Open

Crash when using Quick for testing #241

eduardbosch opened this issue Apr 17, 2018 · 2 comments

Comments

@eduardbosch
Copy link

I first reported this problem to polac24/InjectionTDD#11 but I copy it here as @polac24 told me it is the right place 馃憣馃徎


Hi,

Thanks for this lib. It looks promising, but when used with Quick tests, it crashes the second time the test is executed. Probably to the Quick test generation.

This is the log that explains that there was a problem creating the tests:

2018-04-16 09:54:33.276633+0200 xctest[5271:157143] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An exception occurred when building Quick's example groups.
Some possible reasons this might happen include:

- An 'expect(...).to' expectation was evaluated outside of an 'it', 'context', or 'describe' block
- 'sharedExamples' was called twice with the same name
- 'itBehavesLike' was called with a name that is not registered as a shared example

Here's the original exception: 'NSInternalInconsistencyException', reason: ''describe' cannot be used inside 'it', 'describe' may only be used inside 'context' or 'describe'. ', userInfo: '(null)''
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010a1b01e6 __exceptionPreprocess + 294
	1   libobjc.A.dylib                     0x0000000109845031 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010a225975 +[NSException raise:format:] + 197
	3   Quick                               0x000000011d31950d __23+[QuickSpec initialize]_block_invoke + 292
	4   Quick                               0x000000011d321384 _T05Quick5WorldC30performWithCurrentExampleGroupyAA0fG0C_yyc7closuretFTo + 84
	5   Quick                               0x000000011d3193c9 +[QuickSpec initialize] + 162
	6   libobjc.A.dylib                     0x0000000109845b04 CALLING_SOME_+initialize_METHOD + 19
	7   libobjc.A.dylib                     0x0000000109845e9e _class_initialize + 276
	8   libobjc.A.dylib                     0x000000010984c824 lookUpImpOrForward + 226
	9   libobjc.A.dylib                     0x000000010985c414 _objc_msgSend_uncached + 68
	10  InjectionLoader                     0x0000000120d110ac __41+[BundleInjection autoLoadedNotify:hook:]_block_invoke + 332
	11  libdispatch.dylib                   0x0000000110c5273b _dispatch_call_block_and_release + 12
	12  libdispatch.dylib                   0x0000000110c53779 _dispatch_client_callout + 8
	13  libdispatch.dylib                   0x0000000110c5d778 _dispatch_main_queue_callback_4CF + 1279
	14  CoreFoundation                      0x000000010a172c99 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	15  CoreFoundation                      0x000000010a136ea6 __CFRunLoopRun + 2342
	16  CoreFoundation                      0x000000010a13630b CFRunLoopRunSpecific + 635
	17  Foundation                          0x00000001090c9b4a -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
	18  Foundation                          0x00000001090c9a25 -[NSRunLoop(NSRunLoop) run] + 76
	19  InjectionTDD                        0x000000011d2f938a +[TDDTestKeeper initialize] + 346
	20  libobjc.A.dylib                     0x0000000109845b04 CALLING_SOME_+initialize_METHOD + 19
	21  libobjc.A.dylib                     0x0000000109845e9e _class_initialize + 276
	22  libobjc.A.dylib                     0x000000010984c824 lookUpImpOrForward + 226
	23  libobjc.A.dylib                     0x000000010985c414 _objc_msgSend_uncached + 68
	24  CoreFoundation                      0x000000010a0ff9b9 -[__NSSetM addObject:] + 441
	25  XCTest                              0x0000000109750e5a +[XCTestCase(RuntimeUtilities) allSubclasses] + 248
	26  XCTest                              0x00000001096e6996 +[XCTestSuite _suiteForBundleCache] + 213
	27  XCTest                              0x00000001096e8d35 -[XCTestSuite _initWithTestConfiguration:] + 437
	28  XCTest                              0x00000001096e9b19 +[XCTestSuite testSuiteForTestConfiguration:] + 69
	29  XCTest                              0x000000010975cd32 -[XCTTestRunSession runTestsAndReturnError:] + 210
	30  XCTest                              0x00000001096cecb1 -[XCTestDriver runTestsAndReturnError:] + 447
	31  XCTest                              0x0000000109751bd1 _XCTestMain + 960
	32  xctest                              0x0000000108fc62a4 main + 571
	33  libdyld.dylib                       0x0000000110cc8955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Process finished with exit code 0

Would be great to use this with Quick 馃帀

@johnno1962
Copy link
Owner

I鈥檓 afraid the easiest thing to say is this is unsupported. It鈥檚 more of a Quick limitation where Quick makes the assumption a given test will never be run more than once in a process which is exactly what you鈥檙e seeing. That said if you could prepare a small example project showing the problem I can see if there is something injection can do.

@eduardbosch
Copy link
Author

Here there is a simple Quick test that crashes when a test is injected: https://github.com/eduardbosch/QuickInjectionCrash

Thanks @johnno1962 馃憦馃徎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants