Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The following is a fix for <code>SenTestKit</code> - simply add this class to your Tests target. Something similar should be possible to do with <code>XCTest</code></p> <pre><code>@interface VATestObserver : SenTestLog @end static id mainSuite = nil; @implementation VATestObserver + (void)initialize { [[NSUserDefaults standardUserDefaults] setValue:@"VATestObserver" forKey:SenTestObserverClassKey]; [super initialize]; } + (void)testSuiteDidStart:(NSNotification*)notification { [super testSuiteDidStart:notification]; SenTestSuiteRun* suite = notification.object; if (mainSuite == nil) { mainSuite = suite; } } + (void)testSuiteDidStop:(NSNotification*)notification { [super testSuiteDidStop:notification]; SenTestSuiteRun* suite = notification.object; if (mainSuite == suite) { UIApplication* application = [UIApplication sharedApplication]; [application.delegate applicationWillTerminate:application]; } } </code></pre> <p>and add </p> <pre><code>extern void __gcov_flush(void); - (void)applicationWillTerminate:(UIApplication*)application { __gcov_flush(); } </code></pre> <p>Why is this working?</p> <p>Tests and the tested application are compiled separately. Tests are actually injected into the running application, so the <code>__gcov_flush()</code> must be called inside the application not inside the tests.</p> <p>The little magic with the observer only enables us to check when the tests are going to end and we trigger <code>__gcov_flush()</code> to be called inside the app.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload