Testing With Selenium WebDriver (72 Blogs) Become a Certified Professional
AWS Global Infrastructure

Software Testing

Topics Covered
  • Testing With Selenium WebDriver (62 Blogs)

How to Write a Good Test Case in Software Testing?

Last updated on Nov 25,2020 59.8K Views

The prime objective of any software project is to get a high-quality output while reducing the cost and the time required for completing the project. To achieve that, companies test their software before they release it to the market. Documentation plays a critical role in achieving effective software testing. In this article let’s explore more about a documentation type called test case in software testing.

Listed below are the topics covered in this article:

You can go through this lecture on test case in software testing where our Software Testing Training expert is discussing each & every nitty gritties of the technology.


How To Write A Test Case? | Test Case In Software Testing | Edureka

This video will give you an in-depth knowledge on how to write a Test Case in Software Testing.

Is Documentation Needed in Software Testing?
Yes! It is. Documentation plays a critical role in Test Automation. Here’s an example to convince you, people.

A company, let’s call it ‘ABC’, delivered a project (with an unknown issue) to one of its clients. And they found the issue at the client-side, which created a very bad situation for the company. Like always all blame was on Quality Analysts(QAs).

The issue was something regarding the compatibility of one website. The issue was presented to higher authorities, they showed the client a written proof of not receiving any such requirement asking to check compatibility of the website. So, the issue was resolved peacefully. In a way, the documented requirements saved the company from getting sued. That’s how documentation came in very handy.

There are different levels of documentation, like:

Documentation - Test Case in Software Testing - Edureka

      • Test Script: A line-by-line description of all the actions and data needed to perform a test.
      • Test Case: Describes a specific idea that is to be tested, without detailing the exact steps to be taken or data to be used.
      • Test Scenario: It is a simple description of an objective a user might face when testing.

Moving further with this article on ‘Test Case in Software Testing’ let’s learn more about test cases in particular.

What is a Test Case in Software Testing?

A test case is a document which has a set of conditions or actions that are performed on the software application in order to verify the expected functionality of the feature.

After test scripts, test cases are the second most detailed way of documenting testing work. They describe a specific idea that is to be tested, without detailing the exact steps to be taken or data to be used. For example, in a test case, you document something like ‘Test if coupons can be applied on actual price‘. This doesn’t mention how to apply the coupons or whether there are multiple ways to apply. It also doesn’t mention if the tester uses a link to apply a discount, or enter a code, or have a customer service apply it. They give flexibility to the tester to decide how they want to execute the test.

Apart from this, what is the use of test cases?

Benefits of Writing Test Cases

The key purpose of a test case is to ensure if different features within an application are working as expected. It helps tester, validate if the software is free of defects and if it is working as per the expectations of the end users. Other benefits of test cases include:

      • Test cases ensure good test coverage
      • Help improve the quality of software,
      • Decreases the maintenance and software support costs
      • Help verify that the software meets the end user requirements
      • Allows the tester to think thoroughly and approach the tests from as many angles as possible
      • Test cases are reusable for the future – anyone can reference them and execute the test.


So, these are a few reasons why test cases are extremely useful in software testing. Test cases are powerful artifacts that work as a good source of truth for how a system and a particular feature of software works. However, before we deep dive into the lessons for writing top-notch test cases, let us have a basic idea on the terminologies associated with them.

Test Case Format

The primary ingredients of a test case are an ID, description, bunch of inputs, few actionable steps, as well as expected and actual results. Let’s learn what each of them is:

    • Test Case Name: A test case should have a name or title that is self-explanatory.
    • Test Case Description: The description should tell the tester what they’re going to test in brief.
    • Pre-Conditions: Any assumptions that apply to the test and any preconditions that must be met prior to the test being executed should be listed here.
    • Test Case Steps: The test steps should include the necessary data and information on how to execute the test. The steps should be clear and brief, without leaving out essential facts.
    • Test Data: It’s important to select a data set that gives sufficient coverage. Select a data set that specifies not only the positive scenarios but negative ones as well.
    • Expected Result: The expected results tell the tester what they should experience as a result of the test steps.
    • Actual Result: They specifies how the application actually behaved while test cases were being executed.
    • Comments: Any other useful information such as screenshots that tester want’s to specify can be included here.

