Apex unit tests @Istest(IsParallel=true)… sometimes.

By default the unit tests on the Salesforce platform will execute in serial. This can be very slow… and nobody likes a slow feedback loop. You need to run tests during development, testing, change sets, and package uploads.

The Apex Test Execution UI actually provides an option to run all tests in parallel mode. But this has some drawbacks.

The biggest drawback is that parallel tests can lead to UNABLE_TO_LOCK_ROW errors (resource competition). Then you must re-run the failures in serial to see them pass.

A second drawback is that this setting does not affect change set deployment or package upload. This is a major bottleneck when trying to publish a large package or project with many unit tests. For a non-trivial ISV package, a 1–3h version upload time is normal (even if only 1 line changed between versions).

In Winter ’18, Salesforce re-released an attribute called “IsParallel”. It can be used to flag test classes for parallel safe execution. I took it upon myself to test the capabilities of this new feature.


First, it can be useful in solving the row lock issue. Mark all tests as “@Istest(IsParallel=true)” and then run them. Those that fail for UNABLE_TO_LOCK_ROW can be reverted. As a side note, you’ll want to keep the “Disable Parallel Apex Tests” checkbox marked. This ensures the classes you reverted can continue running in serial.

However, this does not solve the problem with change set deployment or package upload. The IsParallel attribute is completely ignored, leaving those actions to run in serial.

In Summary, the @Istest(IsParallel=true) attribute seems great in theory… but it doesn’t work where we need it most.