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

Test Method Data Rollback

I understand that all data created during the execution of test methods is rolled back after the test completes. 


Say you are executing 50 test methods at once.  Does the data roll back after every method, or only once at the end of all 50 methods' execution?







usually, we create test methods in a apex class, and salesforce will create a transaction for every apex class (including apex trigger), that means when you entering the class, the transaction begins, and roallback when you quit.


This does make sense . Say,  you make some creation or modification of an object some where in one test method, and then in anther method you gotta use the new value of this object, in this case, if the data roll back after every method, you won't get a correct result.

This is just my supposition, it's for your inference.

Since I ran across this question today I figured I'd add a reference link.

Rollbacks occur after each test method.