Saturday, February 7, 2015

TestInsight - unit testing like a pro

The time of teasing is finally over - today I want to show you what I have been working on over the past few weeks:

TestInsight is an IDE plugin for Delphi (supporting XE and up) that will improve your unit test experience. It integrates nicely into your IDE removing the necessity to deal with some external test runner. It runs and presents the results on demand, when saving or continuously whenever you change the code.

Navigating to any test is just a matter of double clicking the test in the results overview.

As I would like you to experience it yourself here is a quick introduction:

After you downloaded and installed TestInsight you can access it from the Delphi main menu ("View -> TestInsight Explorer").

To get your test project running with TestInsight you have to add the TESTINSIGHT define to your project - you can do that by context menu in the project manager:


The second step will be to add the TestInsight client unit to your project. Currently supported frameworks are DUnit, DUnit2 and DUnitX. So let's say you have a project that is using DUnit you have to add the unit TestInsight.DUnit to your project. Calling RunRegisteredTests (as you know from DUnit) of that unit will execute your tests using TestInsight.

So a very basic project file will then look like this:

program MyTests;

uses
  TestInsight.DUnit,
  MyTestCase in 'MyTestCase.pas';

begin
  RunRegisteredTests;
end.

After building your project and hitting run it will report the results to the plugin. That will enable you to run your tests on remote machines or even mobile devices.


Hopefully you don't have errors or warnings in your results. ;) But if you do navigating to the source is just a double click (if you are using madExcept, JclDebug or similar libraries you can even navigate right to the line that caused the error - look into the TestInsight.Client unit on how to enable that)

For an even better TDD experience you can select the clock or disk icon to execute the tests whenever you change the code (after a small configurable idle time) or save it. You can completely focus on the TDD cycle without being interrupted by running the tests manually.


Download the setup here. For more information or reporting issues please visit the official project page.

And also many thanks to my closed beta testers and coworkers that helped me finding many bugs during development.