Skip to main content

Test-backed diagnostics

Find bugs and errors faster by automatically discovering and reproducing runtime exceptions. Once a test suite has been generated, Symflower will automatically highlight any uncaught runtime exceptions in your IDE in real time. For each exception found, a test case is provided to reproduce and help fix the found problem.

Usage

The test-backed diagnostics feature automatically highlights exceptions in your code once a test suite was generated for the affected code. This feature doesn't need to be enabled or configured manually.

Details

Test-backed, real-time code diagnostics help avoid common errors including (but not limited to):

  • division by zero
  • integer overflow
  • nil dereference (or NullPointerExceptions in Java)
  • index out of bounds.

Example

Copy the following code into a new Java file and generate a test suite:

class DivideByZero {
static int divideByZero(int x, int y) {
return x / y;
}
}

class IndexOutOfBounds {
static int indexOutOfBounds(int[] arr, int index) {
return arr[index];
}
}

class NullPointer {
static int nullPointer(String str) {
return str.length();
}
}

class IntegerOverflow {
static int integerOverflow(int x) {
return x * 2;
}
}

Based on the generated test suite, Symflower will automatically highlight detected problems with wiggly lines. The underlying test case will help you reproduce the exception:

Uncaught exception highlighted by Symflower's test-backed diagnostics in VS Code