throw-runtime-exceptions

Make implicit runtime exceptions explicit.

Description

This option tells Diffblue Cover to consider the possibility of runtime exceptions in the analysis.

Usage

Without the option, Diffblue Cover will not be able to cover the “return -1” line in the following method:

public static int func(ArrayList<Integer> al) {
  try {
    al.get(2);
    return 1;
  }
  catch (java.lang.NullPointerException e) {
    return -1;
  }
}

Since many objects can produce exceptions at many points in the execution, switching this option on has a negative effect on analysis times (10x analysis time increases have been observed) and consequently, on coverage. Also, many exceptional test cases are produced which are usually not interesting in the context of unit testing. It should be kept for covering try...catch clauses that have not been covered without the option.

phases:
-
  cbmcArguments:
    throw-runtime-exceptions: true

Default

Phase Default
1 false
2 false
3 true

results matching ""

    No results matching ""