Why sanity is called subset of regression testing?
There are a few questions I have found myself wondering since I was a student.
I've been using Google and Google Scholar to keep track of my "questions." Let's answer those questions together. If you have more, share them on Twitter or add them to the GitHub issue tracker. What is sanity testing? To be honest, sanity testing is a pretty bad name for it. Why would someone want to write tests for sanity? The first thing that comes to mind is that if the code can break, the user won't run it. There is a pretty good reason for this: A code path that returns an unexpected result (null pointer exception) can cause a problem, but is not a defect. However, some code paths produce null result not because they are defective, but due to external circumstances. For example, the code path will fail if some data is missing or if an external service is down. It can happen that it will fail even when the code is working fine.
When a path that seems to be functional is in fact returning the wrong result, we call it a bug. This definition fits perfectly with what a developer should be doing when writing tests. A test for sanity could help to make sure that the code will actually work as expected by the user.
But if we just want to check whether the user can run the code, then we don't need to write a test for sanity. What should the test be for? It could be reasonable to write a test for sanity only in the following scenarios: A change is made to the code that makes it return unexpected results. That means that the tests should be written before the change, but the change should be a "normal" one. This kind of change can be very hard to find. Often it is not obvious what part of the code is changed, and even if we can find it, it can take a lot of time to actually reproduce the behavior.
That's why it can beneficial to have some automatic sanity test built into the development environment. This automatic test would make sure that any path that returns an unexpected result will not be executed when running the code in the development environment. Why do we need a test for sanity?
What is the difference between sanity and retesting?
It is the difference between a man who only sees with his own eyes, and a man who sees with the eyes of an impartial judge.
-Sigmund Freud. The subject I want to talk about today was one of the most difficult for me to write about and a topic that I've encountered several times in the last few years. The first time I encountered it was in 2026 with a young woman who was a client of mine at the time. She was married with two children, and her husband was not allowing her to have anymore children. This was not her doing, as it was the childbearing aspect of our work. This was solely about her husband. As you'll see, she had to deal with quite a few issues in her marriage and life.
Her husband's objection to having more children had arisen when she had just had her second child. When he saw her post her miscarriage, he told her if she wanted another child she had better not get pregnant again.
She got pregnant again and ended up miscarrying again. He then announced that if she had more children she would certainly miscarry again. She then tried to convince him that she wouldn't miscarry, but he simply dismissed her.
Then one day he became more interested in a new girl who lived with them. He was very kind and pleasant to her, and he was quite fond of her. He asked her if she wanted to move in with them. She told him she didn't mind living with them as long as he also lived with her and their children. He made this offer with no mention of the subject of children, and she was grateful that he had opened up a new world to her. She then told me that her life was very enjoyable because she got to enjoy the company of both her husband and his new girlfriend. She also enjoyed the fact that they were both able to stay at home with the children, and as a bonus she no longer had to work to support the family.
When I met with her again she seemed very happy, so I said, You seem to be in a good place in your life, and I don't think you need anything else from me at this point. This was over four years ago and since then, her husband has been making every effort to get her back into fertility treatments.
Related Answers
How do you write a test scenario for regression testing?
The question asks for a tutorial about manually regress...
What are the 3 techniques of regression testing?
Recently, I was asked if regression testing is the same as UAT (user...