First of all, thanks to everyone for helping answer all my stupid newbie questions about testing. I have been trying to formulate a testing strategy to enable TDD with Tapestry. I try to decouple anything that is not directly view-related from the page class and the resulting components are easy to unit test. When it comes to the page class, it’s easy to write unit tests that test the listener methods by using the Creator class.
The hard part is figuring out how to test the rendered output from your pages. In order to use HtmlUnit, the code must be running in a container. If I want to inject dummy services, I have to use a dummy hive module which I have to swap in and out of the context when I run unit tests. Alternatively, I can create IExternalPages which call service setter functions on the pages to be tested, add the setters to those pages and modify the Tapestry code to allow you to have setters when you are using @InjectObject. Is there an alternative way to do this? Perhaps I am using an incorrect approach to testing. Should I instead write unit tests to cover my POJOs, integration tests (which if I understand them correctly, are unit test where I inject real object into my test subject instead of mocks) to cover the interaction between two or more POJOs, unit tests which use the Creator to test your classes listener methods and then separately run functional tests which use HtmlUnit against the fully integrated application? How do you test your applications? Thanks for your help, Rob Dennett -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.6/337 - Release Date: 5/11/2006