5

I am creating a tool related test class execution scheduler.

Does Salesforce provide any way for the Tooling API to enable or disable Parallel Test Execution?

I want to set this setting by Apex and run every test classes one by one even after someone has changed the setting manually.

Disable Parallel Apex Testing

3

Specifically to your question on "Disable Parallel Apex Testing". No, I don't believe there is currently an official 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.


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.

  • 1
    Do we know a GA date for scratch orgs? They're not available yet, right? – Adrian Larson Jan 11 '17 at 18:48
  • @AdrianLarson Last I heard they were aiming for GA end of 2017 or early 2018. With a public beta before that. Of course, those dates could all change. – Daniel Ballinger Jan 11 '17 at 19:18
  • Thanks @DanielBallinger for such a great descriptive answer. I raised a case regarding same to salesforce.com support team and they told that this API is not available for now. – Rajni kant roy Jan 12 '17 at 12:54
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.