Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I would like to try and implement some TDD in our web applications to reduce reg

ID: 649256 • Letter: I

Question

I would like to try and implement some TDD in our web applications to reduce regressions and improve release quality, but I'm not convinced at how well automated testing can perform with something as fluffy as web applications.

I've read about and tried TDD and unit testing, but the examples are 'solid' and rather simple functionalities like currency converters, and so on.

Are there any resources that can help with unit testing content management and publication systems? How about unit testing a shopping cart/store (physical and online products)? AJAX?

Googling for "Web Test Driven Development" just gets me old articles from several years ago either covering the same examples of calculator-like function or discussions about why TDD is better than anything (without any examples).

Explanation / Answer

Big disclaimer: I've not built any web applications nor have I tested any web applications. The following are just tidbits of information I've absorbed in my random walks within the information sphere.

Construct your web application in such a way so as to be able to test business rules in isolation. If you find yourself testing business rules through the user interface then it might be time to think about redesigning.

When it comes to testing the UI, replace your business rules with mock implementations that respond in predictable ways.

The above two rules are taken from Bob Martin's talk at RailsConf 2010. The talk isn't about TDD and the section where he mentions testing is short and somewhere in the middle.

There are tools like JsUnit, JSSpec, YUI Test for testing JavaScript and Selenium and Watir for testing UI.

The Pragmatic Bookshelf have a few books covering testing of web applications. A list of books tagged with Testing is at. The Pragmatic Bookshelf web app testing books are mainly focussed around Ruby and Rails but should be generically applicable.