-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Description
UTBot doesn't take into account information about coverage of catch blocks. Therefore, in some cases it might lose branches that cover several abstract paths with the same start and end, but they are different because of the catch blocks in the middle of the paths.
To Reproduce
Steps to reproduce the behaviour:
- Run UTBot java samples project
- Run generation for
- Open the generated test org.utbot.examples.exceptions.ExceptionExamples#nestedCatch
- Check resulting coverage
Expected behaviour
Three branches with results 1000
, 1110
, 1100
Actual behaviour
Only two branches are found.
public int nestedCatch(int i, int j) {
int r = 0;
try {
checkPositive(i);
} catch (NullPointerException e) {
try {
checkPositive(j);
} catch (NullPointerException ex) {
r += 10;
} finally {
r += 100;
}
} finally {
r += 1000;
}
return r;
}
Environment
There is no specific environment.
Additional context
Probably, the reason is that UTBot tries to cover catch block only after an exception has already been thrown. But if we have a situation where throwing this exception is an instruction we have already covered, we will drop the one leading to the catch block.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status