This post will provide a sneak peek at another feature coming in Elements 8.4 (and available in the current Alpha drop): IDE-Integrated Unit Testing with EUnit and Fire.

This is pretty cool, and even (or especially) as a unit-testing snob I'm pretty excited about it.

Fire is adding a new command, "Project|Test" (⇧⌘T). Similar to "Run", this will build and run your project, but it will run in a special "testing" mode, where Fire will capture all test results and present them inline in your source, just as it does with errors and warnings normally generated during build:

But it doesn't stop there. Fire gains a lot of smarts to make testing simple and easy.

To start with, there's two ways tests can be run via ⇧⌘T:

  1. If the currently active project is an EUnit test project, it will be run in test mode, and its results will be captured.

  2. More excitingly, if the currently active project has a different project from the same solution selected as dedicated "Test Project" in project settings, Fire will run that project instead.

This will allow you to have two separate projects – your real app, and your test project, and let Fire seamlessly run one or the other with ⌘R vs. ⇧⌘T (really, that's the most common scenario).

Smart Building

Fire is also smart about knowing what projects to build. If you run your app, it will build only the app project (and any active library projects on your solution that your app may depend on), but will skip building the separate test project (or other apps in the same solution), to save time. Similarly, when you test, Fire will build your test project but skip (re)building your main app project.

Debugging Tests

Your tests will be run inside the debugger, so you will have all the debugging capabilities at hand to debug what's going on, if needed. Fire will let you control whether to stop on breakpoints and exceptions independently for debugging your regular app, and for testing.

It will also (by default) let you stop on unexpected exceptions, while ignoring regular EUnit asserts (which will be reported as test results, after all, and you most likely won't want the debugger to break on. Except when you do.).

All Platforms

Integrated Unit Testing works with our EUnit framework, on all platforms.

EUnit has also been improved to smartly switch between test listeners, depending on whether your app is running in Fire's test mode or not. For example, if you run your iOS unit tests standalone, you may want to see the (also new) visual representation of test results in a UITableView, shown below. But when running via ⇧⌘T, the tests will run silently, outputting their results to the console for Fire to capture.