What is Sanity Testing?
Sanity testing is done to ensure the major functionalities of the application is working correctly. It is performed after deploying a new software build, with minor changes in code, or functionality, to ascertain that the bugs have been fixed and no further issues are introduced due to these changes. It is also called as a subset of Regression testing. Sanity testing is also a Surface Level Testing.
It is done at the “release level” in agile methodology where sufficient time is not given to test the complete functionality of the software in that case sanity testing is performed to ensure the major functionalities work as per expectation. It decides if an end to end testing of a software product shall be carried out further or not. If the sanity test fails, the build is rejected to save the time and costs involved in more rigorous testing.
Example of Sanity Testing
In an example of booking flight tickets online, the important functionalities, in this case, would be searching flight, booking tickets by adding traveler information and payment gateway.
Suppose a build is given after a bug fix where the proper validation of Email & phone number is implemented. Thus, the sanity test will be performed on the build first to ensure the major functionalities booking tickets by adding traveler information and payment gateway does not have any impact and works as expected.
When to perform Sanity Testing
- The build is received after there is a minor change in the code.
- The build is received after bug fixing.
- Just before the deployment on production.
Goal of Sanity Testing
- To verify and validate the correctness of the newly added functionalities and features
- To ensure that introduced changes did not affect existing functionalities
- To test logic implementations of developers
Features of Sanity Testing
Listed below are the key features of sanity testing:
- It is a subset of regression testing and focuses on the smaller section of the application.
- It is usually done near the end of the test cycle
- It is not scripted and documented
- It covers only limited functionalities while following narrow and deep
- It is performed by the testing team.
- It acts as a gatekeeper for the builds to be passed on to further levels of testing
How to perform Sanity Testing
As the main objective of the sanity test is to ensure that new defects are introduced as a result of fixing any existing issue and all the functionalities are working as expected. Thus, the sanity test is carried out in 3 simple steps:
- Identification of new features: The first step is to identify the functionalities and features which need to be verified after getting a new build, along with the modification introduced in the code while fixing bugs.
- Evaluation of features: Next step is to check if the newly implemented features and functionalities are working as expected and according to specifications
- Perform testing of related features: Finally, in the last step all the related parameters, associated functionalities, and elements of the above-evaluated features are tested to ensure they are working fine.
Advantages of Sanity Testing
- It is focused on one or few areas of functionality thereby saving lots of time and effort
- There is no documentation required
- It helps in identifying the dependent missing code or feature.
- It helps in verifying the small functionality of the application after a code change.
Disadvantages of Sanity Testing
- It focusses only on the high-level functionality of the application
- As it is unscripted, so future references are not available
- As the testing is performed only on the limited features so defects in other functionalities become difficult to catch.