Activity Forums Salesforce® Discussions What is the use of @testsetup method in Salesforce?

  • MOHIT

    Member
    February 19, 2020 at 6:19 am

    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 4 years, 1 month ago by  Forcetalks.
  • Ratnesh

    Member
    February 19, 2020 at 1:32 pm

    This annotation is used for creating common test records that are available for all test methods in the class.

    • This reply was modified 4 years, 1 month ago by  Forcetalks.
  • Marziya

    Member
    February 19, 2020 at 1:39 pm

    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 4 years, 1 month ago by  Forcetalks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos