What is a Test Case

What is a Test Case?

Example Template, Types, Best Practices

A test case is a document which consists of a set of conditions or actions which are performed on the software application in order to verify the expected functionality of the feature. Here we describe the end to end logical flow of a specific requirement with test data, prerequisites and expected results.

Format of standard test cases

A sample test case

Test case

Below is the description of the test case

Test case ID: The ID of the test case

Test case description: The objective or summary of the test case

Prerequisites: Any preconditions which need to be executed before starting the test

Test steps: Procedure to execute the test

Test data: Data required while executing the test

Expected Result: The expected output of the test

Actual Result: The actual output of the test

Status: Pass, Fail, ‘Not executed’ when test case is not executed and ‘Blocked’ when high severity bug is found

Created By: Name of the person who wrote the test case

Date of creation: The date on which the test case was authored

Executed By: Name of the person who ran or executed the test case

Date of execution: The date on which the test case was executed

Types of test cases

There are two types of test cases as mentioned below:

Formal test cases: Formal test cases are those test cases which are authored as per the test case format. It has all the information like preconditions, input data, output data, post conditions, etc. It has a defined set of inputs which will provide the expected output.

Informal test cases: Informal test cases are authored for such requirements where the exact input and output are not known. In order to test them the formal test cases are not authored but the activities done and the outcomes are reported once the tests are run.

Best Practices/How to write good test cases?

While authoring test cases there are few important pointers that should be kept in mind.

Customer Requirement: Test cases should be created by keeping the customer requirements in mind.

Straightforward, Simple and Clear: Test cases should be very crisp and clear. It should be very straightforward. The number of times it gets executed no matter by whom, it should give the same output.

Preferably use Assertive language while writing the test cases like enter username, click on login button, navigate to home page, etc.

Do NOT presume: Do NOT make any guesses of any functionality or feature of your application. Always author the test cases as per the requirement specification document.

Unique test cases: Each of the test cases should have a unique name this helps in classifying the test cases while bug tracking or reviewing any requirement at later stage.

Should NOT be repeated: The test cases authored should not be repeated. If any of the test case requires to execute the same steps of other test case then instead of writing it again it’s always good to call that test case by its ID in the prerequisites column.

Assure 100% test coverage: Ensure that all the customer requirements are met while authoring the test case. As per the customer specification all the conditions are covered.

Implementation of Testing Techniques: While writing any test case it is not possible to cover all the conditions of your software application. With the help of testing techniques we can find few test cases where the chances of finding bugs are more.

Boundary Value Analysis (BVA)

Equivalence Partitioning (EP)

State Transition techniques

Decision Tables

Error Guessing technique

Exploratory testing

Peer Review of Test Cases: Test cases should always be reviewed by peers. If any precondition or any condition is missed while authoring the test case then it can be covered as per the peer’s feedback.

Advantages of writing test case

Test case is a written document which can be referred anytime by anyone in the team to understand the end to end functionality of any feature.

It saves time of the team members as no one has to sit and make another person understand about the functionality of the feature.

Writing test case ensures the maximum coverage of the product or application as per the customer requirement.

Writing test case helps in improving the software quality

Disadvantages of writing test case

If any existing feature is changed then the related testcases needs modification which is time consuming as one has to go through the entire list of test cases and find those test cases which requires modification.

If any feature becomes obsolete then the associated test cases should be cleaned.