Eigen has hit the point where testing is a chore. This is a positive sign, the app has grown in terms of size, complexity, and number of developers considerably over the last 3 years. The test suite makes us feel comfortable making changes.
On my fastest computer, we're just under a minute -
Executed 1105 tests, with 1 failure (0 unexpected) in 43.221 (48.201) seconds for the whole suite. I think I could probably live with 20 seconds max. So I studied how AppCode handles running tests, and this will be an illustrated guide as to how you can easily run the subset of tests in Xcode based on their techniques.
What are Schemes?
An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.
You can have as many schemes as you want, but only one can be active at a time. You can specify whether a scheme should be stored in a project—in which case it’s available in every workspace that includes that project, or in the workspace—in which case it’s available only in that workspace. When you select an active scheme, you also select a run destination (that is, the architecture of the hardware for which the products are built).
To quote Apple.
Hatching a Scheme
The Eigen Test Suite is around 50 test classes, these look a bit like this:
Before you start, you want to be able to say, "I want to only run tests for the Fairs section of Eigen", as that is where I will be working for the next few days. To get started, I need to create a new Scheme. You will have seen the schemes before when you click on the Target side of this Targer/Sim button in the top left of Xcode.
This is what it looks like on mine, we want to create a new scheme. This brings up a modal window where you need to choose your App's target (this is so you can continue running by pressing
cmd + r.)
I've called mine "Artsy just for Fairs", as I'm the only person who would see it, I can name it whatever I want. Clicking "OK" selects it, and hides the modal. You now need to go back to the target selector, and go to "Edit Schemes ..." to continue though.
OK, click on "Test" in the sidebar, and now you're in the Schemes Test editor. This is where you do the work.
You need to hit the "+" in order to add your Test Target to the Scheme
Select and "Add" you Targets. This adds the target, you then need to click the disclosure arrow in order to show all the Test Classes.
OK, here's some magic. Hold
alt and click on the blue tickbox to the right of your test target to turn it off. Then click again, without
alt. It should then deselect all of the classes. This is standard in all Mac apps, so go wild there.
This means you can go find the classes you do want to run, in my case that is the Test Classes relating to Fairs.
Now when I press
cmd + u it will only run those test classes.
Which means I can now get back to work at a reasonable pace.
Executed 15 tests, with 0 failures (0 unexpected) in 0.277 (0.312) seconds. I can then run the full suite whenever I go and make a cup of tea.
Note: If you want to avoid using the mouse to change scheme, the key commands to change between visible schemes is
cmd + ctrl + [ and
cmd + ctrl + ].