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
Daniel Watson 21Daniel Watson 21 

Unit Testing reset transiant test data.

Hello Devs,

Is there a way to reset all the transiant test data in a unit test class. For instance you tested a few methods of a class, but to test the remaining methods you need/want to start with a clean slate. I want to purge all the fake data in the database.

I know if I keep track of the records I create, I can delete them at the end of a test, but that does not take care of records that are created via triggers, triggers that I am not testing for, and might not be thinking about during this unit.

Thanks!