Can test case break after changes in lines of code that are not hit by the test case?
If I have a test case that passes on one version of the code and a change is made to some lines in the code that are not hit by this test case, is there a possibility that the test case fails after this change? If yes, can you provide an example?
To clarify more: If I have for example a code block as follows
Statement1; Statement2; Statement3;
And I have a test case that only hits Statements 1 and 2. Now suppose a change is made to statement 3 and I need to run the regression to make sure nothing is broken. In that case, does it make sense to run the test case that does not hit Statement 3. Is there any possibility that the test case breaks after the modification?
It depends on what
Statemen3;is doing to the overall state of the software. Without you giving more details it is hard to say. At a high level: if
Statement3;creates some situation where the behaviour of
Statement2;might change, then your test case might fail.
That's why, if you are doing white-box testing (which seems to be the case), it is very important that you have a deep understanding of the code. If you don't, you should ask the developer who wrote (or who is responsible for) the code. They are the best people to answer this type of regression testing question.