chris
chris

Reputation: 21197

How to practice TDD on a web app?

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).

Upvotes: 4

Views: 911

Answers (5)

David Andres
David Andres

Reputation: 31781

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.

Upvotes: 1

Nostradamnit
Nostradamnit

Reputation: 860

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

Upvotes: 1

Ferry Meidianto
Ferry Meidianto

Reputation: 120

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

Upvotes: 0

Fredrik Mörk
Fredrik Mörk

Reputation: 158309

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.

Upvotes: 4

John Lockwood
John Lockwood

Reputation: 3875

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.

Upvotes: 0

Related Questions