When i try to run the unit test for my projects, i get test succeeded. But in the log navigator i get warning saying 'All tests did not finish'. But the same code works fine in another machine and all tests succeeds without any warning. I searched for other posts related this and tried everything, but nothing works for me. And also all of a sudden some unit-tests fail without any reason, but succeeds when i run it again. I even tried resetting the simulator, nothing works.
Any suggestions?
Try this... open a Terminal in your project's folder and type the following:
xcodebuild -list
If you have Unit Tests in your project you should see at least two targets: ProjectName and ProjectNameTests.
Now type the following command (note: you will need quotes around the ProjectNameTests if it has spaces):
xcodebuild -target ProjectNameTests build
You will almost certainly see something like the following towards the end of the output:
/Applications/Xcode.app/Contents/Developer/Tools/RunUnitTests:68: note: RunUnitTests exited without running tests because TEST_AFTER_BUILD was set to NO.
You can fix this in Xcode by selecting your project in the Project Navigator (Cmd-1), selecting your ProjectNameTests target, selecting Build Settings and scrolling down to the Unit Testing section. Change the Test After Build setting from No to Yes and type Cmd-U to run your Unit Tests again. This time it should work.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With