Writing test cases

More than the act of testing, the act of designing tests is one of the best bug preventers known.

Testrail

There are various test case management tools out there. We came to use Gurock Software's Testrail.

Read up on it here.

What is a test suite?

Each project can have several test suites and the scope of the test suite may vary. You might want to test everything, or just assemble a test suite that will be used for sanity checks.

Divide your test suite into digestible sections. One of the best practices is to divide it into features or screens, depending on the type of project you are working on.

How to write test cases

This is the minimum set of info each test case should have:

Additionally, it may also contain:

The title should clearly state what you are testing. Possible ways to format your title are the following:

These are some criteria that your test cases should fulfill:

You should write both positive and negative test cases.

How to maintain test cases

Versioning test suites

If you are working on several app versions at the same time, a good idea is to branch off your current test suite and start maintaining a new one.

At some point in time, you'll have fresh test cases in the new suite that will not interfere with testing the current version.

Once the current version becomes deprecated, you can simply discard the old one.

How to run a test suite

To run a test suite:

  1. Navigate to Test Runs & Results
  2. Select a test suite
  3. Give the test run a name
  4. Enter the test device, build, environment and other meta data to the description
  5. Exclude some test cases if you agreed to skip them
  6. Add the test run
  7. Go through each test case and assign it a status (Passed, Blocked, Retest, Failed)
  8. Create bugs in your project management tool if you find them and notify the team
  9. Once you are done, close the test run
  10. Generate a test report

How to generate test reports

There are several different test reports you can generate, here's how you can generate two most used ones.

Run summary

  1. Navigate to a test run
  2. Click on Run > Summary
  3. Click on Add report
  4. Wait for it to generate
  5. Download it

Detailed test report

  1. Navigate to a test run
  2. Click on the Print icon
  3. Select "Details" from the top dropdown
  4. Click on Print and save it as a PDF

SMART test cases

Read up on how to make your test cases SMART:


writing-test-cases.gif