unit testing - How to flush coverage data when my test cause app crash - For ios app -


i want code coverage of tests. set settings, build app .gcno files , run on simulator.

it can coverage data if there no crash issue.

but if app crashed, nothing.

so how can code coverage data when app crash?

in thought, because not call __gcov_flush() method when app crash. add app not run in background plist file, __gcov_flush() called @ time press home button.

is there way call __gcov_flush() before app crash?

i found way myself.

apple provide nssetuncaughtexceptionhandler() method app. can add our own handler before app crash.

so can call __gcov_flush() in function.

#import <objc/runtime.h> extern void __gcov_flush(); // in exception handler function, call flush this: if(__gcov_flush){     __gcov_flush(); } 

done!


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -