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
Requirements before you create a unit testing job:
You'll first need to have added a connection to at least one of your Salesforce orgs before a unit testing job can be set up.
Teams with Deployment Teams and Automation Starter or above can now create team-shared unit testing jobs.
Once you have at least one Salesforce org connected to your Gearset account, follow these steps:
Navigate to the Unit testing dashboard, found under
Automation > Unit testing
in the navigation menu on the left.Click
Add new job...
(top right corner).Choose the days of the week you want the job to run.
βNote: the days of the week highlighted in blue are the days when your unit testing job will run! (e.g. Monday, Wednesday and Friday - as on image below).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 - you can select the org from a 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, add their namespaces in this box:
Include tests from namespaces
.Click
Save
to 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 afterward by clicking on and then on your Unit testing dashboard.
To set up job notification settings, follow these steps:
Select the
Notification Settings
tab.Send notifications - choose whether you get notified
after every run
, irrespective of the result, oronly when tests fail or the level of code coverage has dropped below 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.
Click
Save
to 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 history
to see the daily results and inspect any test failures:
Viewing test failure details
Once you've clicked on View history for a specific unit testing job, select View results
(under Actions column
):
This will prompt you to the Test run details
page which lists all tests run, with a breakdown of failed, skipped and passed tests.
Clicking on a Failed tests
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 drop-down menu next to Last 30 days
tab:
Some of our pre-defined options allow you to preview test history for the last 7 days, 10 days, 30 days, all the history for all the unit testing jobs, or you can select your custom date range.
Common gotcha
Some users encounter the following tool-tip when attempting to run a job:
There are two main scenarios at play, the first being the most common:
The user attempting to run the job hasn't been delegated validation access to do so. To resolve this, have the owner of the job confirm that access in their Salesforce connections has been granted.
The org that the job is running on has been converted to a team-shared org. To resolve this, a team owner should recreate the job to include the team-shared connection.
FAQs
Is it possible to share a unit testing job with other team members?
Is it possible to share a unit testing job with other team members?
Gearset users don't need to share their unit testing jobs with other members.
It's because other members on your Gearset team will be able to preview your unit testing job on their Unit testing dashboard.
β
In addition to that, if you'd like to share the results of your unit testing job(s) with people who are not members of your Gearset team - you can configure email notifications to be sent to anyone who needs to have access to such details.