4

Got some unit test failures when I am deploying from sandbox to sandbox.

  • Tests pass in source sandbox
  • Tests pass if I deploy with "NoTestRun" and then run them manually afterwards.

They only fail when I specify "RunLocalTests" as pasrt of the deployment. Says it can't find an applicable approval process - the process definitely exists in the target org and isn't part of the deployment package

Why would a deployment test run be different from a "normal" test run?

Deployment failures

2
  • Are the tests always being run as the same context user?
    – David Reed
    Commented Jan 29, 2021 at 15:07
  • Yup, pretty sure it does - the test creates some users for a "RunAs" pass in the @testSetup method
    – Rob Cowell
    Commented Jan 29, 2021 at 15:30

2 Answers 2

1

Can you check if the Approval Process you are deploying or the ones which are active in the production(target org) have been configured to allow all appropriate "Initial Submitters"? I believe in the recent releases Salesforce has enforced a new restriction, which restricts who can submit to specific approval processes and if you've not configured this, you will get the error message shown in the screenshot.

I would suggest looking in Source and Target Org and go through those Approval Process on which you are getting those errors.

  1. Setup>Approval Processes> Approval Processes and select the object(s) containing active approval processes and click on the relevant Approval Process Name.

  2. From the Edit dropdown select Initial Submitters

  3. Ensure that Record Creator (or expected user) is included in the list of Allowed Submitters

0

I have seen tests pass using the Tooling API and fail when using the Metadata API. Deployments would be using Metadata, could you be testing in lower sandbox using Tooling?

1
  • I'm just testing it out the front end for the manual run, no APIs wielded
    – Rob Cowell
    Commented Jan 30, 2021 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .