Sanity testing performed at the time of receiving software build (with minor changes in code) from the development team. The purpose of sanity testing is to ensure that all the defects have been fixed and no further issues come in existence due to these changes. It's a kind of regression testing with a focus on a few impacted functionalities only.
Sanity testing can be done in two situations: one in the case of enhancement in functionality and second in the case of defect fixed. It makes sure that the changes made in code or functions have no impact on the related modules, therefore, it can be applied only on related modules that can be impacted.
Process to conduct Sanity Testing
Likewise, the smoke testing tester doesn't need to design a separate test case suits for sanity testing. Tester only needs to choose test cases from already designed test cases for the modified or defect fixed function. The functions that are modified or defect fixed have tested once so; the tester uses the same test case that he has done before.
Let's take the example as above. Take a function Account of any payment site. The tester modifies and fixes some defects that might be occurred in an account function. The sanity testing performs the testing on the modified function, i.e., account function in payment application to check whether the function is working properly or not.
Sanity testing checks only modified or defect fixed functions, it does not check End to End functions. It is the subset of regression testing.