From broken links to missing images, there’s no doubt about it: a janky website isn’t good for business.
Each test needs to be documented, but first explained, which is done in the form of a test case.
This article will explain how to write a test case in various common scenarios.
Contents:
- What Is A Test Case
- The 9 Basic Steps Of Writing A Test Case
- Test Case Templates
- Tips For Writing Good Test Cases
- Conclusion
What Is A Test Case?
A test case is a list of instructions for specific actions to ensure the website functions as expected.
Its purpose is to provide direction to software testing engineers to verify that each website component is bug-free.
One website design could require hundreds of test cases. These test cases are grouped and organized in what is considered the test suite as part of the overall test plan.
Typically, designers can create test cases. But if the test case design is complex, testing engineers may also be involved in test case writing.
Functional testing has three different types of test cases, and their differences concern input versus outcome.
Positive Test Case
A positive test case is when the inputs produce a positive outcome.
For example, when testing login functionality, a positive test case would result in the arrival of the welcome page when clicking on the login button and entering the correct credentials.
Negative Test Case
In a negative test case, the purpose is to test the results of a negative outcome.
For the same example, a negative test case would involve the user experience clicking on the login button and entering the wrong credentials.
This negative test case will be successful if the wrong credentials result in a notification that the password was entered incorrectly.
Destructive Test Case
Destructive test cases are meant to test how much load a webpage can handle.
Destructive tests may include applying a heavier load than normal, fast-clicking, or implying malicious intent.
The 9 Basic Steps Of Writing A Test Case
There are nine basic steps to writing a complete test case. With these elements in place, test execution should always be possible from the written test case.
1. Test Case ID
A unique ID should be created for each test case.
These IDs should follow a numerical or alphabetical pattern for less confusion in identifying individual cases.
2. Test Description
The test description outlines what is being tested and how that will be verified.
A common sentence structure for the test description is as follows:
“Verify ‘function’ by ‘action’ with ‘another action.’”
i.e., verify authentication by using a correct password in Gmail.
3. Preconditions
Preconditions (or prerequisites) are conditions that need to be met before testing can begin.
Without these in place, test coverage will be invalid.
4. Test Data
Test data is any input or data necessary to perform the test. These could include the login and password, test script, or exact URL.
5. Steps To Be Executed
These steps from the end user’s perspective will need to be followed to verify the end goal.
They must be written clearly and concisely for the testing team to understand. Using a traceability matrix can ensure that every condition and function is tested.
6. Expected Results
The expected result is what should happen with a bug-free website if all the steps in the test case are followed.
7. Postconditions
A postcondition is something that should happen as a result of a successful test outcome.
For example, if your expected result of inputting your username and password into the login page is to gain admittance to the home page, a postcondition is to have the home page load.
8. Actual Result
Did the test case result in the expected results?
If not, what was the result?
This is the actual result, which may or may not differ from the expected results.
9. Pass/Fail
If the expected results were met, the test passed. If not, it failed.
What if a test fails?
Time for a bug report!
The bug lifecycle will need to be followed and corrected. Then regression testing must be conducted.
Read more: Bug Reporting: What Is A Bug Report And How To Create Good Bug Reports
Test Case Templates
Would you like to see some test case examples?
Take a look at some of these templates using test case management tools and programs to see how you can structure your next test case.
Google Sheets
By using Google Sheets, you’ll have a dynamic hub for a test case.
The key advantage here is that if you have multiple people working on this project, you can give them edit access too to make changes or add their own notes.
Check out the template made by BugHerd just for you!
Microsoft Excel
Using an excel spreadsheet is old school but still viable for standard test cases.
You can fill the spreadsheet horizontally or vertically to fit the format that best suits your preferences.
You can see an example of a horizontal spreadsheet test case here.
There are several more downloadable excel spreadsheets for test cases here.
Jira
There are no set presets for test cases in Jira, but you can use the “issue type” feature and customize it for test cases.
To complete the test case, add subtasks that correlate to the nine steps for test cases.
Or, use Zapier to connect your BugHerd bugs to Jira.
Read more: Combine BugHerd With Jira For The Ultimate Bug Tracking Tool
Trello
You can use Trello as a management tool by following the test steps laid out below:
- Create a workspace.
- Create a board.
- Make your board workspace visible to allow testers to use the board.
- Change the list names for each website or software application you are testing.
- Create cards for each function you write a test case for.
- Assign these cards a test ID and description, and attach the test data.
- Add a checklist to the card as the steps to follow.
- You can create different checklists for positive, negative, and destructive test cases.
- Testers can check off the steps as they go.
Or, like with Jira, you can connect BugHerd to Trello using Zapier.
monday.com
monday.com is another great task management tool that can be used to create test cases. They have the process outlined on their blog here, along with a free template to use.
You can also connect BugHerd to monday.com to make test case creation super convenient.
Tips For Writing Good Test Cases
Well-written test cases can make the testing process more efficient and accurate.
Here are some tips to follow when writing test cases:
Use Testing Techniques
There are several different testing techniques available to use. Of course, you can’t expect to use every technique in your testing process.
However, selecting the technique that will provide the greatest possibility of detecting bugs is best.
The testing of one website may employ several different testing techniques in its testing execution.
Some of the most popular testing techniques include:
Equivalence Partitioning
With this technique, you divide the test cases into groups. These groups should all work under one condition.
Then if one test case works under that condition, all in the group should also work.
State Transition Testing
This technique is used when previous actions may dictate the transition from one input to the next.
Boundary Value Analysis
With boundary value analysis (BVA), a specific range of values is used to test the website function.
For example, for a website about beer, you would want to test a prompt asking for the user’s age.
The minimum acceptable value for admittance to the site is 21. BVA would be the correct testing technique to put in place for this function.
Error Guessing Technique
Error guessing doesn’t follow any rules, but instead uses the tester’s prior experience with the website to test scenarios at random.
What kind of random situations would a software tester think of testing?
How about entering alphabetical values into a numerical field, or submitting an email signup form without entering a valid email address?
Implementing this technique may require creativity, but it certainly aids in ensuring complete test coverage.
Decision Table Technique
The decision table technique follows the cause-and-effect pattern for functions with relationships between inputs.
To use this technique, testers would create a table with conditions or actions followed by columns for each test case. After testing the conditions, testers would mark the columns accordingly.
Keep End-User Perspective
The user is who you are testing for, so it only makes sense to write test cases with the end user in mind.
Whether testing for functionality or compatibility, user experience is always key to ensuring your website is well-designed. Go through all your test cases and consider the practical value they provide to the end user.
Use Clear And Concise Language Throughout
Effective test cases cannot be vague in any manner. Clear and concise language must be used throughout the test case.
This includes the test description and expectations. It is especially important when writing out the steps to follow.
Test cases need to be written without assuming testers have background knowledge. Even new testers should be able to execute the test from the steps in the test case.
Make Sure It Is Reusable
When any updates are done on your website or any of the coding is changed, the testing process will need to be repeated.
For that reason, it is always a good idea to make your test cases reusable.
Always keep a master copy and then make a duplicate for use to perform the test.
That way, you can simply make another duplicate for your next update or even use it for a new website project in the future.
Also, remember that test cases will need many revisions and updates, as website requirements are always changing.
Get Peer Review
Before issuing a test case, allow others to read it. They may catch things you missed or offer some advice on clarity or word usage.
Getting a peer to review your test case is one of the best forms of quality assurance.
Make Sure They’re Self-Cleaning
While conducting the test cases, no permanent change should be made to the test environment. Testers should be able to return to the pre-test state after completing the test.
Stick To Specification Documents
When writing test cases, do not assume any functions of the website. Instead, use the specification documents to dictate the parameters of your test case.
Conclusion
The role of testing in website design cannot be overemphasized. If a company rolls out a website with insufficient testing, the results could be catastrophic for their consumer relations.
Good test cases are to ensure your website is bug-free and works as the user expects.
BugHerd’s bug tracking tool can simplify testing execution by integrating with just about any test management tool out there and enabling a point-and-click process that is far simpler than any other method.
Try it out for free with our 14-day trial.