Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

How would one go about to use tdd/bdd on a mostly data driven webapp? For example a blog or a forum?

share|improve this question
3  
What makes you think this type of app is some type of exception? –  JeffO Sep 12 '11 at 18:01
    
I don't really know.. –  Christian Wattengård Sep 12 '11 at 18:06
    
What exactly are you having difficulties with? Your question is very wide. –  Oded Sep 12 '11 at 18:10
    
I guess I really don't know in which end to start. I'm trying to learn TDD, and one of my pet projects is a very data driven app. Kind of a multiuser image blog thingy... –  Christian Wattengård Sep 13 '11 at 7:36
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.