How to Write Your First Test Case

One of the difficulties in writing your first test case is that it’s hard to know where to start. Writing test cases is not that difficult if you understand who you’re writing for and what you’re hoping to achieve.

How to write a test case

How to write a test case

What’s the purpose of a test case?

The purpose of a test case is to:

Describe how you plan to verify (i.e. prove) that the software agrees with the specifications.

That’s it.

The next step is to demonstrate that you’ve done this correctly and haven’t modified the findings or changed the result data.

Ideally, when you finish writing the test case, you can give it to someone else, e.g. tester or developer, and they can do the testing with the test case you wrote.

Writing your first test case

Here’s how to keep you test cases practical and effective:

  1. Test Case Description – Identify the information necessary to verify the functional requirements.
  2. Requirement Traceability – Cross-reference to the number in the specification (SRS) document.
  3. Purpose – Describe the software features that will be tested; the behavior being verified, for instance, when you click A, B occurs.
  4. Procedure – Describe how to perform the test. Keep the text simple and make sure the reader doesn’t ‘interpret’ what you’ve written. For example, “Click the Save button on the menu to save the document.”).
  5. Test Data – Include the exact input data that will be provided and the output for each case. Include any manual calculations necessary to determine the outputs.

Formatting your test case

You can use either Microsoft Word or Excel. I suggest that you use tables to structure the data and make it easier to read.

  • Represent test data in tabular form
  • Create one column for input items and
  • Create one column for expected outputs

If the input data is held in an external file, identify the file name and its location.

What else would you add?