What is Sanity Testing With Example?

Despite there being hundreds of articles, sanity testing has always remained as a misunderstood topic in software testing. To be honest, the confusing terminologies have contributed largely to the misunderstanding. Here, let us make the concept of sanity testing clear for you.
sanity testing
What is Sanity Testing?
Sanity Testing refers to tests that determine whether it is feasible and sensible to proceed with the software testing process. It is mostly done to check the health of the application that has been built, which basically is your first step.
The tests are performed when some changes are made to the code to ensure proper working of every functionality of the program. Therefore, these types of software testing normally remain undocumented and unscripted since the objective of the system is to check the new functionality and to ensure that the bug has been fixed.
How to do sanity testing?
After a successful regression testing is carried out, which includes testing that verifies the program actually works & performs the same way as it is expected to with the software, sanity testing is performed. It is performed in order to check for defects, which may have cropped up previously and are fixed accordingly and to ensure that no further issues crop up.
Many a time, the “Hello World” program is used for testing. If the program fails to compile or run, the supporting system has a configuration problem. If it works, any problem thereafter lies in the actual application.
Another method is to denote checks which are performed within the program code. This usually includes functions and arguments to see if the outputs are correct.
Example of sanity testing

Disadvantages of Sanity Testing

  • Focus is only on the commands and functions
  • Does not go to the design level of the software
  • Testing is performed only for limited features
  • No scope for future references since scripts are not there

How is sanity testing related to smoke testing?

  • It is commonly validated by smoke tests
  • If smoke tests fail it’s impossible to carry over sanity tests
  • Both of them are an exemplary option for not wasting time when it comes to testing

Reasons to perform sanity testing (Features)
Firstly, It offers great speed. Since it has a very narrow focus for functionalities to be tested, you don’t need to script or document the findings.
Secondly, It allows you to plan the next step in testing, ahead of its time. For example, if your test fails, you can dedicate your development team to fix the bugs first and keep aside the rest of the tasks.
Third, It can capture any configuration and deployment issues from the initial stages. The test will help you find such errors that can be quickly resolved and allow others to continue testing.
features of sanity testing
Fourth, at times during the constraints of release time, regression testing cannot be performed to the program build; hence, sanity testing does the work in a much simpler and faster way.
Lastly, It can also be performed as Adhoc testing. Many a time during testing, a set of test cases is run, which can affect the specific area under testing (area in which defect is fixed or area in which new functionality is added),
Final Words
Sanity testing has always been proved as one of the best testing techniques to avoid wasting time and effort. It is used as a quick method to ensure that the previous bugs in the program have been fixed and that the application works fine.

It is always defined as a subset of regression testing due to its similarities with the latter. Therefore, make sure to run sanity testing along with other testing methods to ensure the success and overall smooth functioning of the software.