Blog Sanity Testing

What is Sanity Testing?

Bhavani R Bhavani R | Last updated: November 27, 2024 |

Sanity testing is performed whenever any recent change is made to the software. Today, businesses rely heavily on software to streamline their operations and maintain customer satisfaction. Well-built, bug-free software plays a major role in this case. Therefore, thorough testing before launching the software is crucial to identify and rectify any issues that could disrupt user experience or compromise business operations. This is where sanity testing comes in—a specific type of testing that quickly assesses the stability and functionality of recent code changes to ensure they work correctly without introducing new issues. In this blog, we will discuss sanity testing, its features, examples, ways to perform it, and more in detail. Read along to find out. 

What is Sanity testing?

Sanity testing definition 

Sanity testing is performed on a stable build to ensure that code changes work correctly without introducing new bugs. The main purpose of sanity testing is to verify that specific functionalities affected by recent changes are functioning as expected, providing a quick check before more extensive testing is carried out.

When to perform Sanity testing?

Sanity testing is performed at specific stages in the Software Development Life Cycle:

  • After the software passes the smoke test
  • Following minor changes or bug fixes in the code
  • Upon receiving a stable build after bug fixing
  • Just before deploying the software to production

Benefits of sanity testing

Sanity testing offers several benefits that help maintain software quality and stability:

  • Sanity testing provides immediate feedback on the impact of recent changes, allowing developers to address issues promptly.
  • This testing approach focuses only on the areas affected by changes, saving time and testing resources.
  • Sanity testing helps ensure that the software remains stable after updates, reducing the risk of major issues in production.
  • It gives developers and stakeholders confidence that the changes have been implemented correctly and the software is ready for further testing or deployment.

Features and Objectives of Sanity Testing

Sanity testing has distinct features and objectives, making it an essential part of the software testing process: 

Features of sanity testing

How sanity testing works

  • Sanity testing involves a rapid and targeted evaluation of specific software functionalities, ensuring efficient use of time and resources.
  • It prioritizes testing essential features directly impacted by recent changes or updates in the software, ensuring their continued reliability.
  • Unlike comprehensive regression testing, sanity testing focuses on verifying specific functionalities rather than testing the entire application.
  • It is performed following significant modifications or corrections in the software to confirm that these changes have been implemented correctly and have not led to new issues.
  • Due to its narrow scope and specific focus, sanity testing uses a limited number of test cases and testing resources, making it a cost-effective and time-efficient testing method.

Objectives of sanity testing

  • Sanity testing ensures that the fundamental functions of the software work correctly after changes.
  • This testing approach confirms that recent modifications have not destabilized the software.
  • It identifies critical issues early, preventing them from progressing to later stages.
  • Sanity testing validates that changes integrate well with essential parts of the system.
  • This testing assures that the software is suitable for more extensive testing.
  • Sanity testing quickly assesses the impact of changes to avoid unnecessary testing efforts on unstable builds.

Ways to perform Sanity testing

There are two primary approaches to performing sanity testing: manual and automated. Each method has its pros and is chosen based on factors such as the complexity of the software, available resources, and the need for rapid feedback.

1. Manual Testing

Manual sanity testing involves testers executing predefined test cases manually to verify critical functionalities of the software. Here’s how it typically works:

  • Testers prepare a concise set of test cases focusing on the application’s core functionalities that are likely affected by recent changes or updates.
  • Testers execute these test cases step-by-step on the latest build of the software, following predefined procedures and documenting any issues encountered.
  • In addition to executing predefined test cases, testers may perform exploratory testing to uncover unexpected issues or behavior that could affect the software’s stability.
  • After executing the test cases, testers verify whether the critical functionalities are working as expected and ensure that recent changes have not introduced new defects.
  • Testers document the results of the sanity testing, including any identified issues or discrepancies, and communicate these findings to the development team for resolution.

2. Automated Testing

Automated sanity testing involves using automation tools and scripts to perform rapid and consistent checks on critical functionalities of the software. Here’s how automated sanity testing works:

  • QA engineers or testers develop scripts using automation tools like Selenium, TestComplete, or others to automate the execution of test cases.
  • Automation scripts are executed on the latest software build, running predefined test scenarios to verify critical functionalities.
  • The automation scripts validate whether the functionalities perform as expected and check for any deviations from expected behavior.
  • Automation tools generate detailed reports on test execution, including pass/fail status, screenshots, and logs, providing comprehensive visibility into test results.
  • Automated sanity tests can be integrated into continuous integration/continuous deployment (CI/CD) pipelines, enabling frequent and automated testing of new builds.

How to perform Sanity testing?

How to perform sanity testing

Performing sanity testing involves a structured approach to quickly verify that critical functionalities of the software are working as expected after recent changes or updates. Here’s a detailed explanation of how to perform sanity testing:

Step #1: Identification

The initial step is Identification, where testers focus on pinpointing the critical functionalities affected by recent software changes. This involves reviewing updates such as bug fixes or feature enhancements through change logs, release notes, or direct communication with developers. 

Once identified, critical functionalities like payment processing or authentication mechanisms are prioritized based on their impact on user experience. Defining the scope of testing ensures thorough validation of vulnerable software parts post-change, optimizing testing efforts.

