Skip to content
trans edited this page Jun 6, 2011 · 5 revisions

INTERESTED IN WORKING ON TURN? THEN READ THIS!

The current implementation (v0.8+) is really two programs.

On the one hand there are the autorunners which are used when running tests in the more traditional fashion of simply loading them into the Ruby interpretor. In this case one requires 'turn' in their test helper script.

On the other hand there is the turn command line tool which uses the regular runners and does not need the require 'turn' statement in test scripts. The turn command is much more versatile than using the require approach becuase it can produce a variety of output formats and also handle isolated and pair testing.

The original code base only had the TestUnit autorunner. As the turn command was being developed it was thought best to leave the autorunner alone so as to avoid any breakage while the new runners were being developed. At this point they are mature enough that an important issue is now to integrate the two type of runners, having the autorunner rely on it's regular counterpart.

Another major aspect of the programs design is MiniTest support. Ruby 1.9 dropped TestUnit as it's built-in test framework in favor of MiniTest. Unfortunately MiniTest is generally used via it's TestUnit emulation layer, which has made it harder to support both frameworks and has required some serious code kung-fu to make sure it all works. Moreover, the Minitest API is not yet fully stable, and since Turn must couple tightly with MiniTest code it means Turn requires some regular maintenance.

The last important aspect of Turn's design that needs be kept in mind, is the way solo and cross testing features are implemented. This is some really neat code actually (IMO), but it might be difficult to grasp with out some explanation. What turn does when using the --solo or --cross options, is shell out to itself using the YAML reporter. It does this repeatedly for each test, or each pair of tests, respectively, and then collates all the resulting YAML reports into a single report, which it then feeds back into the selected reporter.

So that's the basic overview of how Turn is coded. The main thing to remember at this point is that if you change something in the autorunners, you probably want to reflect that change in the regular runners as well, and vice-versa.

Have Fun!

Clone this wiki locally