testsigma

Sanity Testing | What, Why, and How to Perform it?

Sanity testing is a preliminary round of testing performed to еnsure that the critical functionalities of a softwarе application are working as еxpеctеd. This is generally done after making minor changes or fixes. It helps identify any major issues or regressions and provides confidence in the stability and sanity of the system before proceeding with further training.
header-banner-image

While ensuring software functions as expected through sanity testing may seem severe and meticulous, there is always room for a little fun. As software engineers, we understand the importance of keeping our sanity intact during testing.

With that in mind, one funny quote that comes to mind is, “Sanity testing: because if you were not a little crazy before, you would be after.” While we take our work seriously, we must keep things light-hearted and remember that laughter is often the best medicine for keeping our sanity intact.

In this guide, we’ll еxplore what sanity testing involves, its importance, and how to perform it.

What is Sanity Testing?

Sanity testing checks whether a software product works when a new module or functionality gets implemented into an existing product. Sanity testing is a software testing technique that evaluates the quality of the software release to determine whether it is eligible for further rounds of testing.

Sanity testing

Sanity testing is usually performed after receiving a fairly stable software build or sometimes when a software build might have undergone minor changes in the code or functionality. It decides if end-to-end testing of a software product shall be carried out further or not.

Sanity testing is also a Surface Level Testing, which helps decide if the software build is good enough to pass to the next level of testing.

Why should Sanity Testing be Done?

  • To verify and validate that testing can proceed for newly added functionalities and features in existing code.
  • To ensure that the introduced changes do not affect other existing functionalities of the product.
  • To decide whether further testing can be carried forward or not.

Objective of Sanity Testing

Here are the main things it aims to do:

1. Check the basics: The first goal of Sanity Testing is to quickly check that the essential parts of the software are working as they should. This helps make sure the system is stable enough for more testing.

2. Find big problems: Sanity Testing wants to catch any major issues that might arise while the software is being made or changed. By focusing on the important parts, it can catch huge bugs early on and save time later.

3. Makе sure everything works togеthеr: Another goal of Sanity Testing is to make sure all thе different parts of thе software fit together smoothly. It checks for problems when different parts, like databases or external systems, try to work together.

4. Test changes and fixes: Sanity Testing also chеcks that any changes or fixes made to the software don’t cause any problems or break things already working. It’s essential to ensure everything runs smoothly after changes are made. 

When Do we Need to Perform Sanity Testing?

  • The build is received after many regressions or if there is a minor change in the code.
  • The build is received after bug fixing.
  • Just before the deployment on production.

When You Don’t Need to Do Sanity Testing?

Sanity testing is a special type of testing to ensure that the software’s most essential parts are still working correctly after you make small changes or fixes. It’s like a quick check-up to see if everything is still okay. 

We do this to ensure our changes are fine. But sometimes, we don’t need to do sanity testing. 

For еxamplе, if we only made changes that don’t really affect how thе software works, or if we already tested the software a lot before and it always passed thе sanity tests, then we might not need to do it again for minor updates. 

Features and Attributes of Sanity Testing

Let’s look into some features and Attributes:

1. Focusing on Specific Areas: When we do sanity testing, we don’t test the whole software. Instead, we concentrate on certain parts or functions. This helps us find any big problems or issues in important components. If we find something wrong, we can examine those areas more carefully.

2. Part of Regression Testing: Sanity testing is like a smaller version of regression testing. It only tests the parts that have been changed or added recently instead of testing everything again. This saves us time and effort because we only focus on the areas most likely affected by the changes.

3. No Set Rules(Unscripted): Unlike other types of testing where we follow a specific plan, sanity testing doesn’t have a fixed set of test cases or scripts. Testers use their knowledge and instincts to do quick tests based on what they know about the important functions of the software. This way, we make sure that the basic functions are working properly.

4. Not documented: Since sanity testing has a relaxed plan, it might not be as thorough as other types of testing. But it still gives us a quick check to ensure the software works fine.

5. Performed by Testers: Sanity testing is usually done by testers with a lot of experience. They know the essential functions of the software well, so they can quickly find any major problems or defects.

Attributes of sanity testing

So, remember, sanity testing is all about focusing on specific areas, saving time by testing only recent changes, using our knowledge to do quick tests, and having experienced testers to find any big issues. 

