Test Cases: How to Write Them Right in 2022

With the development of new technologies, more and more interesting projects appear in the market. Obviously, developers intend to conquer their target audience and achieve success in their industries. The global software products market reached $930.93 billion in 2020 and is projected to grow to $968.25 billion in 2021.

Unfortunately, not all solutions manage to stay afloat and gain popularity among users. Standish Group’s researchers found that more than half of software projects (66%) fail due to various reasons. For example, poor product quality is a common cause of failures. A 2020 CISQ report shows that US companies lost $1.56 trillion because of low-grade solutions.

Therefore, when the development team finishes their job, every company must make sure that it’s a high-quality and efficient solution that will meet all of the customers’ requirements. Rigorous testing is the best way to do this. In this article, we will tell you how to write good test cases for your project in order to conduct the testing process correctly and effectively.

Test Cases: Do You Really Need Them?

Some companies don’t use test cases even though they have a full-fledged testing team. This can happen for a variety of reasons. Firstly, developers and testers often don’t like to write test cases as it requires a lot of brain activity and is time-consuming. A specialist spends several minutes to complete a test case, and some projects require hundreds and thousands of tests. In addition, creating a test case is rather tedious and routine work.

Nevertheless, despite some negative points, test cases provide a lot of advantages. This approach facilitates the entire testing process, allowing your team to clearly estimate the test duration. So, writing test cases offers your company the following benefits:

  • Test cases have a clear structure, allowing you to easily keep track of the testing process. You will always be aware of what has already been tested, what has not been tested yet, which test has passed, and which one has failed.
  • Sometimes the tester doesn’t understand how to test the product because the requirements are not clear. There is also a situation where it is generally impossible to test the solution. The test case will help the testers identify and solve the problem.
  • Test cases include all the necessary information about the project. These can be passwords, certificates, documents, and other important notes. You will always find the data you need quickly and easily.
  • If a new tester joins the project, test cases will help you describe the product and its features easily and quickly. What’s more, if any tester leaves the project, it won’t be very painful to replace him/her thanks to the test cases.
  • Using test cases significantly speeds up regression testing.
  • Test cases will allow you to hire less qualified specialists and save money on labor costs.
  • Using test cases and other materials from a previous project will make it easier for you to work on the following tasks.

So, applying test cases will have a beneficial effect on your project and will allow your team to test the product in the proper way.

What Is a Test Case?

A test case is a described sequence of certain actions (steps) and the expected result to test the operation of a certain product and its features.

A test case consists of the following components:

  • Test name

The title should be clear, concise, understandable, and unambiguously describe the goal of the test case.

  • Description

It is used in some cases to describe a test case when it’s impossible to briefly describe it in the title.

  • Prerequisites

It’s a description of the condition of the product under testing.

  • Test steps

Steps should be clear, understandable, and consistent. Don’t specify too many details. For example, it would be correct to write “enter the number 3 in the field.” It would be wrong to describe a lot of actions like “press the number 5 on the keyboard and then press the number 9 on the keyboard.” Don’t leave any comments or explanations. If it’s required, refer to the appropriate document.

  • Expected results

Briefly and clearly describe the condition of the product after completing each step. Avoid redundant descriptions.

Rules on How to Write Good Test Cases

#1 Make sure that you clearly understand the test requirements

If a tester doesn’t understand how product functions are supposed to work, they won’t be able to write and describe an effective test case. If you don’t understand something, clarify all the details at first, and then start writing a test case. Otherwise, you will waste time conducting an ineffective test, after which you will still have to contact your colleagues to clarify all the incomprehensible points.

#2 The test case should be simple and clear

Avoid using technical terminology and complex language patterns because it will be used by other specialists, such as developers, business analysts, project managers, and even customers.

#3 Include the optimal number of steps

