A test case is exactly what it sounds like: a test scenario measuring functionality across a set of actions or conditions to verify the expected result. They apply to any software application, can use manual testing or an automated test, and can make use of test case management tools.
Most digital-first business leaders know the value of software testing. Some value high-quality software more than others and might demand more test coverage to ultimately satisfy customers. So, how do they achieve that goal?
They test more, and test more efficiently. That means writing test cases that cover a broad spectrum of software functionality. It also means writing test cases clearly and efficiently, as a poor test can prove more damaging than helpful.
A key thing to remember when it comes to writing test cases is that they are intended to test a basic variable or task such as whether or not a discount code applies to the right product on an e-commerce web page. This allows a software tester more flexibility in how to test code and features.
In Nathan Barrett’s Lightning Talk session, we will be breaking down the following topics:
- What Is A Test Case?
- What Makes A Good Test Case?
- Live Demonstration
- Closing Thoughts
What Is A Test Case?
At a high level, to “test” means to establish the quality, performance, or reliability of a software application. A test case is a repeatable series of specific actions designed to either verify success or provoke failure in a given product, system, or process.
A test case gives detailed information about testing strategy, testing process, preconditions, and expected output. These are executed during the testing process to check whether the software application is performing the task for which it was developed for or not. A passed test case functions like a receipt verifying the correct functionality of the subject of the test.
To write the test case, we must have the requirements to derive the inputs, and the test scenarios must be written so that we do not miss out on any features for testing. Then we should have the test case template to maintain the uniformity, or every test engineer follows the same approach to prepare the test document.
Test cases serve as final verification of functionality before releasing it to the direct product users.
What Makes A Good Test Case?
Writing test cases varies depending on what the test case is measuring or testing. This is also a situation where sharing test assets across dev and test teams can accelerate software testing. But it all starts with knowing how to write a test case effectively and efficiently.
Test cases have a few integral parts that should always be present in fields, as well as some “nice to have” elements that can only work to enhance presented results.
- Concise, direct encapsulation of the purpose of the test case
- What needs to be in place prior to starting the test?
- Bad Prerequisites: captured in test steps, not present, overly specific
- Good Prerequisites: concise/descriptive, lays out all set-up prior to testing, includes information to learn more if desired
- Test Steps
- The meat of the test case
- Good test steps: each step is a specific atomic action performed by the user that contains an expected result, call out divergent paths where necessary, cites which test data when laid out in prerequisites needs to be applied
- Really great test steps should treat the user like they know “nothing” and communicate everything from start to finish
- Expected Results
- How do we know that the test hasn’t failed?
- Bad Expected Results: Page loads correctly, view looks good, app behaves as expected
- Good Expected Results: Landing page loads after spinner with user’s account details present, view renders with all appropriate configurations (title, subtitle, description, etc.), toggle changes state when tapped (enabled→disabled)
Preferred Additional Elements:
- Screenshots, files, builds, configurations, etc.
- Test Data
- Accounts, items, addresses, etc.
- What information is needed during the test?
- Pre-rendered prerequisite fulfillment
- Historical Context
- Previous failures, previous user journeys, development history, etc.
- Has this feature been “flakey” in the past?
- What are previous failure points?
- How critical is this feature?
The very practice of writing test cases helps prepare the testing team by ensuring good test coverage across the application, but writing test cases has an even broader impact on quality assurance and user experience.
Nathan Barrett has crafted an intuitive test of specificity to help guide testers to understand how they should be structuring their cases:
All programs should always be designed with performance and the user experience in mind. The properties explored above are the primary stepping stones to understanding the beneficial prerequisites to writing a good test case for any type of application. Be sure to explore, have fun, and match up the components that work best for your project!
To learn more about How To Conduct A Great Test Case as well as its importance in the software development process and to experience Nathan Barrett’s full Lightning Talk session, watch here.