How to write good test cases
Para acceder a post original click aquí
In order to verify that your software works as intended, you’ll obviously need to test it. Test cases contain a list of actions that must be completed in order to properly test a specific function or feature. For many types of testing, whether it’s manual regression or automation, you need that set of instructions. There are a few different approaches you might take to create good test cases, but there are certain standards that it’s always worth considering.
Today, we’re going to look at a few tips to help you write good, effective test cases.
Make it simple and clear
Starting with the naming convention, which should make it easy to understand what the test case is intended to test, you should take your time and ensure that every aspect of the test case is easy to understand. It might need to be followed by a new tester, or form the basis of an automated script later down the line, so clarity is vital. Break everything down into simple chronological steps, so that someone with no knowledge of the project could run the test case.
Consider the end user
You might be working from a requirements document, a user story, or the application itself. In every case you need to keep the end user at the forefront of your mind. How would they expect the software to work? What are they looking for from the function? How would they go about their task? Does it meet expectations?
Think about prerequisites
Every aspect of the environment and the setup is important. Consider the tools to use, the operating system, the hardware, the data, and the flow. You want to model the end user’s behavior and the final live environment that they’ll be using the software in, as closely as possible. In some cases, creating relevant test data will require a whole procedure in itself. Rather than referring to specific test data that might age, list criteria for creating relevant test data. You may also want to list other test cases as prerequisites.
Explain the expected result
Ideally, every step of your test case will have an expected result attached. This makes it easy to verify each step and ensure coverage is complete. It should be clear to anyone working through this test case later what is supposed to happen at every step.
Add supporting material
Screenshots, additional explanations, and even videos can be useful supplements to a test case to help the tester understand exactly what they’re supposed to do and what the expected outcomes are. In many cases it might be best to use a capture tool of some kind while you test. Recording keystrokes and environment details, or even entire exploratory test sessions, breaking out relevant parts and using them as the basis for test cases is a good way to make sure you aren’t forgetting anything.
Think about the future
To get maximum value out of taking the time to write up a test case, it should be reusable. It’s important to take the time to avoid duplicating work. Test cases should call other test cases as prerequisites rather than cover the same ground. Sometimes you’ll be able to reuse test cases from one project on another. You should also schedule in some review and maintenance time to ensure that test cases are updated or retired when required.
The specifics of writing good, thorough test cases may vary from project to project, but these principles are always worth keeping in mind.