Software Testing - Sanity Testing

Sanity testing is a focused and quick testing process conducted after receiving a new build or code update to verify that specific functionalities or bug fixes are working as expected. It ensures that recent changes have not adversely affected the related parts of the application.

Unlike smoke testing, which checks the overall stability of a build, sanity testing concentrates on verifying the correctness of specific features or functionalities after small modifications. It is usually performed after receiving a build that has undergone minor changes or bug fixes, not a major release.


Purpose of Sanity Testing

  1. Verify Targeted Fixes: Ensures that reported bugs or recently modified features are working correctly.

  2. Confirm Impact Areas: Checks that related modules or functionalities remain unaffected.

  3. Save Time: Provides quick validation without performing extensive regression or full system tests.

  4. Ensure Build Readiness: Confirms that the build is stable enough for further testing if needed.

  5. Maintain Quality After Updates: Detects whether minor updates have introduced any unexpected issues.


When Sanity Testing Is Performed
Sanity testing is performed after receiving a new build that includes small changes, such as bug fixes, UI updates, or configuration changes. It takes place after smoke testing and before regression or system testing.

For example:

  • After a bug fix in the login functionality, sanity testing verifies that users can now log in successfully and that password validation still works properly.


Characteristics of Sanity Testing

  • Narrow and Deep: Focuses only on the affected areas or modules, not the entire system.

  • Quick Execution: Performed rapidly to validate fixes and confirm stability.

  • Unscripted: Often done without formal test cases — testers rely on experience and understanding of the issue.

  • Performed Manually: Usually manual because of its targeted nature.

  • Build Acceptance Step: Determines whether further, more detailed testing is required.


Sanity Testing Process

  1. Receive the Build: The QA team receives a new build that includes specific bug fixes or minor enhancements.

  2. Identify Affected Areas: Determine which functionalities were changed or fixed.

  3. Execute Focused Tests: Run quick, targeted tests on the modified areas and their related features.

  4. Evaluate Results: Verify whether the issues are resolved and if any new issues have emerged.

  5. Approve or Reject Build: If the fixes work and the system remains stable, the build proceeds to more comprehensive testing.


Example in Real Terms
Consider a social media application where users reported that the “Like” button on posts was not working. After developers fix this issue, the QA team performs sanity testing to check:

  • Whether the “Like” button now works properly.

  • Whether the number of likes updates correctly.

  • Whether related functionalities (e.g., unliking or commenting) are unaffected.

If everything works as expected, the build passes sanity testing and can move to regression testing or full QA validation.


Difference Between Sanity Testing and Smoke Testing

Aspect Smoke Testing Sanity Testing
Purpose Checks overall build stability after a new release. Verifies specific functionality or bug fixes.
Scope Broad and shallow. Narrow and deep.
Timing Done after new build deployment. Done after minor code changes or fixes.
Test Type Build verification test. Focused functionality test.
Documentation Usually scripted or automated. Often unscripted or ad-hoc.
Execution Time Short (covers all modules). Very short (covers only modified areas).

Best Practices for Sanity Testing

  1. Focus on Critical Fixes: Test only the functionalities directly affected by code changes.

  2. Keep Tests Simple: Use concise and relevant test cases for quick execution.

  3. Perform Manually: Manual testing allows testers to apply judgment based on experience.

  4. Test Related Features: Check dependent modules that might have been indirectly impacted.

  5. Document Results Clearly: Record which areas were tested and whether fixes were successful.

  6. Avoid Full Regression: Save time by focusing only on modified parts of the system.


Benefits of Sanity Testing

  • Provides rapid verification of bug fixes and enhancements.

  • Ensures system stability after small updates.

  • Prevents unnecessary full-scale testing when not needed.

  • Saves time and effort for both developers and testers.

  • Quickly identifies whether additional testing is necessary.


Sanity testing is an efficient and targeted quality assurance technique that ensures recent code changes have resolved issues without introducing new ones. By focusing only on modified areas, it provides quick validation and build confidence, allowing development teams to move forward safely without performing exhaustive testing for every small update.