Tooling API - Enable/Disable Parallel Test Execution?

Perhaps it would help you to look at the Force.com Tooling API documentation, specifically on REST Resources. There are some URIs listed that look useful to you:

  • /runTestsSynchronous/
  • /runTestsAsynchronous/

There is a lot of detail in the documentation around these resources, too much to quote fully here. But they seem to provide an avenue to achieve what you are looking for.


Specifically to your question on "Disable Parallel Apex Testing". No, I don't believe there is currently an official method in the Tooling API that exposes this setting.

That said, with Salesforce DX Scratch orgs we are being told that it will be possible to fully configure the org from a config file. That would imply a way to toggle all these otherwise unexposed settings.

Update: (via @bufuda) The ApexSettings for a scratch org now include a enableDisableParallelApexTesting setting that:

Indicates whether Apex tests are serially executed (true) or not (false). The default value is false.

There is an article from Bob Buzzard on doing a deploy to update the setting after the org has been created. Note that this is via the Metadata rather than Tooling API.


If you want to go with the unsupported route there you can use the Chrome developer tools to see exactly how that setup page works.

**Request URL:**https://abc.salesforce.com/_ui/common/apex/test/ApexTestQueueServlet
Request Method: POST

Form Data
action: SET_OPTIONS
onlyStoreAggregateCoverage: false
disableParallelApexTesting: true
testAutonumber: false

You could quite easily replicate that POST request (including the sid cookie). If you do so, know that it could break at any point as it isn't an official API.