Far more useful are tests that exercise large sections of code in one hit. For example, you might start up a temporary Tomcat Server then use Selenium to do the following actions:

  1. log in as a customer

  2. submit an order

  3. log out

  4. log in as an administrator

  5. query the 'new orders' page and check that the fresh order is listed

  6. query the order itself and check that the details are present on the screen.

These steps test a considerable slice of functionality at once, from the front-end screen, right through to the back-end database.  Along the way it also tests authentication, page rendering, input field validation and form submission.  If the piece in the middle that sends data to the database is replaced by a web service, all the tests will still pass.  Sure, you might need to populate a temporary database with some mock data, but it is a small price to pay for such powerful testing.

blog comments powered by Disqus