App & Browser Testing Made Easy

Give your users a seamless experience by testing on 3000+ real devices and browsers. Don't compromise with emulators and simulators

Get Started free
Home Guide Fundamentals of Writing Good Test Cases

Fundamentals of Writing Good Test Cases

Shreya Bose, Technical Content Writer at BrowserStack -

Table of Contents

    It doesn’t matter how well-designed a certain software is, it needs to go through multiple layers of testing before release. Hence, every tester or QA has to write multiple test cases in every project they are involved with.

    Naturally, writing good test cases is of utmost importance. This article aims to help readers with exactly that.

    Let’s begin with examining the characteristics of a good test case:

    • Stand in the customer’s shoes

    It is not uncommon for customers to call support staff in order to complain that a certain application feature is performing below expectations. Any tester must be able to relate to customers, anticipate their needs and create test cases accordingly. The test cases should be able to test features in line with how customers use them. Keep the customers’ requirements up front when writing good test cases. This is especially true for running usability tests and accessibility tests.

    • Understand user personas

    A great way to understand user requirements is to create user personas. A user persona is basically a fictional profile of an end-user of a certain website or application. Consider the following user persona: Mike is a frequent shopper on an e-commerce site. He is most likely to care about a great display that showcases the products well, functions that let him add products to bag and view pricing easily. He won’t care about back-end functions like API communication and so on.

    Therefore, test cases must be built in alignment with this persona. Focus test cases on examining the user interface so that it is easily navigable and visually appealing. Since e-commerce involves online financial transactions, security will be of concern as well.

    User personas help testers understand the user’s scope. Consequently, they can design test cases that ensure that an app’s features are working to provide what the user needs. By creating multiple user personas, developers, testers and all stakeholders can work to shape their software for maximum user satisfaction.

    • Aim For 100% Test Coverage

    The whole point of writing good test cases is providing test coverage as widely as possible. Each test case must aim to cover as many features, user scenarios and as much of the workflow as possible. Plan test cases to cover each component, feature, and function outlined in the SRS (software requirements specification) document.

    • Use a good Test Case Management Tool

    Test case management tools are necessary for managing a stable release cycle. They help to offer transparency so that everyone knows who is working on what. They can track deadlines, and much more. Creating good test cases include using these tools actively and efficiently. Ensure, at the beginning of a test cycle, that the management tool is one that all QAs on a team are proficient or at least, comfortable with.

    • Keep an eye out for dependent test cases

    It is possible that a tester may find a bug, but may not be able to replicate it. This can happen if a test case is dependent on other test cases. For example, test case X may only be executed after test case Y and Z have been executed in sequence. It is best to avoid this as far as possible since bug replication or even review of test cases tend to take more time and effort.

    • Use automation in your favor

    Software testing is a rigorous and never-ending process. Constant changes and updates in features mean that regression tests have to be run repeatedly to ensure that no change to the code breaks the original, functional codebase. Doing so manually is exhausting and redundant at this point.

    Using automation test frameworks like Selenium is the best way to execute such tests involving repetitive actions. Automated selenium testing results in increased productivity and bandwidth for the software tester, who can focus on writing effective test cases instead of going through the same motions each day.

    Start Automating for Free

    Now that we are clear with the characteristics of a good test case, let’s have a look at some things that poorly constructed test cases have in common, so testers know what to avoid:

    • They run only one particular test condition

    Each test case must be built while considering multiple user scenarios that the website or application is expected to handle. This means testing the software module with all possible combinations of the main conditions. Now, comprehensive testing of these combination requires presenting them in a way that other QAs can also review them.

    • They only cover one small part of a functionality

    It is ineffective to build test cases that focus on a specific function. Instead, they need to verify usage patterns and workflows. Each test case should be crafted to test as much of the workflow as possible, and doing so while operating across technical boundaries of the software being tested.

    • They test only a specific user role

    Test cases created to test a specific user role are limited in scope and thus, less effective. The most effective test cases verify a user’s journey through an application. For example, any business application is best examined with test cases that are meant to test entire business processes. They should ideally cover a number of user roles and systems that serve to initiate and complete the business process.

    • They simply repeat the requirements document

    Often, testers will just repeat the requirements document in their test cases. What test cases need to do is to test “corner-cases”. Writing test cases for corner cases is challenging, but most rewarding because they detect the flaws that are most likely to disrupt the user experience.

    • They are not cataloged systematically

    It is possible to write a hundred test cases rather effortlessly and pile them into a shared folder system. However, without systematic tagging and cataloging, it becomes a nightmare when it comes to identifying a particular test case at a later date. Test cases should be filed in a manner that enables a test management system to access the right one at any time.

    Before writing a test case, go through the points discussed in this article. Spare yourself the trouble of making common mistakes so that the software in question may be tested faster. Identify bugs quicker so that they may be replicated and resolved as early as possible. Knowing the characteristics of a good test case is pivotal for any QA or QA team if they are to successfully work for the betterment of software quality and user experience.

    Tags
    Automation Testing Manual Testing Types of Testing

    Featured Articles

    What is Automation Testing: Benefits, Strategy, Tools

    Common Reasons for Automation Tests Failure

    App & Browser Testing Made Easy

    Seamlessly test across 20,000+ real devices with BrowserStack