I'm trying to deselect all build targets quickly and then select only the one I care about. This is in the edit schema -> Build part. Normally I'd go through by hand to deselect each one but there's over 600 test targets and build them all takes an extremely long time.
Any ideas how best to do this?
It is possible to do opposite thing - instead of disable all to run one, just open Test navigator and run one test-target explicitly, as shown below
Why there are two different tests as it is on the image below?
You mean the difference between the blue T and the violet rT?
When you create a test target using File->New->Target->iOS or OS X->Test->...Test Bundle
you get a dialog where you sau "Target to be tested".
When you choose such a target, you get the blue Ts for classes in your test target.
Sometimes you can't choose a target (or you don't want to). For example it is impossible at the moment to choose your Watch OS (extension) as a test target. In this case, you can only test some classes, not the target as a whole.
In this case your test classes get a violet rT.
I have developed four projects of Fitness+Health Training of Windows Phone 7.1, now I want to Merge these projec in a single Solution. So it is easy to Add an Existing Project and then run each project as a start up project, but the Question is: How to access to each project, just on a Button click... Let see the example.
As u see, All projects are independently work, each Project have different UI. Now if I click on the 1st Button, the PushUps Trainer App should be run, and If I click on the 2nd Button the SitUps Trainer App should be run and so on....
so How it is possible to run different solutions inside a main solution simultaneously...?
How do I automatically perform unit tests on each build?
I tried to add the Unit Tests target to the Project Target as a dependency, but that doesn't seem to run the actual tests.
Set the Test After Build build setting to Yes. Choose Product > Build For > Build For Testing to build the project and run the tests.
Xcode 5 Update
Xcode 5 does not support the Test After Build build setting. I don't know of any way to automatically run tests on each build in Xcode 5. From the OS X menu bar choose Product > Test or press Command + u to run unit tests in Xcode 5.
To establish the relationship between your targets:
In the Scheme picker, select "Edit Scheme…"
Select the Test phase
Make sure you're seeing the Info tab, not the Arguments tab
Click '+' and specify your testing target
You should see a list of tests. Click 'OK'
Then to run the tests, choose Product > Test, or simply ⌘U from the keyboard. This will:
Build your main target
Build your test target
Execute your main target according to its type, running the tests
Here's what I had to do to get Xcode 4 to automatically run unit tests on build.
Enable "Test After Build" for your main target. (See Mark Szymczyk's answer)
Enable your Test target to run during the build phase of your main target's build scheme.
Click Product > Manage Schemes menu item
Double click your target's scheme (I only had one in my list)
Unfold the Build accordion on the left
Click the Build option in the accordion
You should see you test project on the right, make sure the Run checkbox is clicked.
I thought I'd give a high-level explanation of the steps that worked for me. (OS X 10.7.4, Xcode 4.3.3) If you are unfamiliar with things like Build Phases and Schemes, here's a great resource from Apple: http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Building/Building.html
For a new project, make sure you check the "Include Unit Tests" checkbox on the page where you enter the name of the new project. Click on the project icon in the Project Navigator to see the two targets that have been created automatically. They'll be called something like "MyCocoaApp" and "MyCocoaAppTests". Select the MyCocoaAppTests target (NOT the MyCocoaApp one!) and select "Build Settings" from the choices at the top of the view. Enter "test after build" in the search bar near the top of the view. You should see a single setting for "Test After Build" and it's set to NO by default. Click on the NO setting and change it to YES. One more step. Bring up the scheme for the project. (Product Menu -> Edit Scheme...) Select "Build" in the column on the left. You should see your two targets and some check boxes to the right. On the line for "MyCocoaAppTests", check the "Run" checkbox and hit "OK". You're done. Type Command-B. Your app will build, the unit tests will build, the unit tests will run and fail on an error that is there by default.
If you have to add unit testing to an existing project, it's a bit more involved. First, follow these instructions by Apple: https://developer.apple.com/library/mac/#documentation/developertools/Conceptual/UnitTesting/02-Setting_Up_Unit_Tests_in_a_Project/setting_up.html#//apple_ref/doc/uid/TP40002143-CH3-SW1
If you don't miss any steps, you should now have unit tests set up that run when you select (Product Menu -> Test). Now, do the two steps described above: 1) Set the "Test After Build" setting to YES for the MyCocoaAppTest target; 2) Check the "Run" checkbox for the MyCocoaAppTest target in the Build section of the Scheme for the app. LAST STEP: You have to add a new "Run Script" build phase to the MyCocoaAppTest target (NOT the MyCocoaApp one!). Select the test target, click on "Build Phases", click on the "Add Build Phase" icon in the lower right, select "Add Run Script". A "Run Script" section will open up below the other build phases. The script field has this text in it: "Type a script or drag a script file from your workspace". In that field, enter: "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests". (Including the quotation marks.)
That's it. Hit Command-B. Your app should build. Your tests should build and then run. Good luck. Phew.
So I want to run the tests in the same folder each time (to not create new folder for every new test).
I really don't need to log test data and also I've got some xml from Nhibernate I need to move with it . It is coping to output directory. But doesn't work for test directories.
Really I just want to make all unit tests in the same folder. Is it real ?
You have two question:
Can you make VS to always deploy the assemblies to the same directory for the tests?
Yes, you can.
Open the test settings (Test -> Edit test settings -> [your settings]).
Choose "General" on the left
Select "User-defined scheme" on the right
Remove the checkbox for "Append date-time stamp"
Enter a "Prefix text"
Can you tell VS to deploy additional files?
Yes, you can.
Open the test settings (Test -> Edit test settings -> [your settings]).
Choose "Deployment" on the left
Activate it by choosing "Enable deployment"
Add the additional files