What is a test case lifecycle

How do you write a good test case when testing software?

The main goal of any software project is to get a high quality result while reducing the cost and time it takes to complete the project. To achieve this, companies test their software before launching it. Documentation plays a critical role in conducting effective software testing. In this article you will learn more about the test case documentation type in software testing.

The following are the topics covered in this article:

  • Is documentation required in the software test?
  • What is a test case in software testing?
  • Benefits of writing test cases
  • Test case format
  • Techniques for designing test cases
  • Demo: How To Write a Test Case in Software Testing?
  • Test cases best practices

You can go through this talk about test cases in software tests, in which our software testing training expert discusses every little thing about the technology.

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

In this video you will learn how to write a test case in software testing.

Is documentation necessary in software testing?
Yes she is. Documentation plays a crucial role in test automation. Here is an example to convince you.

One company, let's call it “ABC”, delivered a project (with an unknown problem) to one of its customers. And they found the problem on the customer's side, which created a very bad situation for the company. As always, the fault lay with the quality analysts (QAs).

The problem was something related to website compatibility. The problem was brought to a higher authority, they showed the customer a written proof that they had not received such a request and asked to check the compatibility of the website. So the problem could be solved peacefully. In a way, the documented requirements saved the company from being sued. So the documentation came in very handy.

There are different levels of documentation, such as:

      • Test Script: A line-by-line description of all the actions and data required to perform a test.
      • Test case: Describes a particular idea to be tested without describing the exact steps or data to use.
      • Test Scenario: It is a simple description of a goal that a user might face while testing.

We continue with this article on "Test cases in software testing", in which we learn more about test cases in particular.

What is a test case in software testing?

A test case is a document that contains a series of conditions or actions that are executed in the software application to test the expected functionality of the function.

After test scripts, test cases are the second most detailed way of documenting test work. They describe a particular idea to be tested without describing the exact steps or data to use. In a test case, for example, you document something like "Test whether vouchers can be applied to the current price". There is no mention of how to use the coupons or whether there are multiple ways to use them. There is also no mention of whether the tester uses a link to apply a discount, enters a code, or hires a customer service representative to apply it. They give the tester the flexibility to decide how to conduct the test.

Besides that, what is the use of test cases?

Benefit from writing test cases

The main purpose of a test case is to ensure that various functions within an application work as expected. It helps testers verify that the software is free from bugs and that it works as expected by end users. Further advantages of test cases are:

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

So, these are a couple of reasons test cases are extremely useful in software testing. Test cases are powerful artifacts that serve as a good source of truth about how a system and a particular function of the software work. Before we dive into the lessons for writing top-notch test cases, however, let's have a basic idea about the terminology that is associated with them.

Test case format

The primary components of a test case are an ID, a description, a set of inputs, some steps that can be taken, and 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 in a few words what he is going to test.
    • Preconditions: All assumptions that apply to the test and any preconditions that must be met before the test is run should be listed here.
    • Test case steps: The test steps should contain the necessary data and information to run the test. The steps should be clear and brief, without leaving out essential facts.
    • Test data: It is important to choose a data set that offers sufficient coverage. Choose a data set that specifies not only the positive but also the negative scenarios.
    • Expected Result: The expected results tell the tester what he should experience as a result of the test steps.
    • Actual result: You state how the application actually behaved while the test cases were being executed.
    • Comments: Any other useful information such as screenshots that the tester would like to provide can be added here.

This is the typical format testers follow when writing a test case. Along with these parameters, testers can include additional parameters such as test case priority, test case type, bug ID, and so on.

Now that we are familiar with the format, let's go a step further in the “Test Case in Software Testing” article and learn about various techniques you can use to write test cases.

Test case design techniques

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

Specification Based (Black Box Techniques): These types of techniques can be used to design test cases in a systematic format. They use external features of the software such as technical specifications, design, customer requirements and more to derive test cases. With these type of test case design techniques, testers can develop test cases that save test time and provide full test coverage.

Structure-based (white box techniques): These techniques design test cases based on the internal structure of the software program and code. The developers go into the smallest details of the developed code and test them individually.

Experience-Based Techniques: These techniques depend heavily on the experience of the tester to understand the most important areas of the software. They are based on the skills, knowledge and expertise of the people involved.

This 'Test Case in Software Testing' article further lists the various techniques that fall under the design categories above.

Successful application of any of these test case design techniques results in test cases that ensure the success of the software test. In the further course of this article 'Test case in software test' we want to take a look at how to write a good test case.

Demo: How do you write a test case when testing software?

Here are the simple steps to get you started.

Prepare to write a test case

  1. Check whether a test case already exists. If so, consider updating the test case instead of writing a new one.
  2. Make sure that the test case has certain characteristics such as accuracy, traceability, repeatability, reusability, and independence.
  3. Before writing, consider all possible scenarios.
  4. Give yourself enough time to write test cases.

Writing a test case

  1. Choose a tool for writing a test case.
  2. Write a test case in the format discussed earlier.
  3. Write basic test instructions.
  4. Thoroughly review written test cases.

Here is an example test case for checking the login functionality, where I only added two options.

Knowing how to write good test cases is extremely important. It won't take you much effort or time to write effective test scripts as long as you follow certain guidelines.

Test cases best practices

Test cases are very important to any project as they are the first step in every test cycle. If something goes wrong with this step, it can have undesirable effects as you progress in the software test lifecycle. Some guidelines to follow when writing test cases are:

    • Prioritize the test cases to be written based on the project schedule and the risk factors of your application.
    • Remember the 80/20 rule. For the best coverage, 20% of your tests should cover 80% of your application.
    • Do not try to test the test cases in one go, but improvise them little by little.
    • List your test cases and classify them based on business scenarios and functionality.
    • Make sure the test cases are modular and the test case steps are as granular as possible.
    • Write test cases so that others can easily understand & modify them if necessary.
    • Always keep the end-user requirements in mind, because after all, the software developed is intended for the customer
    • Actively use a test management tool to manage a stable release cycle.
    • Review your test cases regularly. Write unique test cases and remove irrelevant & duplicate test cases.

    Well, I could go on, but there are far too many guidelines to list here. The above should be good enough for you to start writing test cases.

    If you found this article on Test Cases in Software Testing relevant, take a look at the live online Selenium certification training from Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners around the world.