2

Currently in my org there are around 50 test class which just uses Apex mocking framework and has no interaction with database. I have other test classes that is actual Apex test classes(around 1000+). I know tests written using Apex mocks runs quicker since there is no database interaction.

Would adding @isTest(Parallel=True) would make Apex mock test classes more faster? I know using it on test classes that interacts with database can make it faster but the concern is those classes share the same data and can result in failure(UNABLE TO LOCK ROW ERROR). Hence I am exploring this idea only for test that are based on Apex mocks framework.

1 Answer 1

1

You can take this approach.

First, using this default execution options as below, run all the test classes.

Apex test execution option

If you found any failure in the test class due to this parallel running, then select Disable Parallel Apex Testing checkbox.

Then those test classes which don't have clashing, for those use @isTest(Parallel=True), since this overrides the default behavior of Apex test Execution Options.

Use the @isTest(isParallel=true) annotation to indicate test classes that can run in parallel and aren’t restricted by the default limits on the number of concurrent tests. This makes the execution of test classes more efficient, because more tests can be run in parallel.

This annotation overrides the default settings that disable parallel testing. A test class that doesn’t have this annotation is restricted by the default limits on the number of concurrent tests.

8
  • So basically I would need to identify test classes that wont fail if I use Parallel=True? Any thoughts on using it for Apex Mock test classes( I see they are efficient themselves, so not sure if it would make considerable difference)
    – SfdcBat
    Commented Aug 10, 2018 at 12:04
  • exactly, first do run all test classes to get if failure occurs Commented Aug 10, 2018 at 12:05
  • difference will be there if text classes run serially, it will take time for deployment Commented Aug 10, 2018 at 12:06
  • Do i need to check - Disable parallel apex testing , when I have IsParallel= true in some test classes. I believe irrespective of that , it will run in parallel for classes with which has Isparalled=true annotation. Is that correct?
    – SfdcBat
    Commented Aug 10, 2018 at 15:46
  • If no test class fails then dont select the checkbox and no need to put isparallel=true. Because test classes execute parallely always. Commented Aug 10, 2018 at 16:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .