function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matthew P CraigMatthew P Craig 

What is the default value of @isTest(isParallel) and impact on settings.

I see that we can set Apex unit test with an annotation of @isTest(isParallel=true). That is awesome. However I'm requesting some clarification on its functionality.
  1. What is the default value? (I assume false... but don't like to assume)
  2. If I select a group of tests and indicate to SF that I want those tests to run in parallel, do I have to explicity set that to FALSE inorder to preform specific tests in serial? (or do they all run in parallel because I requested it)
  3. If I select a group of tests and indicate I want them run in serial, if isParallel set to TRUE does it over ride and still run in parallel?
Basically I want to understand the dynamics of isParallel before implementing in a LARGE project, that for years has run in serial. It has some tests that do NOT work in parallel, however we want to get the best possible performance out of the tests that can. So our HOPE is that we can tell Salesforce to run all tests in parallel, except the few that cannot, and run those in serial.  Is this the right feature to enable or set this.

Thanks in advance.

 
Marcelo CostaMarcelo Costa
Hey Matthew...
You are right,
the default for that value is really false.
As it is a new feature I have not seen it in action, but I will share my experience with big projects and parallel test execution:
Pain.
What I realized from the documentation, this annotation overrides the default org setting (when parallell execution of tests is turned off).
This way we can specify which test classes are safe for parallell processing. What we usually get on big implementation is the UNABLE_TO_LOCK_ROW for testclasses that uses the same objects.
This will enable to have some testclasses that are marked as " safe" to actually run in parallell and the others will be executed sequentially.
If anyone has more info on that will be helpful :)
Best Regards!
Suresh Kumar Arjunan1Suresh Kumar Arjunan1
I'll add my cents here based on my understand:

To your point "Run all tests in parallel, except the few that cannot, and run those in serial."
-  No this won't be helpful, if you do "Run All Tests" through ANT script then it won't work. 
Ajeeth Kumar SAjeeth Kumar S

Hi Matthew P Craig,

Please refer the Link.It will helpfull for you.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_isTest.htm

It is helpfull for you please mark my answer.

 

Thanks!..