Select your Language

Test Class Annotation

1.Classes and methods defined as @isTest can either private or public.
2.@istest don't count against apex code limit 6MB.
3. Classes which are defined with @isTest annotation can not be interface or enum
4. Methods of public test class only invoked by running test method
5. Public methods can not called by non test request.
6.@isTest(SeeAllData=True) annotation is used to open a data access level at the class level or methods level. and it is also fetch the custom meta data.because Custom setting and custom meta data is not visible in test class by default
7. @isTest(seeAllData=True) and (@isTest(isParallel=ture) /@TestSetup ) can not use same Apex code
8.@isTest (seeAllData=false) can access only the data it create.
9.@isTest(onInstall=True) this annotation is used for managed or unmanaged package and this annotation specify which apex test methods are executed during the package installation.
10.@isTest(onInstall=false) specify that methods not executed during package installation
11.@IsTest(isParallel=true) Annotation is used for run Apex test class parallel,so execution makes more eficient.
12.@TestSetup Annotation  are used for creating common test records that are available for all test methods in the class. And You can have only one test setup method per test class.the testing framework executes the test setup method first,before any test method in the class.
13.@TestVisible Annotation  to allow test methods to access private or protected members of another class outside the test class and with this annotation there is no need to change the access modifiers it will work as a public access modifiers and it can access methods variable , and inner class also

Reference Web : https://salesforce1991.blogspot.com/

No comments:

Post a Comment