Sanity testing entails ensuring that the application's operation remains normal and does not appear to be illogical. The sanity test is failed if you try the simplest happy path and the result is incorrect.
As per Wikipedia:
A sanity check, also known as a sanity test, is a quick way to see if a claim or the result of a computation is true. It's a basic test to assess if the stuff generated is logical (i.e., the creator was thinking sensibly and using sanity). The purpose of a sanity test is to rule out specific types of obviously incorrect findings rather than to capture every potential mistake. To execute the test, a rule-of-thumb or back-of-the-envelope calculation might be used. The benefit of running a first sanity test is that it allows you to quickly assess fundamental function.
Regression testing is extensively inspecting everything that might be affected to ensure that no functionality has changed and no new bugs have appeared. It entails determining all functions impacted by the altered code and testing not only the happy path but also other flows.
As per Wikipedia:
Regression testing (sometimes known as non-regression testing[1]) is the process of re-running functional and non-functional tests to confirm that previously designed and tested software continues to function after a change. [2] If not, this is referred to as a regression. Bug patches, software updates, configuration changes, and even electronic component substitutions may all necessitate regression testing. [3] Test automation is widely used since regression test suites tend to grow with each discovered fault. To establish an appropriate subset of tests, a change effect analysis is sometimes undertaken (non-regression analysis[4]).
Tests of sanity are only superficial. In-depth regression testing is required.
Elevate your skills with our comprehensive Machine Learning Course.