Unleash your full software testing potential with these best practices to write, specify and organize test cases.
As a tester, organizations depend on you to maintain the highest possible quality for their products. The quality with which you write, specify and organize test cases influences the effectiveness of your testing and can significantly affect the quality of the product.
To maximize the benefits from your tests, write the requirements alongside your business stakeholders, design your tests with a purpose and parameter, and of course, organize them properly so you can easily understand and execute them.
Here are some best practices to help you get the most from your testing strategy:
Engineer foolproof testing
Before you begin testing, make sure the SUT (system under test) is stable and testable so that you don’t lose time retesting. Only when you have a testable SUT will your tests serve their purpose and work properly.
A testable system has these characteristics:
- observability: you can easily see the results of the test cases performed
- automatability: you can implement test automation
- stability & availability: developers communicate any changes to the code so the system remains stable and testable
- simplicity & comprehension: developers follow good coding standards to ensure the system is clear enough for you to understand and build tests
Once you’re certain that the SUT meets this criteria, you can perform successful testing.
Write clear, concise and correct requirements
Effective testing starts with concise and comprehensive business requirements. Your business requirements provide a blueprint for the final outcome of the system. Developers use these requirements to build a product that meets a set of priorities and outcomes.
When you include testing as a part of the whole development life-cycle, your requirements become more clear, understandable and testable. That’s because testers are able to understand the possible risks and failures with certain functions. As a tester, you should review and discuss the requirements with the development team right from the start.
When you do, make sure your requirements meet these key characteristics:
- consistency: use consistent terminology and make sure requirements don’t contradict each other
- complete & concise: write clear and precise descriptions
- correct: make sure the requirements clearly address what business/stakeholders need
- verifiable: confirm that you can easily verify the requirement. One way to do this is to have acceptance criteria as a common practice.
Once you’ve established your requirements, you can build your tests with confidence.
What makes a great test?
High-quality tests help you determine whether the system under test functions properly. A scripted test provides guidelines to test for a predefined outcome. All scripted tests should follow a set of characteristics so they best serve their function and purpose:
- simple & short: make your tests simple so everyone can understand and execute them
- goal oriented: focus on a single output to give clear purpose and meaning to the test itself
- consistent: stay consistent with the terms you use
- reviewed: get clear feedback from others to improve your test cases
- valid: make sure the test results address the purpose of the test according to the acceptance criteria defined for the requirement
- identifiable RCA (root cause analysis): perform an analysis to identify the root cause of the problem not just the problem itself
- maintainable: ensure you update the status when the related requirement changes
- discoverable: you should be able to easily search and find a test using multiple criteria
- fast: execute a test as fast as possible in order to reduce effort. Lengthy tests burden the CI/CD process, especially during test automation.
- parallel: if possible run your tests in parallel to reduce the overall execution time
Best practices for designing tests
Test cases make your testing more efficient because you can re-run the same tests on subsequent builds without rewriting them. Use these guidelines to ensure you write great tests from the start.
Create tests with a purpose
The reason for a Test to exist in the first place should be its purpose/goal. If using Xray, use the Summary and Description fields to define the purpose of the Test.
Create clear and necessary steps
Tests should have the necessary steps to validate their purpose. Create clear, unambiguous steps to avoid different interpretations and thus different results.
Points to keep in mind when you write steps:
- If you have very few steps, you might need to further detail some "implicit"/missing steps.
- If you have many steps, you're probably validating too many things at the same time. Create tailored test cases for each scenario that you want to validate.
Mark the tests so you can easily find/manage them
Ensure smooth collaboration within your team and make your tests easily accessible. If using Xray, use labels or specific custom fields. When you use labels, keep in mind that Jira's default label type of fields are case-sensitive and there’s no way to limit their values. A more restricted custom field type may be more appropriate.
Test specifically in the given environment
Test in a specific environment to make your tests even more accurate. If tests are specific for a given environment, use the Environment Field in Xray to clearly identify that. Whenever scheduling these tests for execution, make sure to use the test environments feature by setting the Test Environments Field on the Test Execution.
Avoid too many dependencies
It’s hard to understand and manage a test that depends on previous tests to be executed first. Try to avoid dependencies in the first place. If really needed, try to isolate them as much as possible through Pre-Conditions.
Test in different configuration scenarios
Test using the same test procedure but in different conditions, such as different combinations of enabled features.
To stay consistent, use this approach:
- create multiple clones of the same test
- assign each test to a specific Pre-Condition, where each one corresponds to a different combination of enabled features
For an alternate approach, use Test Environments and define each one as a specific feature combination. However, this does not scale well if you have several features which would lead to too many Test Environments.
Avoid having only a few tests that validate obvious outcomes
Sometimes testers look at a requirement and write one or two tests that mimic exactly the description of the requirement, without digging further into potential different paths.
- Keep the acceptance criteria in mind and write several test cases for each of them
- Use techniques such as Decision Table Based Testing to improve coverage without requiring lots of testing effort. Decision Tables help you test interactions between combinations of conditions.
Now that you’ve defined your tests, pick the best system to organize them and stay consistent with it.
Best practices for organizing tests
As your test cases increase, you want to organize them properly from the start to get clear traceability to the requirements and maximize the speed with which you execute them. If you’re using Xray for your test management, keep in mind that Xray supports many different project organization scenarios. Organize your tests using either lists (i.e. Test Sets) or folders within the project's Test Repository.
When using Xray for your test management, follow these guidelines to properly organize your tests.
Store tests alongside your other project development related issues
To maximize team collaboration keep your testing related artifacts together with other project related ones, such as requirements/user stories, bugs, tasks, etc. With this approach you have a self-contained project which you can easily manage.
Organize tests properly from the start
Organize your tests properly from the start in order to avoid duplications and disorganization. Tag the tests and identify the reason for the test to exist in the first place. With this process you can:
- Assign labels, component(s) or other fields to your tests
- Link tests to requirements/stories; if you don't have requirements, consider creating them so you can track your testing results from the requirements/features perspective
- Use a specific field to classify the type of test (e.g. integration, UI)
- Use a specific field to classify the nature of the test (i.e. manual, automated)
As with your requirements, maintain consistency when you tag your tests to avoid similar tests tagged in different ways.
You're on your way to great testing!
If you want to bring the most value to your software development process, follow these best practices to specify, execute and organize your tests with confidence.
Create simple and clear requirements and ensure the SUT is testable. Write tests with a clear purpose and break them down as much as possible so that they are simple and easy to execute. Finally, organize your tests in an efficient and easy to understand way so that you can replicate the process.
Want to learn more about how to do excellent software testing? Check out our Tutorials, Tips and Tricks area which has tons of resources to help you unleash your full testing potential.
Xray is the leading quality assurance and test management app for Jira. More than 4.5 million testers, developers and QA managers trust Xray to manage 100+ million test cases each month.