Details

Recommendation type: Potential setup problems

Configurable in Preferences: Yes

Filter category: Potential setup problems

Description

If tests fail in bulk with the same exception or for the same reason, it is an indicator that there are potential setup problems in the project. The Potential setup problems recommendation is dedicated to diagnosing the root cause of such behavior. The Potential setup problems recommendation may highlight one or more exceptions that hide the root causes of test failures and may not be necessarily discovered by the Exceptions and assertion errors recommendation.

UTA displays this recommendation when:

The following examples illustrate these scenarios:

Usually, the cause of an unexpected exception is related to:

For bulk creation, this may lead to a large number of removed tests since they will not contribute to coverage. The Potential setup problems recommendation is designed to discover such issues that may affect test generation or their execution. 

For information on diagnosing potential setup problems, see How can I diagnose potential setup problems?

Depending on your code, the following action links may be available:

Example 1 – Multiple Exceptions Thrown

The following two tests have been executed:

The tests receive the same exception from the same place in the code:

Example 2 - Exception Caught by Try-Catch

The following test has been created:

An exception is not detected in the unit test, but it is caught by a try statement for the following line of code:

In this example another exception, shown in the catch statement, is rethrown in the unit test.

UTA detects the caught exception: