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

Can someone please tell me what all annotations we can use in a test class?

Except @isTest annotation, what all are the annotations that are used in a Test class?
Shruti SShruti S
Other than @isTest, you can use the following annotations as well -
  • @testSetup : Lets say you have five test methods in your test class and in all the 5 test methods you want to create new Account records. In normal case, we would write the code in each test method to create Account records (i.e 5 times we would write the code to create Account records). With the help of this annotation, we can write a common method in which the Account creation would be done and then this method will be automatically invoked in all the 5 test methods. This helps us to remove code duplicacy. Here is its syntax -
    @testSetup static void methodName() {
    You can know more about this here - (" target="_blank)