Test automation jobs in Gearset track test results (pass/fail) and code coverage across your orgs on a daily basis. You can configure notifications if tests start failing, or code coverage drops below a set threshold.

Creating a unit testing job in Gearset

Before creating an automated unit testing job, you first need to have added a connection to at least one of your Salesforce orgs.

  1. Navigate to the Unit testing jobs page, found under Automated jobs in the nav menu on the left
  2. Click Add new job...
  3. Choose the time you want the job to run each day. (The first run will occur after the job is initially saved, subsequent runs will happen at this time.)
  4. Give the job a descriptive name (e.g. Production tests)
  5. Select the org you want to run the tests on from the dropdown
  6. (Optional) Specify a minimum % code coverage limit
  7. (Optional) Specify any namespaces you want to include in the job. By default, test jobs will not run tests from managed packages. If you want to run managed package tests, enter their namespaces in this box
  8. Click Save to create the test job

 Setting job notification preferences

You can configure custom notifications for your test jobs. For example, Gearset can send you an email when your tests start failing. You can set notifications either during job creation, or afterwards by clicking the pencil icon in the Actions column on the test monitoring page.

  1. Select the Notification settings tab
  2. Choose whether you get notified after every test run, irrespective of the result, or only when tests fail or the level of code coverage has dropped below the specified threshold
  3. Enter the email addresses you want job status notifications sent to
  4. Gearset also supports SMS notifications (UK and US only), Slack and Microsoft teams integration via webhooks and Chatter integration
  5. Click Save to update your notification settings

Viewing an overview of all your test jobs

All automated unit testing jobs are listed on the test monitoring overview. The test overview displays the outcome from the most recent test run, current code coverage percentage, and the desired level of coverage specified when the job was created.

Viewing test run history for a job

A complete history of all previous runs is maintained for every job. This includes the number of tests run, skipped, passed, failed, and changes in your code coverage. Click on View history to see the daily results and inspect any test failures.

Viewing test failure details

The test run details page lists all tests run, with a breakdown of failed tests and passed tests. Clicking on a failed test displays the error message returned from Salesforce as well as a full stack trace for easier debugging.

Filtering test run history by date

By default, the test run history will display results from the last 30 days. You can change this filter view by clicking on the date range above the results table.

Want to know more about the unit testing in Gearset? Click here

Did this answer your question?