Sanity Testing - Notes By ShariqSP
Sanity Testing
What is Sanity Testing?
Sanity testing is a subset of regression testing performed to verify that specific functionalities or bug fixes work as expected. It is a quick, focused test conducted after minor changes or bug fixes in the software, ensuring that those changes do not disrupt the core functionality. Unlike a full regression test, sanity testing is not exhaustive and targets only the affected areas to save time.
Purpose of Sanity Testing
The primary purpose of sanity testing is to validate that recent code changes or bug fixes are working as intended and that no further defects have been introduced in the related functionalities. Sanity testing helps determine if the application is stable enough to undergo more rigorous testing, such as regression testing.
Characteristics of Sanity Testing
- Quick and Targeted: Sanity testing is quick and limited in scope, focusing only on the specific areas where changes were made.
- Not Thorough: It does not involve detailed testing of the entire application. Only the most important functionalities related to the recent changes are tested.
- Subset of Regression Testing: Sanity testing is a narrower, faster type of regression testing, aimed specifically at verifying recent changes.
- Performed Manually: Typically, sanity tests are performed manually to ensure the fixed areas are operating correctly.
- Done at a Later Stage: Sanity testing is often performed after a new build or version is received, ensuring that the main functionalities are intact before proceeding with more detailed testing.
When to Perform Sanity Testing
Sanity testing is generally conducted after minor updates, patches, or bug fixes have been made in the application. It is particularly useful when:
- A critical bug has been fixed, and the QA team needs to confirm that the bug is resolved without performing full testing.
- A new feature or function has been added to an existing system, and it is essential to validate that the new code does not break related functions.
- Small changes are made, and it is necessary to quickly verify the stability of the affected modules without testing the entire application.
Steps Involved in Sanity Testing
- Identify the Scope: Based on the recent changes, define which functionalities or modules need to be verified.
- Verify Critical Functions: Conduct a focused test on key functions directly impacted by the change to ensure they operate correctly.
- Check for Related Impacts: Assess if the recent change has affected any related features or modules. This may involve testing interactions between modules to ensure stability.
- Log Results: Document findings and results from the sanity test. If issues are detected, log the defects for further investigation.
- Decide Next Steps: If sanity testing passes, proceed with more extensive testing or regression testing. If it fails, report the issues immediately to the development team for further fixes.
Example of Sanity Testing
Consider an ecommerce application where a bug fix was implemented to resolve an issue in the checkout process. After the fix, a sanity test would be performed to quickly verify that:
- The checkout function now works as expected.
- The payment gateway integration functions without errors.
- Other essential processes, like adding items to the cart, remain unaffected by the bug fix.
If these tests pass, the application is considered stable enough for further, more detailed testing.
Advantages of Sanity Testing
- Time-Saving: Sanity testing allows for quick verification of recent changes without requiring a full test cycle, saving time for the QA team.
- Focus on Critical Functions: By targeting only the affected areas, sanity testing ensures that critical functions are operating correctly after a change.
- Cost-Effective: Sanity testing helps identify defects early in the process, preventing additional costs associated with missed issues in later stages.
Difference Between Sanity Testing and Smoke Testing
- Sanity Testing: Performed on specific functions or modules after a minor change or bug fix to ensure the stability of the recent update.
- Smoke Testing: A preliminary test of major functions in a new build to determine whether the application is stable enough for further testing.