Sanity testing is a subset of regression testing. The goal is to validate the functionality of specific features within the software, even after minor code changes.
This type of software testing is usually performed after smoke testing, which entails running a basic set of tests to identify apparent application issues.
👀 As you can see, there is a clear relationship between sanity, smoke, and regression tests. However, there are fundamental differences between them. It is clear that they differ from each other. Let’s look at these differences further with comparison table.
Sanity Tests | Regression Tests | Smoke Tests | |
Purpose | Verifying critical functionalities after minor changes | Comprehensive validation of the application’s correctness after code changes | Quick check basic functionality after a software build |
Focus | Specific components of the software product that were modified | All program functions potentially impacted by modifications | Core functionality of the application |
Who Performs It | Test engineers | QA team, sometimes used automation tools | In most cases, the development team |
When It Is Performed | After conducting smoke tests | After any changes to the source code (bug fixes, addition of new functionality, etc.) | After each new build |
Scope | Small set of test cases | Large volume, covering numerous test cases | Limited set of test cases |
Type of Testing | Subset of regression testing | Independent QA process | Subset of acceptance testing |
At the same time, each of them plays an important role in the software development life cycle. Now, we focus on the topic of our material and discuss the key features of the sanity testing process.
Key Characteristics of the Sanity Testing Process
In order for such checks to yield the expected results, it is essential to understand the key aspects of this process.
✅ Targeted and In-Depth Approach
The scope of sanity testing is focused on evaluating specific components of the digital product to confirm their correct functionality after changes to the source code, such as bug fixes. Simultaneously, it involves thorough testing of each element that has been modified.
✅ A Subtype of Regression Testing
Confidence tests are considered a subtype of regression testing. Indeed, these quality assurance processes aim to verify the correctness of the product’s functioning after changes are made. However, quick checks have a narrower focus, while regression tests involve extensive testing of the entire system.
✅ “Scriptless” Testing Approach
This QA process does not depend on predefined test cases, giving testers the flexibility to apply their expertise. They can concentrate on testing the modified functionality rather than following a fixed script.
✅ No Documentation Requirements
Sanity test execution is characterized by speed, adaptability, and informality. This includes the absence of any requirements for documenting test results. Most often, such records are not maintained on the project.
✅ Need for Technical Knowledge
Sanity tests should be conducted by QA test engineers, as achieving success requires a clear understanding of the key functionality of the application and the nuances of the testing process.
What Are the Benefits of Sanity Testing Checks?
Due to the features we discussed in the previous section, coherence checks play an important role in the software development process. They help teams create high-quality software products. Here are the benefits of implementing them in projects:
- High Speed of Defect Detection. Sanity tests are quick checks that are carried out in a short period and without a series of additional requirements, such as documentation. This allows for the timely resolution of critical issues.
- Budget Savings. Sanity testing demands significantly fewer technical and human resources compared to more intricate processes. As a result, the costs of a sanity check will be lower than, for example, running regression tests.
- Reduced Need for Regression Testing. Sanity tests allow for the rapid identification of major issues, enabling the rejection of a software build without the need for further testing. Thus, the demand for more resource-intensive QA processes will be reduced.
- Immediate Feedback. Such checks provide quick insights into specific functionalities of the product. This maintains the continuity of workflows. Testers quickly inform developers of any issues found in the software application, allowing them to resolve them promptly.
- Enhanced User Experience. Regular sanity testing checks that users enjoy an improved experience with the digital solution. These checks guarantee that all critical functions operate seamlessly.
- Alignment with Agile Development Methodology. As Agile methodologies become more widely adopted globally, it’s crucial to recognize that confidence tests align perfectly with these principles. By enabling timely software quality checks, they contribute to consistent iterations and continuous integration.
- Minimal Requirements to Start the QA Process. Conducting a sanity testing process requires only a basic setup. No additional complicated environment configurations are needed.
- Clear Pass/Fail Criteria. By running sanity checks on basic functions, testers clearly understand when sanity testing fails. This removes the chance of misinterpreting results.
We have covered the benefits QA teams get from conducting confidence tests, but it’s equally important to consider the limitations for a more complete understanding of the testing process.
Disadvantages of Sanity Software Testing
If you believe this type of testing is a catch-all solution for major issues, let us clarify — it’s not quite that straightforward. Sanity testing has certain drawbacks, which, while not critical, should be considered.
- Narrow focus. With sanity tests, you can check a specific function of the software program. Issues with related functionalities that remain untested may go undetected.
- High probability of false positives. The rapid pace of conducting a coherence check often leads to false positives. In other words, the test result may suggest that a function is working properly, even though it actually isn’t.
- Reliance on the tester’s level of expertise. Sanity test execution requires from test engineer extensive experience and deep knowledge in the area of functionality of the application and QA.
- Limited purpose of sanity testing. Tests of this type are most often viewed as a preliminary stage before further testing, such as before launching regression tests. The reason for this is that they do not provide a comprehensive understanding of the system’s design structure level. 💡 Sanity tests only cover individual components.
To avoid the negative impact of these limitations, it is important to properly choose situations in which such quick checks are appropriate.
When & How Frequently Should Sanity Tests Be Conducted?
After analyzing everything mentioned above, we’ve compiled a list of situations in which quick checks should be applied, meaning more exhaustive testing is not necessary.
Such situations include:
→ Minor changes in the software’s source code.
→ Newly added features in the digital solution.
→ A new build is created for the project.
→ The development team fixes a previously identified defect.
The frequency of such tests depends on the development speed and other project characteristics. It is important to note that sanity tests are typically performed in the early stages of the SDLC (Software Development Life Cycle). As the project advances and the product stabilizes, the necessity for this type of testing diminishes over time.
Practical Example of a Sanity Check
To demonstrate how a sanity check is conducted, let’s look at the development process of a typical web application, like one used for scheduling a doctor’s appointment online. One feature of this App is the Login page, where a password must be entered to access the user profile page. An issue arises on this Login page:
- The password field allows a maximum of 5 characters.
- One of the password requirements is that it should be more than 7 characters.
— 🤔 How is the check carried out in this instance?
Stage #1: The tester identifies the defect and notifies the developers of the issue.
Stage #2: The development team resolves the error and returns the product to the test engineers for re-evaluation.
Stage #3: If the test passes, the build is considered compliant with the requirements. If the sanity test fails, the build obviously is rejected. As a result, the team will have a working login function for the user’s account in the application till implement it successfully.
We would like to highlight an essential requirement that must be fulfilled when conducting tests of sanity testing type. This concerns the necessity to select the right scope of tests. A few words on how to do this:
- Focus on the high-priority functions of the digital solution.
- Consider recent modifications to the codebase, including new features, bug fixes, or updates to third-party services that the system depends on.
- Focus the testing on the core workflows that users will interact with, such as logging in, adding products to the shopping cart, or processing online payments (for an e-commerce platform).
- Give preference to positive test scenarios — boundary cases and negative test cases are usually tested during regression testing.
- Use test automation where possible — this will be discussed further.
Automation VS Manual Sanity Testing
As reported by Precedence Research, the global QA automation market exceeded $30 billion in 2023, with projections suggesting it will near $150 billion by 2033.
Of course, there are QA activities that cannot be automated. Sanity checks, however, are an exception and can be performed either manually or with the help of advanced automation tools.
Automated sanity testing allows you to quickly confirm that recent code changes haven’t disrupted existing functionality, ensuring ongoing stability throughout the development process. This keeps your project on track and minimizes disruptions.
Mykhailo Poliarush
CEO Testomat.io
In the manual approach, the QA process can be overly resource-intensive and susceptible to errors due to human factors. However, automating it can provide the team with several benefits:
- Increased software quality verification speed. Automation allows sanity tests to be performed much faster than by a human. Additionally, many tools support parallel test execution. As a result, feedback is obtained faster, and errors are fixed more quickly.
- Optimization of the software development process. Advanced tools can be seamlessly integrated into the CI\CD pipeline, accelerating the QA process and shortening the overall SDLC.
- Resource optimization for more complex tasks. Automating sanity tests allows you to concentrate on manually testing other, more intricate scenarios that necessitate human involvement. Teams can utilize a range of tools for this purpose, such as Selenium, Cypress, and Playwright.
Common Challenges
While performing this type of testing, teams may encounter some challenges:
Insufficient test coverage. This type of testing is used for quick checks. It covers only critical functionality, and less obvious problems may go unnoticed.
- Time constraints. Due to the need for quick results, testers may not have enough time for thorough testing.
- The need for frequent test updates. If the development team frequently makes changes to the software, updating the sanity tests may become an ongoing task, distracting testers from other responsibilities.
- High likelihood of human error. If testing is performed manually, there is a high chance of errors due to human factors.
- Difficulty automating such tests. Automation is a good practice for this type of testing. However, it can become challenging if the digital solution is frequently updated, requiring regular test updates.
Despite all these potential issues, it is important not to overlook this type of testing to ensure the reliability and high quality of the software. We hope this guide will help you implement best practices for sanity testing in your project.
Sanity Testing in the Agile and CI\CD Pipeline
Since Agile methodologies and CI\CD aim for frequent releases, quick sanity checks align perfectly with their needs. These tests serve as a starting point for verifying the quality and stability of the digital solution before moving on to more comprehensive testing.
The following are the main benefits that sanity checks offer to Agile teams:
- Quick verification of basic functionality. It can be performed after every iteration or sprint.
- Verification of the stability of each new build, reducing the time needed for more in-depth testing of unstable software versions.
- Improved collaboration within the project. Agile workflows involve regular meetings and effective teamwork. Joint creation of sanity tests fosters better communication between testers and developers.
In addition to aligning with Agile development principles, sanity checks can become a part of an automated CI\CD pipeline. This brings its own benefits:
- Test automation. To be run within the CI\CD pipeline, sanity tests must be automated. This makes them faster and allows them to be executed after each build to confirm its stability.
- Early problem detection. If early defects are identified, the pipeline is stopped, and developers are notified to address them. This prevents bugs from spreading to later stages of the SDLC — such as intermediate builds or production.
- Quality assurance after minimal changes. Due to the high speed of automated sanity checks, they can be run after every change. This ensures that key functionalities of the digital solution always work correctly.
Sanity testing is an essential component of Agile development and CI\CD pipelines. It provides a quick and targeted check of basic functionality. It allows the team to ensure that the system will operate correctly even after the smallest changes to the codebase.
Summary
If new functionality has been added to a digital solution, a bug has been fixed, or changes have been made to the code for any other reason, you should consider running a sanity check. Sanity testing focuses on verifying that a specific feature of the application is functioning properly. It also provides quick test results and allows for rapid defect resolution.
Based on your project’s needs, you can choose between automated or manual sanity testing. The latter accelerates the QA process, enhancing its accuracy and efficiency.
👉 Looking to automate your sanity checks?
— Contact the experts at contact@testomat.io With our in-depth knowledge of quality assurance and test management, we’ll be your reliable partner in automation.