Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't add Unit Tests to existing iOS project

I a trying to add Unit Test to an already working iOS App. I've searched and read many threads that address this problem, and followed their advices step-by-step but I seem to get stuck at a different place.

The app is an ordinary iPhone Application, that I am currently developing using Xcode 6.3.1 I've been able to create the 'Cocoa Touch Testing Bundle' fine for my Application. A basic test gets created, but when I press the 'Test' button, I get the message

Configure "Project Tests" for testing.

The scheme "Project Tests" is not configured for testing. Edit the scheme to enable testing, or cancel the action.

I press the 'Edit Scheme' button and go to the Edit Scheme Editor. But in that window (you can see a snapshot below this explanation) I am never able to choose any targets, all the options are actually greyed out! I've tried everything but I am not really sure what I should change in my project in order to change this and successfully create the Unit Tests... Any ideas please?

Choose targets to test

like image 398
Ignacio Oroná Avatar asked Aug 03 '15 19:08

Ignacio Oroná


1 Answers

Here is the process which i have followed to add the Unit testing in a demo projects. First of all i have deleted test scheme from the project which looks like this

enter image description here

Then i click on the plus icon which is located in the lower corner, then under ios section from other i have selected Cocoa Touch Testing Bundle like this

enter image description here

Then i have selected the Language, Project and Target as i have used in my project like this

enter image description here

After adding the test scheme in my project, i go to Edit Scheme and selected Test from there like this

enter image description here

Then i selected the Plus button to add the newly created Test scheme to my project like this

enter image description here

From there i have selected the Scheme and see in the below screenshot, the scheme is added to my project

enter image description here

Then is selected to test the app and see in the below screenshot i am able to test my app

enter image description here

Try to do this.I hope it will help you.

like image 141
Rajat Avatar answered Sep 19 '22 21:09

Rajat