Chapter 18

First Steps to xUnit

Driving a testing tool using the testing tool itself to run the tests may seem a bit like performing brain surgery on yourself. (“Don’t touch those motor centers—oh, too bad, game over.”) It will get weird from time to time. However, the logic of the testing framework is more complicated than the wimpy money example of Part I. You can read Part II as a step toward test-driven development of “real” software. You can read it as a computer-sciency exercise in self-referential programming.

First, we need to be able to create a test case and run a test method. For example: TestCase("testMethod").run(). We have a bootstrap problem: we are writing test cases to test a framework that we will be using to write the test ...

Get Test Driven Development: By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.