How to write Effective test cases

Reading Time: 4 minutes
The Art of Writing Good Test Cases - QA world

Hey everyone, hope you guys are chilling best with your health and having an absolutely amazing time with Knoldus Inc. Although it is been a very short stint with this company but I have a plethora of astounding experience and learning with this organization.

How to write effective test cases might not seem the important part for a developer but for a tester it is. To do their job as a software tester, they should be familiar with the set of steps to follow and a clear definition of what to test.

In this blog, we cover the following topics related to how to write a test case and get acquainted with the following topics by the end of this blog

  • Difference between Test Suite and Test Plan
  • Example of Test Cases
  • Way of writing Effective cases
  • Importance of Test Cases

Difference between Test suite and Test plan

In the aspect of test cases development, both terms play a vital role.

acceptance testing in Test Life Cycle

What is a Test suite

It allows you to categorize test cases in ways that align with any analysis or planning needs. Think of test suites as a bookshelf to organize your test cases on.

In the proceeding of planning and running tests, keeping track of hundreds of cases really becomes unmanageable. When you learn about test cases, the image of test suites should be really simple. With an increasing amount of test cases, the need for categorizing them increases as well.

What is a Test plan

A test plan is a detailed document that outlines the test strategy, objectives, test schedule, required resources (human resources, software, and hardware), test estimation, and test deliverables.

Making a test plan is the most critical task of the test management process. According to IEEE 829, the following steps to be followed:

  • Analyze product structure and architecture.
  • Now design the test strategy.
  • Define all the test objectives.
  • Define the testing area.
  • Resource planning
  • Schedule all activities in an appropriate manner.
  • Determine all the Test Deliverables.

In conclusion, a test plan is similar to the umbrella that stands on over all of the test suites. For more clarification, test suites are bookshelves and test cases are books so test plans are the area that contains the bookshelves/ kind of library we can say.

What is a Test Script

A test script is a short program that aims to test certain functionality. In other words, It is a line-by-line description of all the actions which we require to perform and test on specific user journeys.

When we put down the test cases as a tester, try to measure all angles of code. In addition, The steps involved may also be intended to convince a Fail result as opposed to a positive expected result. For instance, when a user inputs an invalid password on a login page.

What is a Test Case

A test case is exactly what it sounds like: A detailed documentation that explains any particular test scenario or we can say that brief explanation of how to test it, it will behave as a step to step processor which we need to follow to reproduce that scenario.

Some of the examples of test cases to check the functionality of the amazon login page are:

Way of writing Effective cases

Step 1: Test Case ID

Test cases should have unique IDs to represent them. In most cases, this naming ID helps with company, transparency, and understanding.

Step 2: Test Description

This description gives details of the feature for testing.

Step 3: Test Type

This gives the idea about our test cases are positive or negative.

Positive test cases: It is a type of test in which we pass the valid input and check whether the software application behaves as expected with positive inputs or not.

Negative test cases: It is a type of test in which we pass the invalid input and check whether the software application behaves as expected with negative or unwanted user input.

Step 4: Test Data

This gives the variables and their values in the test case. In the above case, we write test data for email login functionality, it would be the username and password for the account.

Step 5: Test Step

These should be easily notable steps as executed from the end user’s perspective. In the above case, logging into an email account might follow these steps.

1. Open email server web page.

2. Enter a username.

3. Enter a password.

4. Click the “Enter” or “Login” button.

Step 6: Expected Behavior

This indicates the result of functionality we expect. If entering the right login information, the expected result would be a successful login.

Step 7: Actual Behavior

The actual result is the result that the tester gets when performing a test case. It can coincide with an expected result or not. When the actual result doesn’t clash with the expected result. Therefore, the bug is found.

Step 8: Pass/Fail

Determining the pass/fail status depends upon the expected and actual behavior of functionality. If the expected behavior matches with the actual one, we passed the test case and if not, we failed the test cases.

Same result = Pass

Different results = Fail

Importance of test cases

Test cases play one of the crucial roles during the Software development process not just for the testing team but for the development and management team also. Suppose, due to any circumstance if there is no documentation then we can use the test cases for the baseline documentation. When we make test cases first, we have to understand the functionality of the application and srs documentation which helps us provide the vision of the application. Secondly, through the test cases, the client’s expectations can be estimated.

For more exploration about writing test cases click here

References

https://www.edureka.co/blog/test-case-in-software-testing/

Scala Future

Written by 

Sumit is learning as an QA in the Automation Testing Studio of Knoldus Inc. Apart from being professional he loves traveling.