Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for integrating TDD with web application development?

Unit testing and ASP.NET web applications are an ambiguous point in my group. More often than not, good testing practices fall through the cracks and web applications end up going live for several years with no tests.

The cause of this pain point generally revolves around the hassle of writing UI automation mid-development.

How do you or your organization integrate best TDD practices with web application development?

like image 921
Gabriel Isenberg Avatar asked Aug 20 '08 19:08

Gabriel Isenberg


People also ask

What is TDD in web development?

Test-driven development (TDD) is a software development process relying on software requirements being converted to test cases before software is fully developed, and tracking all software development by repeatedly testing the software against all test cases.


2 Answers

Unit testing will be achievable if you separate your layers appropriately. As Rob Cooper implied, don't put any logic in your WebForm other than logic to manage your presentation. All other stuff logic and persistence layers should be kept in separate classes and then you can test those individually.

To test the GUI some people like selenium. Others complain that is a pain to set up.

like image 64
Johnno Nolan Avatar answered Oct 05 '22 07:10

Johnno Nolan


I layer out the application and at least unit test from the presenter/controller (whichever is your preference, mvc/mvp) to the data layer. That way I have good test coverage over most of the code that is written.

I have looked at FitNesse, Watin and Selenium as options to automate the UI testing but I haven't got around to using these on any projects yet, so we stick with human testing. FitNesse was the one I was leaning toward but I couldn't introduce this as well as introducing TDD (does that make me bad? I hope not!).

like image 30
nachojammers Avatar answered Oct 05 '22 07:10

nachojammers