Unit testing automation jobs in Gearset track Apex unit test results (pass/fail) and code coverage across your chosen orgs on a daily basis. You can configure notifications to be sent if tests start failing or code coverage drops below a set threshold.
Creating a unit testing job in Gearset
Please note, before creating an automated unit testing job, you first need to have added a connection to at least one of your Salesforce orgs.
Once you have at least one org connected, follow these steps:
Navigate to the Unit testing page, found under
Automationin the nav menu on the left.
ADD NEW JOB....
Choose the days of the week you want the job to run
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 drop-down menu.
Specify a minimum % code coverage limit.
(Optional) Specify any namespaces you want to include in the job. By default, unit test jobs will not run tests from managed packages. If you want to run managed package tests, enter their namespaces in this box.
Saveto create the test job.
Setting job notification preferences
You can configure notifications for your unit 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
Edit job... in the
ACTIONS column on the Unit testing dashboard.
Follow these steps:
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 address(es) to which you want job status notifications sent.
If required, create additional notifications. Gearset supports SMS notifications (US, UK and Australia only), Slack and Microsoft Teams integration via webhooks, and Chatter integration straight into your org.
Saveto update your notification settings.
An overview of all your test jobs
All automated unit testing jobs are listed on the Unit testing dashboard. You can see the outcome of the most recent test run (e.g.
Tests passed or
Tests failed), 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 results to see the daily results and inspect any test failures:
Viewing test failure details
View results to see the
Test run details page, which 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 filtered view by clicking on the date range drop-down menu above the results table.
Want to know more about the unit testing in Gearset? Click here.