This is the typical format that testers follow when they write a test case. Along with these parameters, testers can include additional parameters like test case priority, type of test case, bug id, etc.

Now that we are familiar with the format, let’s go one step ahead in the ‘Test Case in Software Testing’ article and learn about different techniques that you can use to write test cases.

Test Case Design Techniques

An efficient test case design technique is necessary to improve the quality of the software testing process. It helps to improve the overall quality and effectiveness of the released software. The test case design techniques are broadly classified into three major categories:

Specification-Based(Black Box Techniques): This type of techniques can be used to design test cases in a systematic format. These use external features of the software such as technical specifications, design, client’s requirements, and more, to derive test cases. With this type of test case design techniques, testers can develop test cases that save testing time and allow full test coverage.

Structure-Based(White Box Techniques): These techniques design test cases based on the internal structure of the software program and code. Developers go into minute details of the developed code and test them one by one.

Experienced-Based Techniques: These techniques are highly dependent on tester’s experience to understand the most important areas of the software. They are based on the skills, knowledge, and expertise of the people involved.

This article ‘Test Case in Software Testing’ further lists the different techniques which come under the design categories specified above.

Test Case Design Techniques - Test Case in Software Testing - Edureka

Successful application of any of these test case design techniques will render test cases that ensure the success of software testing.  The remainder of this ‘Test Case in Software Testing’ article let’s check out how to write a good test case.

Demo: How To Write a Test Case in Software Testing?

Here are the simple steps to get you started.

Preparing to write a test case

  1. Check if a test case already exists. If yes, consider updating test case, rather than writing a new one.
  2. Make sure the test case has certain characteristics like accuracy, tracing, repetition, re-usability, and independence.
  3. Consider all the different scenarios possible before writing.
  4. Give yourself enough time to write test cases.

Writing a test case

  1. Select a tool for writing a test case.
  2. Write a test case in the format discussed earlier.
  3. Write basic test statements.
  4. Review written test cases thoroughly.

Here’s a sample test case for checking login functionality, though I have added just two possibilities.

Demo - Test Case - Test Case in Software Testing - Edureka

Knowing how to write good test cases is extremely important. It doesn’t take too much of your effort and time to write effective test scripts as long as you follow certain guidelines.

Test Cases Best Practices

Test cases are very important for any project as they are the first step in any testing cycle. If anything goes wrong at this step, it might have undesirable impacts as you move forward in the software testing life-cycle. Few guidelines that you need to follow while writing test cases are:

    • Prioritize which test cases to write based on the project timelines and the risk factors of your application.
    • Remember the 80/20 rule. To achieve the best coverage, 20% of your tests should cover 80% of your application.
    • Don’t try to test cases in one attempt instead improvise them as you progress.
    • List down your test cases and classify them based on business scenarios and functionality.
    • Make sure test cases are modular and test case steps are as granular as possible.
    • Write test cases in such a way that others can understand them easily & modify if required.
    • Always keep end-users’ requirements in the back of your mind because ultimately the software designed is for the customer
    • Actively use a test management tool to manage stable release cycle.
    • Monitor your test cases regularly. Write unique test cases and remove irrelevant & duplicate test cases.

Well, I can keep going on but there are way too many guidelines than I can actually list here. The ones listed above should be good enough for you to get started in writing test cases. Hope the things that you have learned here today will help you as you head out on your software testing journey.

If you found this “Test Case in Software Testing” article relevant, check out the live-online Selenium Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. 

Got a question for us? Please mention it in the comments section of this ‘Test Case in Software Testing’ article and we will get back to you.

Upcoming Batches For Selenium Certification Training Course
Course NameDateDetails
Selenium Certification Training Course

Class Starts on 27th April,2024

27th April

SAT&SUN (Weekend Batch)
View Details
Selenium Certification Training Course

Class Starts on 11th May,2024

11th May

SAT&SUN (Weekend Batch)
View Details
Selenium Certification Training Course

Class Starts on 20th May,2024

20th May

MON-FRI (Weekday Batch)
View Details

Join the discussion

Browse Categories

webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

How to Write a Good Test Case in Software Testing?