gradle Verified current stable Not installed? Build Tools

Gradle / Run Tests With Detailed Output

Run Tests With Detailed Output

Runs Gradle tests with optional detailed output for debugging.

$
Terminal
gradle test -i

When To Use

During development to identify and troubleshoot test failures with greater verbosity.

Pro Tip

Use the --scan flag to generate a detailed build scan file for deep analysis of test performance and behavior.

Anatomy of Output

Understanding the result

Test execution finished: 4 tests completed successfully. Test Summary

Indicates the total number of tests executed and their outcome.

> Task :test Executing Test Task

Indicates that the test task is currently being executed.

FAILURE: Build failed with an exception. Build Failure

Confirms that a test failed, prompting further investigation.

Power User Variants

Optimized versions

gradle test -i --rerun

Rerun tests immediately after the last execution to ensure stability.

gradle test --info --stacktrace

Display stack traces for easier debugging when tests fail.

Troubleshooting

Common pitfalls

FAILURE: Build failed with an exception.

Solution: Check the build.gradle file for errors in configuration or dependencies.

Error: Test run failed due to missing dependencies.

Solution: Ensure all dependencies are correctly specified in build.gradle and synced.

Error: No tests found for given task ':test'.

Solution: Verify that test classes are correctly annotated and located.

Command Breakdown

What each part is doing

gradle
Base Command
The executable that performs this operation. Here it runs Gradle before the shell applies any redirect operators.
-i
i| info
The value supplied for i| info.
-i
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative build tools tools for the same job.