Functionality of Sanity Testing: 

The functionality of Sanity Testing ensures that the critical features of the system are still intact and functioning properly without going into detailed testing. 

Sanity Testing helps identify any major issues or regressions that may have been introduced during the development process, allowing for early detection and resolution before proceeding with further testing or deployment. 

This type of testing is beneficial when time is limited and a quick assessment of system stability is required. 

Sanity Testing Examples

If you have to know how Sanity Testing works, here are some simple examples:

1. User Interface Testing: Sanity testing can be performed to ensure that the user interface of the software or application is functioning correctly. Sanity testing for the user interface would include reviewing all pages with no major discrepancy.

2. Database Testing: Sanity testing can also be used to verify the integrity of the database. It ensures that data is being stored and retrieved correctly and that any necessary database operations, such as inserts, updates, and deletes, are functioning properly. Sanity testing would include executing a minimum number of tests that cover all the basic operations.

3. Functionality Testing: Sanity testing can be conducted to validate the basic functionality of the software or application. This involves checking if essential featurеs work as intended without major issues or errors.

4. Performance Testing: Sanity testing can evaluate the system’s performance under normal conditions. It helps identify any performance bottlenecks or issues that may affect the overall efficiency of the software. Sanity testing for performance would include checking the performance time for basic user workflow for optimum load.

5. Compatibility Testing: Compatibility testing involves testing the software’s ability to function correctly across different platforms, operating systems, and devices. Sanity testing here would include testing on the most used platforms/operating systems/devices.

Advantages of Sanity Testing:

Sanity testing ensures that the new functionality added to the software doesn’t cause any big issues. Other than that, it does a quick evaluation of new software releases to ensure whether it’s ready or not for the next level of testing. It helps developers save time and energy by not passing the broken software for the next level of testing

Disadvantages of Sanity Testing:

Sanity testing does not thoroughly test the software functionality; because of this, minor issues cannot be found in sanity testing. This testing only evaluates whether further testing can be performed or not. 

Sanity Testing Process

Here is the step-by-step process of Sanity Testing.

Identify modified components

In the sanity testing process, the first step is to identify the components that have been modified or changed since the last round of testing. This could include software modules, features, or any other elements that have undergone modifications.

Evaluate each component

Once thе modified components arе identified, they must be thoroughly evaluated to understand thе еxtent of changes made and their potential impact on thе overall system. This evaluation helps determine which components require sanity testing and which can be skipped.

Define the sanity testing approach

After evaluating the modified components, a clear approach for conducting sanity testing must be defined. This includes deciding on the scope of testing, identifying critical functionalities to be tested, and establishing specific criteria for passing or failing each test case. 

Perform Sanity testing

Sanity testing is typically performed to determine if the software is stable enough for further testing, ensuring that major functionalities work as expected.

Next steps

Once the sanity testing is completed, the next step is to complete more thorough testing to evaluate the software’s performance and functionality entirely.

Ways to Perform Sanity Testing

Let us look into the differences between manual and automated processes in sanity testing.

1. Manual Sanity Testing: Benefits, Challenges, and How to Perform

Some major checklist points on Manual sanity testing cover the following:

Benefits:

There are several benefits to conducting manual sanity testing, including quickly identifying critical issues such as major functionality failures or user interface glitches. This type of testing also provides flexibility in adapting test cases based on real-time observations. 

Challenges:

However, there are also challenges associated with manual sanity testing, such as its subjectivity and reliance on human judgment, which can lead to inconsistencies in test results. Moreover, it can be time-consuming and resource-intensive when dealing with complex systems. 

How to perform:

Manual sanity testing involves executing a subset of test cases covering the most critical functionalities, ensuring they work as expected after any changes or updates. This helps verify whether the system is stable for further testing or deployment.

The steps involved in manual testing are:

  1. Decide the test cases that need to be executed. These are the test cases markes as sanity tests. These will usually be high priority and high severity tests.
  2. Go through all the test cases one-by-one, executing each test step in the needed order. 
  3. For each test step, make sure to document the result if there is any discrepancy. Otherwise the test case will be marked as passed.
  4. Once all the test cases are updated, the test report is created that will contain the test execution results.
  5. If all the test cases pass then the build is passed on for more detailed testing.

