What is the difference between Sanity Testing & Regression testing ?
posted 10 years ago
Regression testing is testing code that has been modified. For example, you write some code and test it thoroughly. Then you find a bug or make some other changes to the code. Not only do you need to test your changes to make sure they work correctly, but you should also test an affected code to make sure you didn't accidentally break something. This last part is the regression tests. Often you will just run your original tests along with the new ones for the changes you made. However, sometimes the original test suite may be too large or some of the tests don't apply to the changes you have made, so you might decide to run a smaller subset of the orignal tests.
Sanity testing on the other hand usually refers to making sure the assumptions you make about your code are true. For example, you use a method that returns a reference and the API docs claim that the method will not return a null reference. You could use an assertion to make sure that the return value REALLY is non-null. This is typically a good thing to do if you also wrote the other method yourself.