Whether writing manual or automated tests you may have asked yourself how much stuff you should include in each test. Sometimes you may write tests with multiple steps that look like this…

Test #1
Step 1 - Do A. Expect B.
Step 2 - Do C. Expect D.
Step 3 - Do E. Expect F.

Or instead, you may write three separate one step tests…

Test #2
Step 1 - Do A. Expect B.

Test #3
Step 1 - Do C. Expect D.

Test #4
Step 1 - Do E. Expect F.

Finally, you may even do this…

Test #5
Step 1 - Do A. Do C. Do E. Expect F.

Do you see an advantage or disadvantage to any of these three scenarios?

3 comments:

  1. Anonymous said...

    With separate steps you have the potential to reuse tests in a more modular fashion. ie.:

    Test 8: Do Test 1 then Test 4.

    Test 9: Do Test 3, Test 5, then Test 2.

    Personally I would write the tests as a single large tests until I have the need to break it up. ie. XP/Agile Testing -- get it working first and refactor later. Then if I start writing another test where I'd be doing the same thing as a previous test then I would go back and break the first test into easily callable reusable tests.

  2. Eric Jacobson said...

    Hotpants, your suggestion makes sense. In your Test 9 example, does the entire Test 9 have one new verification at the end or do you use the original verifications that came from Test 3, Test 5, and Test 2?

  3. Anonymous said...

    Original verification in the individual tests. But an additional verification can also be added to the end of Test 9 after the other tests have been completed.



Copyright 2006| Blogger Templates by GeckoandFly modified and converted to Blogger Beta by Blogcrowds.
No part of the content or the blog may be reproduced without prior written permission.