What is Sanity Testing with Examples
September 24, 2024
In today’s digital era, delivering high-quality software with a great end-user experience is crucial for business success, making efficient testing a vital step before release. The Software Development Life Cycle (SDLC) includes various testing types, broadly categorized into functional and non-functional testing. Functional testing ensures software functionality through methods like unit testing, integration testing, system testing, smoke testing, and sanity testing.
Sanity testing, in particular, plays a key role early in the SDLC by quickly validating the stability of a software build, allowing teams to address functional issues before deeper testing, ultimately improving software quality and saving time.
- What is Sanity Testing?
- Attributes of Sanity Testing
- Features of Sanity Testing
- Objectives of Sanity Testing
- Process of Sanity Testing
- When should Sanity Testing be conducted?
- Sanity vs Smoke: Differences
- Sanity Testing Example
- Benefits of Sanity Testing
- Disadvantages of Sanity Testing
- Test on Real Devices for Accurate Results
- Benefits of using BrowserStack Live for Sanity Testing
What is Sanity Testing?
Sanity Testing is a type of software testing performed after smoke testing to verify that minor changes or bug fixes haven’t introduced new defects. Its purpose is to ensure the core functionality remains intact before proceeding with more extensive testing.
Sanity Testing or Surface Level testing is a type of testing which is performed on the stable build of the software. It is a quick and basic test (or set of tests) to ensure that the code changes made are working properly without any bugs. It is a subset of Regression testing and is usually executed after the software product has passed the Smoke test.
Attributes of Sanity Testing
To understand the fundamentals of sanity testing, it’s essential to recognize its key attributes and components. Here are some crucial aspects of sanity testing:
- Narrow and Deep Focus: Sanity testing is characterized by its targeted approach, concentrating on specific components to ensure their proper functioning after changes.
- Subset of Regression Testing: It acts as a subset of regression testing, primarily focusing on less critical parts of the application. Sanity testing verifies whether new features align with the requirements.
- Unscripted: Typically, sanity testing is conducted in an unscripted manner, allowing testers to explore functionalities without predefined test cases.
- Not Documented: This type of testing is often informal and may not be documented, emphasizing its quick and adaptive nature.
- Conducted by Test Engineers: Sanity testing is performed by test engineers who assess the software’s stability and readiness for further testing.
Features of Sanity Testing
Some features of Sanity testing include,
- Simple: Easily designed and performed.
- Unscripted: It is not scripted most of the time.
- Undocumented: Usually, it is not documented.
- Deep testing: Limited functionalities are covered deeply.
- Subset of Regression testing: Focusses on a smaller section of the application/software at a time.
- Performed by testers: Testers are the ones who do the Sanity testing.
- Comprehensive: Covers the basic assessment of how software behaves.
Objectives of Sanity Testing
The main objectives of Sanity testing are:
- Defining the planned features works as expected.
- Saving time, complexity, and costs in case the sanity test fails for a build.
- Ensuring that the new updates don’t change the software’s existing functionalities.
- Validating the accuracy of the newly added components and features.
Read More: How to test UI components?
Process of Sanity Testing
The Sanity testing process has the following steps:
- Identification
In this step, newly added features and components are detected. Also, the modification presented in the code is detected while bug fixing.
- Evaluation
These newly implemented components and attributes are analyzed and modified to check whether they work as intended as per the given requirements.
- Testing
A smaller section of the newly linked components is tested deeply. The test will fail if these newly introduced components do not fulfill their requirements. If it meets the need, the Sanity test is passed. Next, System testing is performed thoroughly to ensure that these functionalities do not interfere with the previously installed system and application components.
When should Sanity Testing be conducted?
Sanity Test should be performed in the following cases:
- If there is a minor change in the code.
- When the build is received after a number of regressions.
- After bug fixes.
- Before production deployment.
Sanity vs Smoke: Differences
Sanity testing and smoke testing are key software testing methods. Smoke testing checks a new build’s overall stability and critical functionality, while sanity testing verifies specific features after changes to ensure they work correctly. Smoke testing has a broader scope, whereas sanity testing is focused and targeted.
Feature | Sanity Testing | Smoke Testing |
---|---|---|
Purpose | To verify that specific functionalities work correctly after changes or bug fixes. | To ensure that the overall build is stable enough for further testing. |
Focus | Targets specific components or features that have been modified. | Checks the basic functionality of the entire application. |
Execution | Conducted without predefined test cases, often informally. | Can be executed manually or automated, typically with a set of predefined test cases. |
Scope | Narrow scope, focusing only on areas impacted by recent changes. | Broad scope, encompassing the application’s core functionalities. |
Stability Requirement | The software must be relatively stable for testing. | The software can be stable or unstable; it serves as an initial check. |
Documentation | No formal documentation or test scripts are typically created. | Test documents and scripts are often generated for future reference. |
Testing Phase | Usually conducted after smoke testing to validate specific fixes. | Performed after each new build to verify overall stability. |
Type of Testing | Subset of regression testing. | Subset of acceptance testing. |
Sanity Testing Example
Consider you developing an online Food ordering app, and you want to offer a 10% discount on New Year (1st January) for your members having an elite membership.
Sanity testing will verify the following:
- Elite members get the discount on the 1st January.
- Members, who add the elite membership to their food orders on the 1st, also get the discount.
- Non-elite members do not get the discount on the 1st January .
- No member receives that rebate before and after the 1st January.
- Other discount coupons can not be clubbed together with this 10% discount.
- Elite members, who opt for other deals, do not get the New Year deduction.
Sanity testing does not verify other areas of the app, like delivery tracking or restaurant reviews. That is done by Smoke testing and Regression testing, which happen before and after Sanity testing.
If Sanity testing fails, the app is sent back to the developer for troubleshooting. However, if it succeeds, the app is sent for thorough System testing.
Benefits of Sanity Testing
Sanity testing offers several advantages that enhance the efficiency and effectiveness of the software testing process:
- Rapid Problem Detection: It helps in quickly identifying defects in the core functionality of the software, ensuring that critical issues are addressed early.
- Time Efficiency: Sanity testing can be completed in a shorter time frame since it typically does not require extensive documentation or formal test cases.
- Cost-Effective: Compared to other testing methods, sanity testing is less expensive and resource-intensive, making it a budget-friendly option for evaluating new builds.
- Early Rejection of Faulty Builds: If significant defects are found during sanity testing, the project can be rejected early, saving time and effort that would otherwise be spent on regression testing.
- Identification of Missing Dependencies: It assists in spotting missing objects or dependencies that may affect the application’s functionality, reducing the risk of issues in later testing phases.
- Focused Verification: Sanity testing verifies specific functionalities to ensure they work as expected after changes, allowing teams to concentrate on the most critical areas of the application.
- Quick Feedback Loop: This testing method provides immediate feedback on the software build’s overall functionality, enabling teams to swiftly address any critical issues.
- Increased Confidence: By confirming that essential functions are operational before proceeding to more extensive testing, sanity testing boosts confidence in the software’s quality.
- Improved Productivity: Sanity testing allows developers and testers to focus on more complex testing scenarios by validating critical functionalities early, thus enhancing overall productivity.
- Effective in Time-Constrained Scenarios: In situations where testing time is limited, sanity testing helps ensure that the most important functionalities are operational without requiring extensive testing efforts.
- Risk Mitigation: Early detection of issues through sanity testing helps mitigate risks associated with software releases, contributing to a smoother deployment process.
- Supports Agile Practices: Sanity testing aligns well with agile methodologies, facilitating quick iterations and continuous integration by providing timely validation of changes.
Disadvantages of Sanity Testing
Some of the limitations of Sanity Testing are:
- It covers only a few functionalities of the application. Issues in the unchecked functionalities can’t be recovered.
- It only focuses on the functions of the software.
- Since it is usually unscripted, future references are not available.
- It doesn’t cover the design structure level, and hence, it will be difficult for the development team to identify and fix the issues.
Test on Real Devices for Accurate Results
Sanity testing is essential for determining whether further testing is necessary for a software application, helping to save time and effort by quickly identifying critical issues. It provides immediate feedback on the release status, enabling teams to plan subsequent actions efficiently. To achieve accurate results, it’s important to test on real devices and browsers, as this simulates actual user conditions and effectively uncovers bugs. BrowserStack Live facilitates rapid sanity testing for web applications.
Benefits of using BrowserStack Live for Sanity Testing
Here are the core benefits of using BrowserStack to perform Sanity Testing:
- Extensive Device Coverage: Access over 3500+ real device-browser combinations to ensure comprehensive compatibility across various platforms.
- Real-World Testing: Simulate actual user environments to identify potential issues and verify that critical functionalities perform as expected.
- Rapid Testing Experience: Eliminate the need for physical devices, enabling quick assessments of your software’s functionality and stability.
- Immediate Feedback: Receive quick updates on the status of your application, allowing for efficient planning of subsequent testing actions.
- Mobile App Testing: Conduct thorough sanity tests on real iOS and Android devices with BrowserStack App Live, ensuring new features and bug fixes function correctly.
- Streamlined Process: Optimize your testing workflow, saving time and effort while enhancing the quality of your software.
By leveraging BrowserStack Live, you can ensure your software performs optimally in real-world scenarios, leading to a better user experience.
Conclusion
Sanity testing focuses on determining whether more testing is necessary for a software application. It is crucial because it saves a lot of time and effort when any issue in the system is discovered. Sanity tests also give a quick update on the progress of the release so that the next set of actions can be planned accordingly.
However, it is important to test on real devices and browsers, taking real user conditions into account for more accurate test results. This will help in identifying how the app function in real-world conditions, especially in finding bugs. BrowserStack Live helps in performing a quick Sanity test for web apps on 3500+ real device-browser combinations. While BrowserStack App Live allows you to perform Sanity testing on mobile apps across real devices on iOS and Android platforms.