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.
- Navigate to the Unit testing jobs page, found under Automated jobs in the nav menu on the left
- Click Add new job...
- Choose the time you want the job to run each day
- Give the job a descriptive name (e.g. Production tests)
- Select the org you want to run the tests on from the dropdown
- (Optional) Specify a minimum % code coverage limit
- (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
- 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.
- Select the Notification settings tab
- 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
- Enter the email addresses you want job status notifications sent to
- Gearset also supports SMS notifications (UK and US only), Slack and Microsoft teams integration via webhooks and Chatter integration
- 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