Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode test cases shows no test coverage

I'm having problem with getting code coverage in Xcode. It was working at some point of time, however after sometime it has just stopped showing coverage. I've checked both the schemes and test coverage plane for the appropriate settings.

This is how my scheme looks like: enter image description here

This is what my test coverage plane shows after running test cases: enter image description here

like image 209
Bhanu Birani Avatar asked Feb 27 '18 04:02

Bhanu Birani


2 Answers

You can try some of this

  1. Enabling the "show code coverage" from Editor while running a test case. I had this same problem before worked for me. Just try and see if that is working.
  2. You can try checking the targets for the modules but not sure thats the case.
  3. Or you can use the @testable way.This is a workaround and the long way to solve this.
  4. Also u can try cleaning the whole project and deleting any derived data.And then try running the test case.
  5. Also you can try deleting the scheme and try making a new scheme and check "Gather coverage data" for the same. If this things work then thats a xcode bug.

I hope your problem gets solved, I got stuck to the same problem before and it was frustrating to solve that, and you never know which way might work.

like image 122
Uddiptta Ujjawal Avatar answered Oct 13 '22 02:10

Uddiptta Ujjawal


I tried many many things to get this fixed. Finally I ended up deleting all Xcode I had in the Mac, and cleared all the meta-data from /Users/bbirani/Library/Developer/. After all this clean-up, I re-installed Xcode and VOILAA!! it started working.

like image 25
Bhanu Birani Avatar answered Oct 13 '22 00:10

Bhanu Birani