How would one go about to use tdd/bdd on a mostly data driven webapp? For example a blog or a forum?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
A blog or forum is absolutely perfect for a BDD approach.
If you can get your hands on The RSpec Book and you don't mind reading a bit of Ruby, do so. As it says in the foreword, it's not a book about Ruby, it's a book about behaviour-driven development which happens to use Ruby as a basis.
In short, it will tell you how to use a Gherkin-based syntax to define your behaviours and then drop down into a TDD cycle to design the code behind that behaviour.
It uses a Reddit-style model for its examples, but is very easily translated into both other types of data-driven site and other languages.
The traditional approach would be to use the Repository pattern.
The very short version is you use collections for tables in your testing environment where as the production implementations access the database tables or persists the changes to the collections to the database.
You don't mention which environment/language your using but there are plenty of examples and frameworks/tools around for helping with all the plumbing.