Step #2: Evaluation

The Evaluation phase readies the testing environment to mirror production conditions closely. This includes deploying the latest software build with recent updates, configuring databases and servers, and ensuring all components function correctly. 

A preliminary smoke test or build verification test (BVT) validates basic functionality and stability, ensuring the software launches successfully and key features operate as expected. Test data is crucial, simulating real-world scenarios to accurately mimic user interactions, including user account creation and setting configurations.

Step #3: Testing

During Testing, predefined test cases are executed to verify critical software areas manually or through automated tools. Manual testing involves following detailed procedures to compare actual outcomes against expected results and detecting any anomalies indicative of recent changes’ issues. On the other hand, automated testing expedites this process for repetitive tasks, using pre-scripted tests to validate critical functionalities swiftly. Testers document observations throughout, prioritizing and reporting defects based on their impact, ensuring developers swiftly resolve them. Here is a quick sanity-testing checklist you can use. 

Sanity testing example

Imagine you’re working on a web application called “DocMaster” that allows users to create and edit documents. Here’s how sanity testing might be applied:

Basic Functionality Check

Scenario: A user wants to create a new document.

Sanity Test: Verify that the “Create New Document” button is visible and functional. Click the button and check if a new document is successfully created and opens in the editor.

Editing Functionality

Scenario: A user wants to edit an existing document.

Sanity Test: Open an existing document from the document list. Check if the editing tools (such as text formatting and saving changes) are working as expected. Ensure that changes made are saved correctly.

Document Saving and Retrieval

Scenario: A user edits a document and saves changes.

Sanity Test: Edit a document, save the changes, and then close the document. Reopen the document to ensure the changes were saved properly and the document content displayed correctly.

User Permissions

Scenario: Different users have different permissions (e.g., read-only access vs. full editing access).

Sanity Test: Log in with different user roles (e.g., admin, regular user, guest) and verify that every user can perform the actions they are permitted to do. For example, a guest user should be unable to edit documents, whereas an admin user should have full access.

Sanity testing vs Smoke testing

The choice between sanity testing and smoke testing depends on the testing objectives and the stage of development. Smoke testing is ideal for quickly validating basic functionalities and ensuring the overall stability of an application before more comprehensive testing begins. On the other hand, sanity testing is chosen to verify specific functionalities or areas of the application after minor updates or bug fixes. 

Sanity Testing Smoke Testing
Purpose To quickly verify that recent changes haven’t broken critical functionalities To verify basic functionalities work correctly before proceeding with further testing
Scope Focuses on specific areas impacted by recent changes Covers broad areas of the application, testing major functionalities
Timing Conducted after major changes or bug fixes Conducted on every new build or release candidate
Depth Shallow testing aimed at core functionalities Broad and shallow testing to ensure basic functionality
Execution Manual testing is common but can include automation Often automated to quickly verify build stability
Test Cases Fewer and targeted toward critical functionalities More comprehensive but less detailed than other tests
Environment Often conducted in a controlled testing environment Typically performed in various environments (dev, test, staging)
Outcome Focuses on detecting major issues affecting core functionality Identifies showstopper defects that prevent further testing
Frequency Conducted as needed after specific changes Conducted routinely on each build or release
Goal Confirm the software’s readiness for further testing or deployment Ensure the build is stable enough for more rigorous testing phases

Challenges of Sanity testing

There are certain challenges associated with sanity testing. Here are the major ones and possible ways to overcome them: 

1. Complexity of Systems

Systems with intricate architectures or dependencies can be challenging to verify in a limited scope. As a result, you need to focus on critical functionalities and key pathways to validate essential components.

2. Dynamic Requirements

Requirements that change frequently can lead to inconsistencies in test coverage.

Therefore, maintain close communication with stakeholders to stay updated on changes and prioritize testing based on the latest requirements.

3. Time and Resource Constraints

Limited time and resources can restrict the depth and breadth of testing. To overcome this issue, you must prioritize tests based on risk assessment and allocate resources efficiently.

4. Test Environment Management

Issues in setting up and maintaining test environments can delay testing. To get over this, you can use virtualization or containerization for easier environment replication. Furthermore, collaborate closely with DevOps teams to streamline environment management.

5. Lack of Domain Knowledge

Insufficient understanding of the domain can lead to overlooking critical test scenarios. Therefore, invest in training or knowledge-sharing sessions to enhance understanding of the domain. 

6. Communication and Collaboration

Insufficient communication between teams can lead to misunderstandings or delays in resolving issues. You must foster a culture of open communication and collaboration between development, testing, and operations teams. You can also use collaboration tools and regular meetings to ensure everyone is aligned.

Conclusion

Sanity testing is crucial in maintaining software quality by ensuring that recent changes do not introduce new issues. Providing quick feedback helps promptly address problems and confirm the software’s readiness for further testing or deployment. 

QA Touch test management software can streamline sanity testing processes, enhancing efficiency and accuracy. Furthermore, the ChatGPT-driven test case creation fastens the entire testing process.

Want to see how it works? So start your 14-day free trial today!

Leave a Reply