How to Write More Test Cases

Here’s the post you’ve been waiting for, ever since I wrote about Vipul Kocher’s Q-Patterns tutorial at SEETest 2008.

This is the 2nd new thing I learnt at SEETest 2008, which made it into an excellent conference. I’m sure that quite a few of you already know this technique, but as I wrote in my post about attending International conferences, I got left behind …

The subject was “Creating Real-World Test Cases using Extension to Noun and Verb Usage”. Vipul adds an extension to the Noun and Verb usage technique which was first coined by Elizabeth Hendrickson. Vipul gave a talk on this subject at CONQUEST 2007, and since he had a bit of time left at the end of his Q-Patterns tutorial, he used it to explain this technique.

The goals of this technique are to:

  • Write effective test cases
  • Reduce the impact of bad and missing requirements
  • Raise important questions about software behavior
  • Bring more uniformity into the coverage even when different testers write test cases

In Object Oriented design, nouns are classes, and verbs are methods

In Testing,

  • nouns are test objects,
  • verbs maniputlate the test objects, i.e. they are the tests you want to apply,
  • and adverbs and adjectives affect the test objects, i.e. add more test cases.

Great. Now what do I do with this? I combine the nouns, verbs and adverbs/adjectives into test cases.

Stage 1: Extract the nouns, verbs, adverbs and adjectives.

Stage 2: Combine the nouns, verbs, adverbs and adjectives. Like this example of what an ATM system should do: 

  • Accept deposits
  • Process withdrawals quickly
  • Answer inquiries
  • Which kinds of deposits, withdrawals, inquiries?
  • Quickly, Securely 
  • There are lots of test cases that you can write if you continue combining the nouns, verbs, adverbs and adjectives

    So why do we need Vipul’s extension?

    Very often, the requirements aren’t detailed enough, for example: “the given application allows users to open supported files”.

    I’m sure that none of you have ever seen a requirement that looks like this!!

    What is the extension ?

    • Extract the nouns and verbs
    • Use “5W1H” (who, what, why, where, when, how, how many, how far …) to extract adjectives, adverbs
    • Use pre and post conditions to extract more nouns and verbs
    • Enumerate properties of every noun
    • Break down these properties to base elements
    • Use boundary values, equivalence classes on the base elements
    • Write tests for individual properties
    • Combine operations (verbs) to write scenario based tests  

    I was going to continue with completing the example, but that would have made this post SOOO LOONNG.

    So, for full details of the technique and a complete example, go to Vipul’s CONQUEST presentation.

    Just one word of warning about this technique: It can be used to easily develop 1000’s of Test Cases, but that is not the idea. The idea is to use the technique to develop 1000’s of IDEAS, then to prioritize them, and then to decide which ideas to develop test cases for.

    If you enjoyed this post, please consider subscribing to my RSS Feed, to keep up with all future updates.

    Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to Ma.gnoliaAdd to TechnoratiAdd to FurlAdd to Newsvine

    Advertisements

    2 responses to “How to Write More Test Cases

    1. Hi Deb, this is true, a good technique that I would advocate…however with an extension…I always add the next question…”How will I know”…so that as I am defining the test cases I am also defining my expected outcome in a testable way…if it is not testable, or measurable, then I know that I have to rework my test case.

      Cheers
      Sharon

    2. Sharon, of course you are so right. If you have no way to tell what the expected outcome will be, your test case isn’t going to be much help…
      Regards
      Debi

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s