We’re always looking for new ways to test our applications and we’ve been trying a few new things on our projects. One of the recent additions is a JUnit test runner designed to help make writing and running functional tests easier. In Javaland, we use Selenium and/or HtmlUnit for our functional tests. These are the tests that run against a deployed application over the wire using a real or simulated browser. Most of our functional tests work the application in the same way a real user would, testing sequences of realistic activity and often touching a number of pages. Since our functional tests use either a real browser or a simulated one, Javascript is executed and assertions made on the results. This gives us greater confidence that our app is really working, end to end.
Here’s the high-level flow that the functional test runner provides:
- Load fixture data from a DBUnit dataset.
- Download and install the application server (if necessary).
- Start the application server (using Cargo).
- Deploy the application, waiting until it’s completely started.
- Run one or more functional tests (using your preferred testing framework – Selenium, HTMLUnit, etc)…
If a test dirties the database in a manner that must be reset, the test class can be marked with the @DirtiesDatabase annotation. This will reload the database fixture and optionally restart the application. - Shutdown the application server.
Continue reading ‘C5 Test Support new addition: FunctionalTestRunner’