If there are just 2-3 steps, there is no sense to describe this test. In this case, the checklist will be enough. At the same time, don’t include too many steps (e.g. more than 15-20 steps) because this will make your test case overloaded and difficult to understand and execute.

#4 If you are testing similar features, combine tests

Add the tests that check the same features in one test case. This will make it easier for you to store and find documentation when you need it.

#5 Update test cases on a regular basis

Always keep the documentation up to date and add new test cases and delete old ones on time. This will simplify and speed up the testing process.

Following these rules will allow you to create effective test cases that any team member can use during the software development process. Test cases help companies thoroughly check their solutions, find and fix bugs, and offer their customers a smoothly running product.

Examples of Good and Bad Test Cases

Let’s look at examples of successful and unsuccessful test cases created to check a Contact Us form on the website elinext.com.

A Correct Test Case

Number 1

Test Name Sending a message through the contact form on the Contact Us page

Prerequisites The main page of elinext.com is open. There is access to the email of the administrator of elinext.com

Test Steps

  1. Click on the Contact Us button in the upper right corner of the website.
  2. Enter a value in the First Name field consisting of Latin letters.
  3. Enter a value in the Last Name field consisting of Latin letters.
  4. Enter a valid email in the Email field.
  5. Enter a value in the Company field consisting of Latin letters.
  6. Enter a phone number in the appropriate field.
  7. Enter a value consisting of Latin letters, special characters, and numbers in the Message field.
  8. Check the appropriate box.
  9. Click on the Send Message button.
  10. Check the email of the website administrator.

 

Expected Result

  1. The Contact Us page has opened.
  2. The entered name is displayed in the First Name field.
  3. The entered name is displayed in the Last Name field.
  4. The entered email is displayed in the Email field.
  5. The entered phone number is displayed in the appropriate field.
  6. The entered text is displayed in the Message field.
  7. The box is checked.
  8. The message is sent.
  9. All fields are cleared.
  10. The administrator has received a message sent through the Contact Us form and containing the data entered in steps 1-5.

A Wrong Test Case

Number 1

Test Name Sending a message through the contact form. (Specify what are you checking and what are you doing)

Prerequisites Transfer to the main page of elinext.com. (It’s a step description instead of the prerequisite)

Test Steps

  1. Click on the Contact Us button. (Specify its location)
  2. Enter a name in the First Name field. (What symbols should you enter?)
  3. Enter a name in the Last Name field. (What symbols should you enter?)
  4. Enter an email in the Email field. (Is it correct or incorrect?)
  5. Enter a value consisting of Latin letters. (What field?)
  6. Enter a phone number in the appropriate field.
  7. Enter a text in the Message field. (What symbols should you enter?)
  8. Check the appropriate box.
  9. Click on the button. (What button?)
  10. (The last step is not entered. It’s wrong because we won’t be able to check whether it’s possible to send messages through the contact form)

 

Expected Result

  1. The page has opened. (What page?)
  2. The entered name is displayed in the First Name field.
  3. (It’s not specified what should happen?)
  4. The entered email is displayed. (What email? Where is it displayed?)
  5. The entered phone number is displayed. (Where?)
  6. We see the entered text in the Message field. (Do we see or is it displayed?)
  7. The box is checked.
  8. The message is sent.
  9. Everything is cleared. (What is cleared?)
  10. The administrator has received a message. (What message?)

Bottom Line

So, we’ve told you what test cases are, explained why they should not be ignored, and also showed you examples of good and bad test cases. Test cases greatly facilitate the testing process, which itself is the most important stage of the software development lifecycle. According to IBM research, it’s better to find and fix bugs before a product is released; otherwise, you will have to pay significantly more later.

How to choose test cases? It all depends on your project and what you are going to check. There are functionality, performance, unit, user interface, security, integration, usability, regression, user acceptance, and other test cases. Remember that writing a proper test case is a huge step towards success. If you still have any questions, please contact the Elinext specialists and they will be happy to help you.

Contact Us
Contact Us