How to write test cases for mobile app testing

March 30, 2023
Published
11 minutes
Reading time
Development
Category

Writing test cases is an essential part of the mobile app testing process, as these documents provide a structured and systematic approach to evaluating an app’s functionality, usability, and performance.

By creating comprehensive test cases, testers can be sure they’re covering all critical aspects of an app and reducing the chances of missing potential issues.

In other words, they minimize the possibility of a defective app being released to end users.

But how do you ensure that the test cases are well-crafted?

You can start by reading this article! In the following sections, we will present seven tips on how to write effective test cases that contribute to the development of high-quality, reliable, and user-friendly mobile apps.

Let’s get started.

Follow the software requirements specification

Understanding and following the software requirements specification (SRS) is a critical first step when writing test cases for mobile app testing.

The SRS contains the necessary information and requirements that should guide the development of the entire app.

By closely adhering to this document, testers can write test cases that will more accurately reflect the desired functionality and behavior of the app and evaluate its key areas.

This document typically contains three main components, illustrated in the following image:

SRS document components
Source: Clockwise

The product overview provides a high-level description of the mobile app, its purpose, and its intended users.

This section is crucial for understanding the context in which the app will be used, and its purpose is to direct the testers’ efforts.

Next is the requirements section, which outlines all the different kinds of requirements and is most crucial to review before writing test cases.

Understanding and following the functional and non-functional requirements is especially vital.

Functional requirements vs. non-functional requirements
Illustration: Shake / Data: ReQtest

By following these requirements, testers ensure that test cases address all aspects of the app’s functionality while keeping the app’s properties and user expectations in mind, leading to a more comprehensive testing process.

Finally, even though the appendix might seem like a section that is not as important, it can contain some additional helpful information.

Bug & crash reporting tool for mobile apps.

For example, the assumptions and dependencies section can point out any difficulties that may arise during the app development phase, so testers can be better prepared to address and overcome them.

By closely adhering to the software requirements specification, testers can ensure that test cases are aligned with the app’s objectives, leading to more effective and accurate testing.

Use a requirement traceability matrix

To ensure that the SRS is closely followed, it’s advisable to use a requirements traceability matrix (RTM).

Such a matrix is a valuable tool for tracking the previously mentioned requirements during the mobile app testing process.

It helps ensure that all requirements are accounted for, and facilitates easy tracking of the test cases associated with each requirement.

There are three types of RTMs, shown below:

Bi-directional traceability
Source: STM

All these types refer to how the requirements are mapped to their corresponding test cases.

While forward traceability matrices will map the requirements to the test cases, backward traceability matrices will trace test cases back to the requirements they address.

Bi-directional traceability combines the two. This means you can identify which test cases correspond to specific requirements and determine which requirements are covered by a particular test case.

To understand RTMs better, look at the following table:

Requirements traceability matrix
Source: OpenCodez

As you can see, this table links the business and functional requirements with corresponding test cases.

For example, the highlighted requirement FR_4, allowing users to pay by credit card, has two corresponding test cases—TC#007 and TC#008.

This mapping ensures that those test cases cover the requirement and will be used to evaluate the specific functionality of the app.

Clearly, an RTM is a valuable tool that aids in organizing and managing test cases and ensures the complete coverage of an app’s requirements, so you might want to use it in the testing process.

Prioritize which test cases to write

Mobile app testing efforts are often limited by time and resource constraints, so prioritizing which test cases to write first can help make the most effective use of these resources.

By focusing on creating the essential test cases first, testers can ensure that critical issues are identified and addressed early on, reducing the risk of delays and improving the overall quality of the mobile app.

However, choosing which test cases to focus on is not a simple task, as there are various approaches to test case prioritization, as shown in the following image:

Shake screenshot
Illustration: Shake / Data: BrowserStack

In general, these methods aim to balance several factors, such as the test coverage of the particular test case, the problem areas it will address, and the resources required for testing, among other things.

Through these methods, test cases can be prioritized. They are usually grouped into four priority categories, from Priority 1 (the highest priority) to Priority 4 (the lowest priority).

Test case priority categories
Source: BrowserStack

These categories can help testers determine which test cases would be essential to run and focus on developing them first.

For example, a Priority 1 test case might be Verify that the user can securely log in to the app.

This test case is crucial, as it addresses a basic functionality of the app, so it must be created and executed as early as possible.

Overall, prioritizing which test cases to write can optimize the mobile app testing process and focus it on the most important aspects of an app, ensuring that they function well and any critical issues are identified and addressed early.

Start by writing test scenarios

Before diving into the details of creating test cases, starting by writing the test scenarios is helpful.

Test scenarios are high-level, concise descriptions of particular app functionalities or features that need to be tested.

They serve as the foundation for creating more detailed test cases, which specify the individual steps and inputs that go into each test, and their expected outcomes.

In other words, test scenarios answer what needs to be tested, while test cases help answer precisely how to test the specific thing.

A single test scenario can contain multiple test cases, allowing you to capture various situations or conditions that arise during the execution of a specific functionality.

This is visually represented in the next image.

Test scenario
Source: Javatpoint

It’s always helpful to create the scenarios first, as this practice can better structure the testing process and helps testers quickly identify the key functionalities that need to be evaluated for bugs and defects.