2. Sanity Test Automation: Benefits, Challenges, and How to Perform

Here are the benefits, challenges, and processes associated with sanity test automation:

Benefits:

  1. Time-saving: Automating sanity tests allows faster execution than manual testing. This enables quicker feedback on the stability and functionality of the software, helping teams identify issues early in the development cycle.
  2. Increased test coverage: Automation allows for complete testing by executing many test cases quickly. This ensures that critical functionalitiеs are thoroughly tested, reducing the risk of undetectеd bugs or issues. 
  3. Improved accuracy: Automated sanity tests eliminate human errors and inconsistencies that may occur during manual testing. By following predefined scripts and rules, automation ensures consistent and reliable results.

Challenges:

Test Coverage: One of the main challenges in sanity test automation is ensuring comprehensive test coverage. Sanity tests are typically designed to quickly validate the basic functionality of an application or system after a new build or release. 

Yet, determining which specific functionalities to include in sanity tests can be tricky. It requires careful analysis and prioritization to select the most critical features that need to be tested without overwhelming the automation suite with unnecessary tests.

Test Maintenance: Another challenge in sanity test automation is maintaining the test suite over time. As applications evolve and new features are added, existing sanity tests may become outdated or irrelevant. It is essential to regularly review and update the automated tests to align them with the current state of the application. 

Failure to do so can lead to false positives or false negativеs, where passing tests incorrectly indicates that everything is functioning correctly, or failing tests raise alarms unnecessarily.

Test Execution Time: Test execution time is another important factor when reviewing and updating automated tests. As the application grows and evolves, the test suite may become larger and more complex, resulting in longer execution times. This can impact the efficiency of the testing process and delay the feedback loop. 

Therefore, it is crucial to optimize the test execution time by identifying and eliminating any redundant or unnecessary tests. Regularly monitoring and improving the execution time ensures that the testing process remains efficient and effective. 

How to perform:

  1. Requirements Analysis: Thoroughly analyze the system requirements to identify key functionalities that need to be tested during sanity testing. Collaborate with stakeholders, developers, and subject matter experts to thoroughly understand the critical areas that should be covered.
  2. Every time a new build is created, the sanity tests should be executed.
  3. The test report for sanity test execution should be shared with all needed stakeholders.
  4. If the sanity tests pass, the build should be passed on for more detailed testing.

Automated Sanity Testing with Testsigma

With a 5x faster tool like Testsigma, sanity testing is performed to quickly evaluate the basic functionality of an application or a specific feature. 

It aims to ensure that the application is stable enough for further testing and has no major issues that could hinder its usage.

Sanity Testing a Login Page with a New Submit Button

For example, to perform sanity testing on a login page where the submit button is a new build, we would:

  • Enter a valid username and password.
  • Click the submit button.

The login page should work fine and log the user in. The sanity test fails if the login page fails or the user is not logged in. 

For the above example, a video link is attached to writing Test cases that explain the Sanity Testing process in Testsigma. 

Click and Watch for a better understanding!

Testsigma’s intuitive interface and powerful automation capabilities make it easy to perform sanity testing and ensure that software applications meet the required standards for quality and performance.


Best Practices for Sanity Testing

1. Start with clear goals: Knowing what you want to achieve before you start testing is essential. This will help you figure out which parts of the software you need to test and keep you focused.

2. Focus on the important stuff: When doing sanity testing, pay extra attention to the essential parts of the software that might be affected by recent changes. By doing this, you can quickly find any critical problems or mistakes that might have happened.

3. Use a set of standard tests: Make a set specifically for sanity testing. These tests should cover the software’s main tasks, and you should use them every time you test different versions or updates.

4. Use automation if possible: Special tools like Testsigma and Selenium can make sanity testing faster and better. It helps you do repetitive tasks quickly and find problems easily. You can also create reports to analyze the results.

5. Write down and share what you find: When you find something wrong during testing, write it down and tell others about it. This way, everyone involved will know about the problems and can fix them.


Conclusion

So, sanity testing is super important when testing software. It’s all about ensuring that any changes made to an application are handled smoothly. By doing thеsе sanity tests, thе testers can catch any possible problems and ensure thе app works just likе it should. 

Frequently Asked Questions