llms.txt: machine-readable documentation index. Markdown version of this page is also available.

JetBrains Air Help

Add missing tests to pull requests

A test coverage automation checks whether a pull request's change needs new tests. Refactorings, configuration, documentation, and changes the existing tests already cover usually don't. When tests are needed, it writes them the way the project already tests – unit, integration, or both – confirms that they fail without the change and pass with it, and pushes them to the pull request. When they aren't, it comments on the pull request why.

You build it from the Cover PR with Tests template. This topic also shows how to chain it to a code review, so the review sees the pull request with its tests.

Set up the automation

Create a test coverage automation

  1. On the Automations page, click New Automation. In Instructions, click Use Template and select Cover PR with Tests under By Air.

  2. Select the repository, or its environment configuration if the tests need specific tools or services to run.

  3. In Triggers, add GitHub | Pull request | Opened with the Ignore drafts filter, and set the change handling to Push to source branch. The tests become a commit on the pull request itself.

    A PR opened trigger set to Push to source branch, with its filters shown and Ignore drafts selected

    Add a second trigger, GitHub | Pull request | Moved out of draft, also with Push to source branch. A pull request opened as a draft doesn't fire Opened when it becomes ready for review, so without this trigger it never gets tests.

    To add tests only when someone asks, use Pull request | Labeled with a label such as needs-tests instead.

  4. Click Create.

Review the pull request after the tests are in

If a code review automation also starts on Pull request | Opened, both runs start at once, and the review never sees the tests. Chain them instead: the review starts when the test run finishes, and it gets the test run's summary and links, including the pull request – see Automation chains.

Start the review when the tests are added

  1. Open the code review automation for editing.

  2. In Triggers, delete the pull request triggers – Opened, and also New changes and Moved out of draft if the automation has them. Otherwise the test commit starts a second review, before the test run finishes.

  3. Add an Automation finished trigger, and select the test coverage automation in the Automation field. Keep No code changes.

    An Automation finished trigger row with the automation to wait for selected
  4. Add a sentence at the beginning of the instructions, so the agent knows which pull request to review:

    Review the pull request linked in the previous run's results.
  5. Click Save.

Both automations have to be personal, or both in the same project. A test run that ends with a problem doesn't start the review, so that pull request waits for a person.

27 November 2026