Topic: Testing: Drill down or Stack up?

Hi all,

I've been doing lots of research on testing and have learned much. However, while absorbing all of that info, I began wondering how others view certain methodologies.

One, in particular, is whether to "drill down" or "stack up" while developing your test suite. Some sources advocate starting out at a higher level (e.g., user interaction) and working down. Others suggest starting with the basics (e.g., model validation and operations) and expanding out. Of course, both have pros and cons, but which one do you guys think works best in your development?


Re: Testing: Drill down or Stack up?

Interesting question. I like starting high, but this can be difficult. For example, it can sometimes be a couple hours before I can make a given high test pass appropriately and I don't like leaving a test broken for that long so I'm left with commenting out the high test and writing lower tests to get them passing quickly.

I'm referring mostly to my programming experience outside of Rails. In Rails I don't have this problem as much. Partly because the high tests I make are usually very simple and it's easy to stub them out. It's primarily the models which get tested extensively and those are already pretty low level

Railscasts - Free Ruby on Rails Screencasts

Re: Testing: Drill down or Stack up?

i like to start with the most fundamental use case of the application, develop it and only it, then add another use case, rinse, refactor, repeat till i'm done.

so i guess it would be a 'drill-down' approach? (start high, refine it over time)

i think the hardest part about test-first is getting good at writing tests, its impossible and uncomfortable to sit down and go test-first cold turkey. i started by making something and then writing tests for it, once i got the hang of the test framework i could then write tests before i code it. i needed practice, and then it became doable.