Activity › Forums › Salesforce® Discussions › What is the use of @testsetup method in Salesforce?
-
What is the use of @testsetup method in Salesforce?
Posted by Shubham on February 18, 2020 at 4:53 PMWhat is the use of @testsetup method in Salesforce?
Marziya replied 6 years, 2 months ago 4 Members · 3 Replies -
3 Replies
-
Methods defined with the @testSetup annotation are used for creating common test records that are available for all test methods in the class.
Test setup methods are defined in a test class, take no arguments, and return no value. If a test class contains a test setup method, the testing framework executes the test setup method first, before any test method in the class. Records that are created in a test setup method are available to all test methods in the test class and are rolled back at the end of test class execution. If a test method changes those records, such as record field updates or record deletions, those changes are rolled back after each test method finishes execution. The next executing test method gets access to the original unmodified state of those records.-
This reply was modified 6 years, 2 months ago by
Forcetalks.
-
This reply was modified 6 years, 2 months ago by
- [adinserter block='9']
-
This annotation is used for creating common test records that are available for all test methods in the class.
-
This reply was modified 6 years, 2 months ago by
Forcetalks.
-
This reply was modified 6 years, 2 months ago by
-
TestSetup Annotation. Methods defined with the @testSetup annotation are used for creating common test records that are available for all test methods in the class.
-
This reply was modified 6 years, 2 months ago by
Forcetalks.
-
This reply was modified 6 years, 2 months ago by
Log In to reply.