What qualifies as running a test synchronously?

This Limits Documentation mentions:

Total number of test classes that can be queued per a 24-hour period (5) – The greater of 500 or 10 multiplied by the number of test classes in the organization

with the caveat that

This limit applies to tests running asynchronously. This includes tests started through the Salesforce user interface including the Developer Console or by inserting ApexTestQueueItem objects using SOAP API.

  1. What qualifies as running a test synchronously?
  2. How can I ensure that my team members working concurrently in a sandbox do not exceed the AsyncApexTests Limit while building, refining and executing unit tests? (This quickly brings test development to a grinding halt.)
  3. Does running tests via the Eclipse “run tests” menu option kick off an async or synchronous test run?

An update that is a bit like an answer:

If you need to run a unit test synchronously, you can do so in the developer console’s run tests UI by selecting just a single class to run. Selecting two or more classes will execute them asynchronously.

This makes receiving the AsyncApexTests Limit exceeded exception a little bit more bearable and less blocking.

The Developer Console runs tests asynchronously in the background, unless your test run includes only one class and you’ve not chosen Always Run Asynchronously in the Test menu.



Ive a few references for you Mark.

From here

Tests started using Run All Tests or Run Test no longer run
synchronously. When you run tests by clicking Your Name > Setup >
Develop > Apex Classes
, and then either click Run All Tests from the
Apex Classes page or Run Test from a class page, your test results are
displayed in the Apex Test Execution page and the Developer Console
This means that you won’t be blocked by the test run; you can do other
work in the Salesforce user interface and you can access the Apex Test
Execution page at a later time to verify if the tests have completed

All tests started through the Salesforce user interface now
run asynchronously. Tests that are run as part of a deployment, a
package install, or a package upload still run synchronously.

From here:

You can use the runTests() call from the SOAP API to run tests

RunTestsResult[] runTests(RunTestsRequest ri)

This call allows you to run all tests in all classes, all tests in a
specific namespace, or all tests in a subset of classes in a specific
namespace, as specified in the RunTestsRequest object.


Based on the links above, tests can be run from the following places:

  • The Salesforce user interface – asynchronously
  • The Force.com IDE – synchronously
  • The Force.com Developer Console – asynchronously
  • The API – synchronously
  • As part of a deployment, a package install, or a package upload – synchronously
  • By inserting records into the ApexTestQueueItem table – asynchronously

Source : Link , Question Author : Mark Pond , Answer Author : BarCotter

Leave a Comment