Sunday, February 13, 2011

How to write test cases faster?

In one of my prior projects, I was writing test cases (see my video, What is test case) with the deadline only a couple of days away. It made me anxious at the time and I put in longer hours to finish the task. But, I decided to later search ways to complete writing my test cases faster. Here are my thoughts for your benefit. Especially useful if you work on projects with very tight deadlines. See the video, How to write effective test cases quickly? or read on...

How to write test cases faster?

1. "A picture is worth a thousand words."
Tables are a great way to consolidate test cases. Especially, when you have to test a number of combinations. Compare the ordinary version (TC1, TC2, TC3 and so on) with the tabular version (only TC1) for the login test case example.
When you use the table, your focus will shift from writing the sentences to designing the test combinations.

2. Refer other documents in your test cases.
If another document (e.g. a user manual) already lists the clear steps to perform an operation the application, you can refer the appropriate section within your test case. No need of pasting the section within your test case. This not only reduces your effort. It also makes your test case more maintainable. If the source document changes, there is no need to update your test case since it just contain a reference. However, the source document should be readily available.
You can also use this approach across test cases.

3. De-clutter your test cases.
Write only what is essential. Not one word more. Separate test data from test steps and expected results. This will allow you focus better on one item at one time. It will also make your test cases cleaner.

Nice side-effects of using the above approaches include:
a. Your test cases will be shorter and hence easier to read, understand and execute.
b. Your test cases will have less duplicity making them more maintainable.
c. It will be easier for you to review them to eliminate mistakes.

In short, not only will you take lesser time to write your test cases now, but your test cases will end up with higher quality too.