Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: Mar 27, 2024

What is Sanity Testing?

Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM

Introduction 

Sanity Testing

Sanity testing is a type of regression testing that aims to verify whether the recent code changes in a software build are functioning as intended.  It serves as a preliminary check to decide whether further testing of the build can proceed or not. The purpose of sanity testing is to find the issues fast. Sanity testing can be done by developers or QA engineers for new builds. It is a quick test that can be performed as the first step of testing.

Functionality of Sanity Testing 

Sanity testing is used to verify that the basic functionality of the software is working correctly. This can include that the application can be installed and work correctly without crashing. Also, it tests whether the user interface is working properly.
 

Functionality of Sanity Testing

 

Some of the functionality that is checked in sanity testing is below:

  • Primary navigation and controls are working.
  • The application is stable and responsive to inputs.
  • The application can handle basic input validation.
  • The application integrates with other tools.
  • The application returns error messages when something goes wrong.

Sanity testing should be done after the unit testing and before the regression testing. It will identify any major issues which can save time and cost.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Sanity Testing Example

An example of sanity testing could be testing new software that allows users to create and edit documents. Some of the sanity tests that could be done on this application are:

  • Verifying that the application can be installed and launched correctly
  • Verifying that the user interface is displayed correctly
  • All of the buttons and menus are working
  • The application can open and save documents correctly. Also, it can handle different file formats.
  • The basic editing functions are working correctly.
  • The application can handle basic input validation

Sanity Testing Process

Sanity testing is a crucial step in the software testing process. It aims to quickly check whether specific software application parts are still functioning correctly after recent changes or updates. Here's an easy-to-understand explanation of the sanity testing process:

  • Identify the Scope: First, you need to define the scope of your sanity testing. Determine which parts of the software you want to test. This could be new features, recent bug fixes, or critical functionalities.
     
  • Select Test Cases: Choose specific test cases that cover the identified scope. These test cases should be designed to verify the intended functionality quickly.
     
  • Test Execution: Execute the selected test cases on the software build that includes the recent changes. You are not trying to find all possible issues; instead, you're ensuring the fundamental features are working.
     
  • Check for Expected Results: For each test case, compare the actual and expected results. If they match, it indicates that the core functionality is not compromised.
     
  • Report Findings: If any of the test cases fail, it means there is an issue with the recent changes. These issues should be reported to the development team for fixing.
     
  • Decision Making: Based on the results, you make a decision. You can proceed with more extensive testing if the core features are intact. If not, you may halt further testing until the issues are resolved.
     
  • Re-testing: After fixing the issues, re-run the sanity tests to ensure the problems are resolved without introducing new ones.
     
  • Proceed with Testing: If the sanity tests pass, you can move on to more comprehensive testing, such as regression testing or functional testing.

Features of Sanity Testing 

Some of the features of sanity testing are:

features of  Sanity Testing

 

  • Scope: Sanity testing is limited in scope. It is focused on checking that the functionality of the application is working correctly.
  • Speed: Sanity testing is usually performed fast. The goal is to identify and isolate issues.
  • Execution: Sanity testing is done by developers or QA engineers on new builds. It is the first step before regression testing.
  • Depth: Sanity testing is not deep. It is done to check that the new feature or modification is working without any bugs.
  • Identification: Sanity testing can identify the issues fast.

Advantages of Sanity Testing 

Some of the main advantages of sanity testing are:

  • Fast: Sanity testing is designed to identify and solve the issues of an application. It saves time and resources.
  • Cost-effective: Sanity testing is a very cost-effective way to ensure that an application is stable.
  • Efficient: Sanity testing is an efficient way of identifying problems early in development. This can save a lot of time and money.
  • Reducing Risks: Sanity testing can help reduce risks by identifying issues within an application.
  • A baseline for more tests: Sanity testing helps to create a baseline for another testing. It gives an idea of how the application behaves under normal conditions.
  • Easy to maintain: Sanity testing is easy to maintain. It can be run multiple times until it passes the test.
  • Ensuring Stability: Sanity testing ensures that the basic functionality of an application is working correctly. Also, the application is stable to proceed.

Disadvantages of Sanity testing 

There are some disadvantages as well:

  • Limited scope: The scope of sanity testing is limited.
  • Not a substitute: Sanity testing is not a substitute for other testing methods like regression or acceptance testing. 
  • Subjective: Sanity testing is subjective. It depends on the experience of the person who is testing.
  • Does not guarantee complete coverage: Sanity testing does not guarantee full coverage of the functionalities. It may miss some important issues that could cause problems in the future.

Frequently Asked Questions

What is sanity testing with example?

Sanity testing, which checks whether specific functionalities or code changes in a software application are functioning as expected following minor updates, is a quick and concentrated testing process. It determines if the essential elements are still present. For instance, run a sanity test after fixing a login bug to ensure users can log in without problems. 

What is smoke vs sanity vs regression?

Smoke testing determines whether a software application's most crucial features operate without significant problems. It is usually conducted before additional testing and is broad and shallow. Sanity testing is a focused, in-depth test that verifies particular changes or bug fixes. It ensures that any recent code changes haven't negatively impacted essential features. Regression testing is thorough and looks at the entire application for unintended consequences of changes. It is done to ensure any updates or fixes have yet to harm already-functioning features.

What is difference between sanity and regression testing? 

Sanity testing is limited in scope and concentrates on a single element or change. It quickly checks that recent changes have yet to affect essential functionality.

On the other hand, regression testing covers a wide range of topics. The entire application is examined to look for unintended effects of changes. This ensures that previously functional areas have yet to experience regressions due to new features or fixes.

What is the main purpose of Sanity Testing?

The main purpose of Sanity testing is to identify the issues within a software application. A cursory test is done to ensure that the application is working fine.

Conclusion

In conclusion, sanity testing is an important step in the software testing process. It can help to find and remove issues in an application. It is a cost-effective and efficient way. It ensures that an application is good to proceed with more tests. It is important to have skilled persons for sanity testing.

You can refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. 

Happy Learning!

Topics covered
1.
Introduction 
2.
Functionality of Sanity Testing 
3.
Sanity Testing Example
4.
Sanity Testing Process
5.
Features of Sanity Testing 
6.
Advantages of Sanity Testing 
7.
Disadvantages of Sanity testing 
8.
Frequently Asked Questions
8.1.
What is sanity testing with example?
8.2.
What is smoke vs sanity vs regression?
8.3.
What is difference between sanity and regression testing? 
8.4.
What is the main purpose of Sanity Testing?
9.
Conclusion