# Gradle test insights {#gradle-test-insights}

> [!IMPORTANT]
> **Requirements**
>
> - The `dev.tuist` Gradle plugin applied, as described in <.localized_link href="/guides/get-started/gradle-project">Get started with a Gradle project</.localized_link>.

Tuist's Gradle plugin automatically uploads test results after each test task execution, giving you visibility into test performance and flaky tests directly in the Tuist dashboard.

Test insights are collected automatically once the plugin is applied. No additional configuration is needed.

You can access your test insights in the Tuist dashboard and see how they evolve over time:

![Dashboard with test insights](/images/guides/features/build-insights/tests-dashboard.png)

## What is tracked {#what-is-tracked}

The plugin collects results from all Gradle `Test` tasks, including:
- Individual test case pass/fail status and duration
- Test suite and class structure
- Flaky test detection across runs

Turn on <.localized_link href="/guides/features/test-code-coverage/gradle">code coverage</.localized_link> to also upload which code your tests executed.

## Configure upload behavior {#configure-upload-behavior}

By default:
- Test results are uploaded in the background for local builds.
- Test results are uploaded in the foreground for CI runs to avoid losing telemetry on short-lived agents.

You can override this behavior using `uploadInBackground` in the `tuist` block in your `settings.gradle.kts`:

```kotlin
tuist {
    uploadInBackground = false // always upload in the foreground
}
```

### Git history {#git-history}

On CI, the plugin also uploads the commit history of the checkout when it reports a test run: commit SHAs, their parents, commit dates, and the branch the run and its pull request's base branch were on. No file contents, commit messages, or authors are uploaded. It's what tells Tuist which commits landed on your default branch, for example the ones a merge queue tested. The plugin reads the history the checkout already has, and when the checkout doesn't have the base branch, asks the remote for its latest commit (`git ls-remote`). Outside code coverage, it doesn't fetch history. With code coverage, a shallow checkout is deepened, without file contents, to find where a pull request branched off and to reach the commits Tuist already has, so a commit is never uploaded without the parent it sits on.

| Variable | Effect |
| --- | --- |
| `TUIST_GIT_UPLOAD_ENABLED=false` | Doesn't read or upload any Git history. |
| `TUIST_GIT_UNSHALLOW_ENABLED=false` | Reads only the checkout, without contacting the remote. |