When the test cases are eventually made, they can be easily mapped to the established scenarios, ensuring comprehensive coverage and alignment with the app’s requirements.

The following table illustrates our point, showing how testers and other stakeholders can organize test scenarios with the other essential documents.

test scenarios table
Source: Opencodez

The table highlights the connection between requirements, test scenarios, and the number of test cases that will be developed to ensure the various aspects of a particular scenario are covered.

Writing test scenarios first allows for a more organized approach to test case creation, ensuring that all relevant aspects of an application are considered and adequately covered.

Write detailed step-by-step instructions

When writing the actual test cases, it’s important that the testers include detailed, step-by-step instructions that can easily be followed while evaluating the app.

The primary function of a test case is to provide the steps that the testers need to follow in order to run a test and verify whether a specific aspect of an app works as intended.

So, writing these instructions using the best practices is paramount.

The following example shows a test case with clear and well-defined steps:

1. Open the app

2. Enter the UserID

3. Enter the Password

4. Click Login

This test case is well-structured and easy to follow, providing a clear sequence of actions for the tester to perform.

By breaking down the process into individual steps, this test case ensures that the tester can accurately verify the login functionality of the mobile app.

On the other hand, poorly written test cases might be prone to some common issues, such as composite steps or multiple conditions in one case.

For example, a test case with multiple conditions might look something like this:

This test case is less effective because it combines several actions and conditions into one step, increasing the potential for testers to get confused and potentially causing errors during testing.

In fact, the test case can easily be divided into four cases, a separate one for each step. For example, the test case for step b. would be:

1. Open the app

2. Leave the Username field empty

3. Enter the Password

4. Click Submit

Writing clear, step-by-step instructions in test cases is key to an effective testing process, so avoiding some of the common mistakes can guide testers to write these documents well.

Consider the end user’s point of view

A useful tip to keep in mind when writing test cases is to take into account how users interact with the app and construct test cases that consider the user’s point of view.

Keeping the end user’s perspective in mind is a useful approach, as it helps testers focus on areas and functions of the app that are most important for their users and create test cases that verify the app’s functionality and assess its usability and quality from the end user’s perspective.

Testers might want to consider asking themselves the following questions to adjust their perspective:

Testers might want to consider asking themselves the following questions to adjust their perspective
Source: Stickyminds

These questions help guide the testing process, ensuring that the app’s design, functionality, and performance are optimized for the end user, assisting testers in identifying any app areas that may require additional testing and creating test cases accordingly.

Another useful approach is persona-based testing. It relies on using user personas, or fictional representations of the app’s target audience, designed to help testers understand their users’ goals, needs, and expectations.

Miracle Saris goals
Source: UXcel

For instance, consider a vacation-planning app aimed at mothers. You might create a user persona representing a typical mother who would use the app—similar to the one shown above.

Testers can then put themselves in the shoes of this persona, allowing them to identify potential problem areas in the app that need to be addressed with test cases.

By adopting the end user’s perspective, testers can craft test cases more likely to detect issues affecting the user experience.

This approach ensures that the final product meets user expectations and delivers a seamless, enjoyable experience for the target audience.

Be sure to review the test cases

A vital final step after creating the test cases is to review them. This review ensures that test cases are accurate, complete, and error-free, ultimately contributing to a more effective testing process.

There are three standard techniques for reviewing test cases:

As the name suggests, a self-review involves the tester reviewing their test cases after writing them, thus double-checking their work and identifying any areas they can improve.

However, reviewing one’s work can be difficult, so it might be better to employ peer reviewing.

Bug and crash reporting tool for apps that gets you all the right data.

This process has fellow testers or other team members review the test cases, providing a fresh perspective and allowing for additional scrutiny, as the peer reviewer may identify issues or gaps the original tester might have overlooked.

Finally, a supervisory review involves having the test lead or a manager review the test cases, using their experience and expertise to detect any issues, provide valuable feedback, and ensure the test cases align with the overall testing strategy.

No matter which method is used, once a test case is reviewed, it’s helpful to document any issues found during the review process in a table like the one shown below.

test case table
Source: Javatpoint

This table includes fields for the test case name, the step number where there is an issue, and the severity of the problem, making it easy to track and address any concerns that arise during the review.

Reviewing test cases is an essential practice that lets testers make a final check to detect and correct any potential issues and oversights within these documents that can potentially negatively impact the testing process.

Conclusion

In this article, we’ve covered some tips for writing test cases for mobile app testing, giving you valuable insights and practical suggestions for creating thorough and effective test cases.

We hope that, by going over the information provided, you have gained a better understanding of the importance of test cases and have learned practical tips on the best ways to approach their creation for mobile app testing.

Applying these practices and methods can help an organization’s testing team be better equipped to develop comprehensive test cases and contribute to a rigorous mobile testing process.

Ultimately this practice ensures that an app is tested adequately and released to end users meeting the highest possible standards of quality.

About Shake

Shake is a bug and crash reporting tool for mobile apps. It helps developers solve reported issues in their app faster, without having to bother the user.

Help your app be the best version of itself.

Add to app in minutes

Doesn’t affect app speed

GDPR & CCPA compliant