views:

200

answers:

5

I am a newcomer to TDD.

What are some of the techniques you guys use on applying TDD to the development of a webapp?

I am looking for advice for a newcomer. Practical examples or "war stories" would be appreciated. :)

Bonus: What is some of the software you use for TDD (ideally for a LAMP stack).

A: 

Though it's not applicable to LAMP, you might take a look at Stephen Walther's ASP.NET MVC Programming Unleashed, which goes into it in some detail and has some techniques you might use. You might also google "XUnit PHP" and see what pops out.

John Lockwood
+3  A: 

One way to get a web app testable is to use some design pattern like MVC or similar. The main idea is to get as much code as possible out of the webpages, and move it into classes that are more encapsulated and suited for testing. When structuring the code like that, TDD for a web app is like TDD for any other piece of software.

Fredrik Mörk
A: 

Since you're at LAMP, you may want to give Ruby on Rails try.

Ferry Meidianto
+1  A: 

As far as tools go, there are unit testing suites that run client-side JavaScript code to assert correctness. QUnit and JSUnit come to mind.

David Andres
+1  A: 

Check out the Django framework - it has a very powerful testing framework integrated - on top of being a really cool framework!

Nostradamnit
Is pyUnit compatible with Django? I've never tried to combine the two.
Imagist