How To Write Effective Test Cases?

While writing the test cases you need to follow some steps to make sure that you will write good and effective test cases.

1. Identify The Scope And Purpose Of Testing

First key point before start writing effective test cases is that you need to identify the testable areas based on the Acceptance Criteria. You need to understand the purpose of testing & you must understand the features and user stories.

2. Define How To Perform Testing Activities

Before start writing the effective test cases, you should first start defining the effect test scenarios and to start defining effective test scenarios you should have better understanding of functions of the application. You must know about what all operations can be used, so that the test scenarios & test cases can be written based on these important guidelines.

3. Identify Non-Functional Requirements.

Along with the function requirements, the non-functional requirements are equally important. Basically in non-functional requirements such as Operating system, hardware requirements, security features to be considered and also identity additional prerequisites required for testing like test data preparation.

4. Define The Test Case Framework

Depends on the System and architecture being supported and built. Typically, the test cases should cover functionality, compatibility, UI interface, fault tolerance, and performance of several categories.

5. Become Familiar With The Significance Of Software Modules

It is simple and easy to understand analyze the significance of the software modules there in the application under test. On the other hand it is also equally important to identify the integration with internal modules. So to write good test cases you should familiar with the importance of these & consider same while preparing the test cases.

6. Structuring Of Test Cases

At this point you have all the necessary information to start writing test cases. Here we are talking about basic structure of test case & what all comprises in the test case.

7. Leverage User Stories and Test Cases for Test Script Automation

If the Acceptance Criteria for User Stories and Test Cases can be written in Gherkin Format, that it makes the functional automation of Test Scripts more efficient and easier.

Gherkin is a Domain Specific Language for writing acceptance criteria that has five main statements:

  1. Scenario — a label for the behavior you're going to describe
  2. Given — the beginning state of the scenario
  3. When — a specific action that the user takes
  4. Then — a testable outcome, usually caused by the action in When
  5. And — this continues any of the other three operators

Together these statements describe all of the actions that a user must take to perform a task and the result of those actions.

For example, a real-world Gherkin example might look like this:

Scenario: User clicks the link
Given I am on the homepage
When I click the provided link
Then I should see the link click confirmation