The issue
When running an archiving job it's normal to need to disable a number of triggers and flows in order to make sure automatons are not triggered by the archive.
After the archiving job is run, Gearset then needs to run re-enable these triggers and flows to make sure they are ready for your normal use again.
Salesforce enforces that there must be 75% code coverage of all the items we are enabling.
Gearset's behaviour
By default, Gearset will try to guess what tests will be required and includes them in the deployment.
If this fails to deploy, we will then re-try using all of the tests in your org.
If this fails again you will see an error under your "history tab" as per below.
If you open the details you should be able to see why the last test run failed.
The Resolution
Fix the test failure
The ideal solution is to fix the apex tests that are causing the failure, If you have tests in production that do not pass being run or require a specific scenario to be run this is generally not best practice and will likely cause issues down the line.
For this reason it's always recommended fix your tests.
Specify the tests to run
If you are unable to fix the tests or doing this is going to take a considerable amount of time, then you can overwrite Gearsets test selection and specify the tests you wish to run.
1: In order todo this, you will need to know the exact list of tests that need to be run to re-enable these triggers and flows.
If you are unsure what tests are required, you will need to talk to one of the developers who has worked on the erroring flows and triggers, they should be able to confirm what tests are required.
2: Once you have the required list of apex tests, you need to add this to the policy run.
Open your archiving job and and select the policy facing this error and open the "edit" page for this policy.
Click "continue" in the bottom left until you reach the Automations - Apex tests tab, then change the tests to "specify tests to run".
You can then add your list of tests to run with comma separated values.
Once you have done this you can update the policy to save these settings.
If you no longer face errors you can end here.
3: If you still face an error in the re-activation on your flows and tests you need to look into why the job is failing and address the underlying issues with these tests.
If you are unsure what todo at this step, you can reach out in the In-app chat and we should be able to point you in the correct direction π




