Last active
August 29, 2015 14:02
Revisions
-
nking revised this gist
Jul 14, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,8 +69,8 @@ Test target: Generate test coverage files: YES for debug and debug device. NO for release Instrument program flow: YES for debug and debug device. NO for release My unit test files include the extern void __gcov_flush(), and then a __gcov_flush() in the tearDown method because I'd already done that before finding the above. There's room to simplify these instructions and the files included, but I haven't take the time to do that yet. This working configuration might be helpful if you're testing with IOS 6. -
nking revised this gist
Jul 14, 2014 . 1 changed file with 44 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,28 @@ Generating Coverage Reports with Xcode 5.1.1 If you need to test using the IOS 6.x simulator due to testing in-app purchases, for example, you won't be able to use the new XCTest library as those are IOS >= 7. The apple store (simulator) is only available in the IOS 6.x simulators. The notes below use GTM UnitTesting which are extensions of SenTestingKit instead of XCTest. This is an example of targets built for an older Xcode project that I keep adapting to the newer IDE builds. There are many ways to build your testing targets, so this is just one working example. The main target is the source target and is built using defaults provided by the Xcode IDE. The testing target is duplicate of the source target. You have to remove main.m from "Build Phases" "Compile Sources". Then to include GTM testing for GTMTestCases, I used the older configuration instructions still present in their wiki, but you should be able to use the simpler instructions at the top of the page. http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting#Older:_GTM_Unit_Testing_without_Apple's_support/Xcode_integ (1) configure XCode 5.1.1 to generate gcno files https://developer.apple.com/library/ios/qa/qa1514/_index.html @@ -11,7 +34,7 @@ Generating Coverage Reports with Xcode 5.1.1 (which adds a listener to do invoke __gcov_flush()) and a pre-processer macro to include the code. Instructions for the later are at: https://code.google.com/p/coverstory/wiki/UsingCoverstory To generatee reports for the gcda files: you can use CoverStory.app, but there is a problem if your code uses @@ -31,3 +54,23 @@ To generatee reports for the gcda files: http://ltp.sourceforge.net/coverage/lcov.php lcov -t 'report_title' -o gcov.info -c -d gcov_directory genhtml -o output_dir gcov.info More details if needed: After varying the coverage configuration, these are the build settings I now use: Source target: Generate test coverage files: YES for debug and debug device. NO for release Instrument program flow: YES for debug and debug device. NO for release Preprocessor Macros: GTM_IS_COVERAGE_BUILD=1 for debug Other C Flags: -DDEBUG Test target: Generate test coverage files: YES for debug and debug device. NO for release Instrument program flow: YES for debug and debug device. NO for release My unit test files include the extern void __gcov_flush(); and a __gcov_flush(); in the tearDown method because I'd already done that before finding the above. There's room to simplify these instructions and the files included, but I haven't take the time to do that yet, but the working configuration might be helpful if you're testing with IOS 6. -
nking revised this gist
Jun 18, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ Generating Coverage Reports with Xcode 5.1.1 (1) configure XCode 5.1.1 to generate gcno files https://developer.apple.com/library/ios/qa/qa1514/_index.html -
nking revised this gist
Jun 17, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ (which adds a listener to do invoke __gcov_flush()) and a pre-processer macro to include the code. Instructions for the later are at: http://code.google.com/coverstory/wiki/UsingCoverstory To generatee reports for the gcda files: you can use CoverStory.app, but there is a problem if your code uses -
nking created this gist
Jun 17, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ (1) configure XCode 5.1.1 to generate gcno files https://developer.apple.com/library/ios/qa/qa1514/_index.html (2) then to generate gcda files from your GTMTestCase unit tests you can either add to each unit test source file extern void __gcov_flush(); and a __gcov_flush(); to the tearDown method, or you can add a few files from the google-toolbox-for-mac (which adds a listener to do invoke __gcov_flush()) and a pre-processer macro to include the code. Instructions for the later are at: http://code.google.com/coverstory/wiki/UsingCoverstory to follow instructions To generatee reports for the gcda files: you can use CoverStory.app, but there is a problem if your code uses block variables or block arguments to functions, such as is common with NSOperationQueue. For _blocks there are errors such as ".gcno no lines for '__copy_helper_block_'" and ".gcno:no lines for '__destroy_helper_block_'". This might be due a mix of gcc and clang tools producing and expecting different names. So the alternative is to use 2 more tools: (3) use llvm-gov to generate each gcov file (gcov file is a readable ascii text file of the source code with left edge markings for covered and not for each line of code) /Library/Developer/CommandLineTools/usr/bin/llvm-cov -a -o gcda_directory a_gcda_file_path (4) use lcov to create html files from the gcov files http://ltp.sourceforge.net/coverage/lcov.php lcov -t 'report_title' -o gcov.info -c -d gcov_directory genhtml -o output_dir gcov.info