CoverBot is in beta. Reach out to your Tusk rep or support@usetusk.ai to get access.

Overview

Tusk CoverBot runs as a scheduled daily or weekly cron job and generates unit tests for recently modified files with low line coverage.

Think of this as Dependabot but for increasing unit test coverage across your repo. Go from 0 to 100% code coverage over time with minimal effort.

CoverBot is complementary to the Tusk CI workflow which is triggered per commit to a PR. This feature is best suited for engineering organizations that have set unit test coverage goals.

Requirements

You need the following to begin using CoverBot:

  • Team Plan and up
  • Enabled repo in Tusk
  • Working Tusk test execution environment

If you are already using Tusk to generate unit tests via CI, you meet all the requirements.

Reach out to the Tusk team via Slack or at support@usetusk.ai with your CoverBot schedule in mind (e.g., every Monday at 9am Pacific Time) to enable the feature.

How CoverBot Works

CoverBot is an async workflow so it is fully hands-off for your engineering team.

1

Navigate to CoverBot page

Go to Repositories > Repo Settings > CoverBots to view and manage your existing CoverBots for the repo. If you haven’t yet received access to create your first CoverBot, reach out to Tusk support

2

Add new CoverBot

Click Add CoverBot. Fill out the following fields:

  • Bot name
  • Test execution environment
  • Schedule for day(s) and time to run
  • Max no. of symbols to generate tests for
  • Default reviewers (optional)
  • File patterns for files/directories to focus on (optional)

Make sure to toggle on the CoverBot after creating it.

3

Creates branch

At your pre-determined schedule (daily or weekly at set time), CoverBot creates a branch off of your default branch.

If you want to see CoverBot’s test generation output before your next scheduled run, click the ellipsis icon on your CoverBot card and click Run Now.

4

Analyzes code coverage

CoverBot runs a coverage script and finds recently modified files that have low line coverage.

5

Backfills unit tests

CoverBot generates unit tests for the files and iterates on them to make sure they are passing and fully executable.

6

Creates PR/MR

CoverBot creates a PR/MR with the line/branch coverage gains and test case details in the PR/MR description.

If no tests are generated, CoverBot deletes the branch from Step 1.
7

Assigns PR/MR reviewer

CoverBot assigns the PR/MR to the engineer or group who is in charge of reviewing Tusk PRs. You can modify the default reviewer in the CoverBot settings panel.

8

Review and merge PR/MR

Assigned engineer reviews the PR/MR, approves, and merges the tests if no changes required. Otherwise, they check out the branch and make modifications before merging.

CoverBot is triggered on a test execution environment level. For example, if you’ve enabled CoverBot for two separate environments (e.g., frontend unit tests, backend unit tests), the bot will raise 2 separate PRs.

FAQs