> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trunk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Test Collections

> Group tests into named collections, each with its own flake detection, quarantining, and ticketing settings.

A test collection is a named group of tests with its own settings. Each collection has independent flake detection, quarantining, and ticketing, so you can hold fast unit tests and fragile end-to-end tests to different standards.

You create a collection in the Trunk app, then point a CI job at it by passing the collection's ID to the uploader.

<Frame caption="A collection's Overview tab, once test results are flowing.">
  <img className="block dark:hidden" src="https://mintcdn.com/trunk-4cab4936/lgNnEjVrxbCUbMeu/assets/flaky-tests/get-started/collection-overview-light.png?fit=max&auto=format&n=lgNnEjVrxbCUbMeu&q=85&s=b6098de93de890e13229fdaff7f0220d" alt="The Overview tab of a collection named trunk2-pr-e2e, showing its Collection ID, flaky and broken test counts, PRs impacted, three daily charts, and the top ten most unstable tests." width="2928" height="1666" data-path="assets/flaky-tests/get-started/collection-overview-light.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/trunk-4cab4936/lgNnEjVrxbCUbMeu/assets/flaky-tests/get-started/collection-overview-dark.png?fit=max&auto=format&n=lgNnEjVrxbCUbMeu&q=85&s=da017da29ff20778bd33ae7e4386c16c" alt="The Overview tab of a collection named trunk2-pr-e2e, showing its Collection ID, flaky and broken test counts, PRs impacted, three daily charts, and the top ten most unstable tests." width="3016" height="1662" data-path="assets/flaky-tests/get-started/collection-overview-dark.png" />
</Frame>

## Collections and repositories

Collections and repositories are many-to-many. A collection can include tests from multiple repositories, and a repository can be broken into multiple collections. This is decided by which collection you specify at upload time.

<Frame>
  <img src="https://mintcdn.com/trunk-4cab4936/lgNnEjVrxbCUbMeu/assets/flaky-tests/get-started/test-collections-and-repositories.svg?fit=max&auto=format&n=lgNnEjVrxbCUbMeu&q=85&s=10123847913a09b666ac2cf216a33137" alt="Three repositories uploading into two collections: the api repository sends its unit tests to one collection and its end-to-end tests to another, while the unit test collection also receives uploads from the web repository." width="760" height="330" data-path="assets/flaky-tests/get-started/test-collections-and-repositories.svg" />
</Frame>

## The Collection ID

Every collection has an ID: eight alphanumeric characters, unique across all of Trunk. It appears in the collection's URL, on the collection's page header, and in the **ID** column of the collections list, each with a button to copy it.

```text theme={"system"}
https://app.trunk.io/flaky-tests/collections/<collection-id>
```

The ID is what CI needs. Nothing else about a collection is used to route uploads.

## Create a collection

Any member of your organization can create a collection.

Enter a **Collection name**, and a description if you want one. Your first collection is created from the form Flaky Tests opens on; later ones from **Create collection** in the actions menu on the collections list.

You land on the new collection. Its **Uploads** tab opens when an upload arrives; **Tests** waits until those results are ingested.

## What a new collection starts with

A new collection starts with five monitors, so detection works as soon as test results arrive.

| Monitor | Configuration | Action |
| - | - | - |
| Pass-on-retry | 1 retry, 7 day resolve, every branch | Classify as flaky |
| Failure count | 5 failures, 7 day resolve | Classify as flaky |
| Failure rate | 90% over 24 hours, 5 sample minimum | Classify as broken |
| New test | 7 days | Apply the **New** label |
| Skipped test | 24 hour window, 7 day resolve | Apply the **Skipped** label |

Every monitor but pass-on-retry watches `main`, `master`, `develop`, `dev`, and `release/*`. A collection has no repository until its first upload, so check those branch names against your own.

[Quarantining](./quarantining/) also starts enabled, with auto-quarantine off, so nothing is quarantined until you turn auto-quarantine on or set an override on a test. While your organization is [migrating](./get-started/migrate-to-test-collections), it starts off instead, because your repositories' settings are still governing uploads.

You can change any of it from the collection's **Monitors** and **Settings** tabs.

## Upload test results to a collection

Pass the collection ID to the uploader alongside your organization slug. Both are required:

```bash theme={"system"}
./trunk-analytics-cli upload \
  --junit-paths "test_output.xml" \
  --org-url-slug <TRUNK_ORG_URL_SLUG> \
  --test-collection-id <COLLECTION_ID> \
  --token $TRUNK_API_TOKEN
```

You can set the ID as the `TRUNK_TEST_COLLECTION_ID` environment variable instead, or pass it as the `test-collection-id` input to the [uploader action](./get-started/ci-providers/github-actions).

Everything else about your setup is unchanged. Adding the collection ID to a working upload step is the whole change. See [**Test Frameworks**](./get-started/frameworks/) and [**CI Providers**](./get-started/ci-providers/) for the setup itself, and the [**CLI reference**](./reference/cli-reference#test-collections) for the full flag list.

<Note>
  A CI job uploads to exactly one collection. To send results to more than one collection, add an upload step per collection.
</Note>

## Collection tabs

| Tab | What it holds |
| - | - |
| **Overview** | Setup instructions before results arrive; the collection's dashboard afterwards. |
| **Tests** | Every test in the collection, with health status, failure rates, and labels. |
| **Uploads** | Upload history for the collection. |
| **Quarantining** | Quarantine analytics for the collection. |
| **Monitors** | The collection's [flake detection monitors](./detection/). |
| **Settings** | The collection's name and description, [quarantining](./quarantining/), upload handling, and [ticketing](./management/ticketing/automatic-ticketing). |

## Finish setting up a collection

Each collection has a setup checklist, on its **Overview** tab before results arrive and on its **Settings** tab permanently. It tracks five steps:

1. **Send your first upload**
2. **Ingest your test results**
3. **Review flake detection**
4. **Review quarantining**
5. **Review ticketing**

The first two complete on their own once uploads are flowing. You complete the last three yourself, from the **Monitors** tab, **Settings → Quarantining**, and **Settings → Ticketing**. If you are not using ticketing, say so and that step is complete.

Ticketing may already be done. Connections belong to your organization, so another collection may have set one up.

## Permissions

| Action | Admin | Member |
| - | - | - |
| View collections | Yes | Yes |
| Create a collection | Yes | Yes |
| Create, edit, delete, or mute a monitor | Yes | Yes |
| Connect, copy, or remove an organization ticketing integration | Yes | Yes |
| Choose a collection's default ticketing connection | Yes | Yes |
| Create, link, or unlink a ticket | Yes | Yes |
| Edit a collection's name or description | Yes | No |
| Change quarantining settings | Yes | No |
| Accept uploads from forked pull requests ([set up](/flaky-tests/get-started/fork-pr-uploads)) | Yes | No |
| Delete a collection | Yes | No |

## Delete a collection

Only organization admins can delete a collection.

1. Open the collection's **Settings** tab.
2. Click **Delete collection**.
3. Confirm in the dialog.

The collection disappears from the collections list. Test results already uploaded to it are not deleted.

## Questions

Ask us in [Slack](https://slack.trunk.io) or email [support@trunk.io](mailto:support@trunk.io).
