Control the degree of parallelism when running apex tests in parallel - Ideas - Salesforce Trailblazer Community
Trailblazer Community

All Ideas

Idea Details

Post an Idea
280  Points
Idea has been posted. Give it an upvote or downvote.

Control the degree of parallelism when running apex tests in parallel

Development (Apex, LWC & VF)

Currently when Apex tests are run in parallel there is no control over how many tests run at any one point in time. 

Using the following SOQL query against the Tooling API I've observed around 30 tests running simultaneously (Summer '18).
Select Id, ApexClassId, Status, ExtendedStatus, ParentJobId, TestRunResultId, ShouldSkipCodeCoverage from ApexTestQueueItem where Status = 'Processing'
With larger orgs that are more complex this can often result in UNABLE_TO_LOCK_ROW and "connection was cancelled here" errors. Disabling parallel testing is one way to avoid this problem, but it can greatly increase the time required to run all the tests in an org.

Instead, allow the degree of parallelism in testing supported by the org to be configured. If the number of supported threads could be reduced to, say, 2 tests running at any point in time then the odds of locking/race conditions could be greatly reduced while still allowing for a greater throughput of test classes.

Merge Idea · Flag

  • Upvotes
  • Downvotes



from AppExchange


No results found.

Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.