code coverage with gcovr and Xcode 5 is not working

寵の児 提交于 2019-12-03 03:43:18
Alexandre Joly

And now it works again... :)

as @kenji said, Xcode 5.1 solved the problem. thx btw

here is my working environment and configuration for the one who are interested

  • Xcode 5.1.1 (from the AppStore)
  • gcovr 3.1-prerelease (installed with easy_install)

and in my project under 'Build Settings' I set the following:

  • 'Generate Test Coverage Files' is set to YES
  • 'Instrument Program Flow' is set to YES

after I run the tests, I execute the following command: (happens with jenkins)

gcovr -r . --object-directory Build/Intermediates/MyProj.build/Debug-iphonesimulator/KiwiUnitTest.build/Objects-normal/i386 --exclude '.*Tests.*' --exclude '.*KiwiUnitTest' --exclude '.*main.*' --xml > reports/coverage.xml

done.

sorry guys for making you wait for an answer and thank you everyone for your help.

hirschfl

At first make sure that your .gcda and .gcno files are created!

(Check: ~/Library/Developer/Xcode/DerivedData/{YOUR-PROJECT-NAME}/Build/Intermediates/{YOUR-PROJECT-NAME}.build/Debug-iphonesimulator/{YOUR-PROJECT-NAME}.build/Objects-normal/i386 )

If they have been successfully created you need to do the following: (If not check the comments under your question)

  1. copy the all the files from the folder i386 (full path as described above) into you workspace where your .h and .m files are.

  2. run terminal and change you parent working directory to your workspace

    cd [YOUR WORKSPACE PATH]
    
  3. run gcovr

    gcovr -r . --xml  > reports/coverage.xml
    

If you are using jenkins (which i assume) this will be your further steps: Generating gcda files to view the code-coverage from XCTests in IOS with Jenkins

Let me know if you still have questions!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!