Skip navigation.

Acceptance test patterns

One problem with given-when-then... the answer... "Other Examples Include"

acceptance test patterns

As I've mentioned before, in acceptance test driven development, I use the Given/When/Then structure for writing acceptance tests. This approach is attributed to Dan North and Joe Walnes presentation at XPDay 2006.

For example, let's consider a test for a story around logging in (I know - I always use this but it's something most people have experience of):

Context, an equivalence class album review and some heuristics

acceptance test patterns | acceptance testing | context-driven testing | ethics | metaphors | people issues | perspectives

In Australia, the new tax year starts in July, so there are many sales on at the moment. I found some CDs at one place at a throwaway price, $2 each. One of them is an interesting instrumental album by an artist I hadn’t heard of, Tino Izzo. There is one track I have an issue with, called a samba, but it is too slow and fails all "samba" requirements, but does pass "flamenco" muster. Artistic licence, I guess.

I did a web search for reviews of the album, and found a glowing “must buy” review here at the artist’s web site. So based on the heuristic of artists reviews at their sites will be positive, I find it holds, it is positively glowing. It’s written by a specialist in guitar music, who mentions several artists that I have never heard of. I'm not sure how deep his knowledge is though; one rocking track he highlights for "flamenco flair" has no Spanish styled classical guitar at all (just some bongos). The track is an old Beatles ballad, in a new uptempo context and great new arrangement. So that's one issue I have with an otherwise good review. I did find some flamenco flair on another rocking track (4). A good heuristic for Spanish styling is a Spanish track name! Maybe the reviewer's memory failed him. There's even a track for that, "Elusive Memories", also dedicated to testing too fast and not quite remembering how you caused that big bug...

I found another album review which is the most unusual one I have ever read. It was definitely not what I expected. The reviewer starts off discussing people’s reactions to types of music, then her dislike of this type of music, then finishes off by saying she is unfair and unreasonable, before mentioning the artist and album names already listed at the start. Oh, there is a picture of the album art. So there is not one word of actual review. The crazy thing is, she thinks it is new age, when a lot of it is rock, so if she’d only listened to it….. So as a review for me, showstopper, complete failure. As an opinion piece, it is quite well written (but completely wrong to most people interested in the style of music).

This is effectively an equivalence class review: I dislike all the music of which this album is a sample, here’s why I dislike it, and I’m sorry. So as an acceptance tester, why was she chosen for the review? Why didn’t she even listen to it? As a customer, if I am interested in the album, her review has no value at all. Even worse, if I read her review, and buy it because I love that type of music, I might feel robbed when I heard the screaming gutar solos. Ah, I see, reuse. This can now become a generic review of all similar albums. Very clever. Reuse of the completely useless.. [grin]

On the music side, I was also able to apply an album buyers heuristic. The first and last tracks are the best! Those edge conditions aren't just useful in testing....