Bhanu Birani
Bhanu Birani

Reputation: 1286

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

Upvotes: 11

Views: 2346

Answers (4)

Bhanu Birani
Bhanu Birani

Reputation: 1286

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.

Upvotes: 4

Uddiptta Ujjawal
Uddiptta Ujjawal

Reputation: 58

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.

Upvotes: 2

Danish Merani
Danish Merani

Reputation: 156

It happens to me a lot. Try restarting your xcode as well as the simulator(if you are using one). It seems like an xcode issue.

Upvotes: 3

Related Questions