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 TEST CASES in manual testing with Example 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.

6 comments:

  1. HI
    I have one question.
    Can we prepare a truth table for the test cases?
    Dose it makes a sense ?

    ReplyDelete
  2. Sure, a truth table is a good way to list all combinations of a group of boolean parameters. You can use it to design your test cases for sure. As an intermediate, if not the final step in design the table in your test case.

    Thanks for your comment, Maitri.

    ReplyDelete
  3. Good points as always, Inder. I think it depends on the nature of the test case and on the knowledge/skill level of the tester who is going to execute it. In some cases, a verbose textual description is more helpful. In other cases, you will do fine with a table of combinations like the one you outlined. Technically speaking, what you vary is the style of the test procedures. Also, sometimes you want to provide test data with the procedures. In this case: what username/password combinations are valid/invalid? You could provide it in the test case or - perhaps even better - as a separate resource file. Having this data available would be beneficial for newbie testers and/or test automators. But of course, it depends on the situation. To quote your words of wisdom: write only what is essential.

    ReplyDelete
  4. Inder,

    Nice idea to optimize the speed. Just a small concern that at some places we need to be descriptive. The reason is that it’s not necessary that person who creates the test case is always the person who will going to execute it.
    Thus we need to decide (Based on our experience) where we should be descriptive and where we should be concise.
    However idea of using and referring documents (As and when necessary) will always be a hit 

    Amit

    ReplyDelete
  5. what is truth table?

    ReplyDelete
    Replies
    1. Its a simple table containing columns for inputs and expected result(s). It is used to depict boolean values i.e. True (T) or False (F). The truth table lists all combinations for each of the input and the corresponding expected result. Here is a simple example.
      A__B__Expected Result (AND operation)
      F__F__F
      F__T__F
      T__F__F
      T__T__T

      Hope this helps.

      Delete

Note: Only a member of this blog may post a comment.