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
Angel30Angel30 

Test Class Statement not clear.

Hi All,

I was reading through the apex guide and i came across the statement which actually i didnt understand.
Could you please explain me that.

"The @isTest annotation can take multiple modifiers within parentheses and separated by blanks."

What does is mean here .An example /scenario would actually help.

Thanks a lot in advance!

Deepshikha
GhanshyamChoudhariGhanshyamChoudhari
Hi,
You can pass all pass multiple modifiers within parentheses and separated by blanks.
eg.
@IsTest(SeeAllData=true OnInstall=true)
Mark as best answer if it helps you.
Thanks,
Ghanshyam Choudhari
NagendraNagendra (Salesforce Developers) 
Hi Shriwas,

Please find the explanation below.

In Apex programming we have different kinds of annotations.anything which is declared using @ then it becomes an annotation. Every annotation internally has an interface to implement.

@isTest is also an annotation which can be used both on apex classes and methods.

As following the basic syntax of method every method can have multiple modifiers or parameters to define.

Example of apex class using @isTest with multiple parameters.
@isTest(SeeAllData=true isParallel=true OnInstall=true)

public class TestDataAccessClass {
//class logic
}
Example of apex class method using @isTest with multiple parameters.
@isTest
public class TestDataAccessClass {
@isTest(SeeAllData=true isParallel=true OnInstall=true)
static void testWithAllDataAccess() {
        // method logic
    }
}
Hope this helps.

Kindly mark this as solved if my reply was helpful so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Thanks,
Nagendra

 
Ajay K DubediAjay K Dubedi
Hi Deepshikha,

As per our requirement we can pass more than one  modifiers in @isTest annotation
The @isTest annotation can take multiple modifiers within parentheses and separated by blanks it means that - .
You can make multiple modifiers within parentheses and separated by blanks.
eg.
    @IsTest(SeeAllData=true OnInstall=true isParallel=true) you can can use within Test class or methods. 
if you found this answer helpful then please mark it as best answer so it can help others

Thanks,
Ajay Dubedi