Skip to main content

Post-test cleanup in Automated Testing

Written by Callum Whitfield

You can now enable automatic record cleanup after a test run. When enabled, records created during a team run will be moved to the Salesforce recycle bin.

When to enable test cleanup

Enabling test cleanup can be useful if:

  1. Test records are taking up storage and impacting performance.

  2. You want to create the same record each time and you have duplicate validation rules.

Enabling test cleanup

Enable test cleanup from Test settings in the side panel of the test builder. Next time the test runs, records created during the run will be automatically deleted. No records are deleted when the test runs from the test builder.

Note: Test data cleanup is disabled by default.

Viewing deleted records

You can see which records were deleted from the test run results page. The cleanup step is displayed at the end of the steps list. You’ll be able to see the object type and record ID for each deleted record.

Frequently Asked Questions

Does the cleanup still run if the test fails?

Yes, the cleanup will run at the end of the test regardless if the test passed or not.

Will this delete or revert records edited in the test run?

No, we only delete records which have been created during the run directly.

Can I turn this on for some tests and have it off for others?

Yes, the setting is at the individual test level.

Does this delete records created in reusable tests?

Yes, if a record is created in a reusable test which is ran as a part of an test with cleanup enabled, it will also be cleaned up.

Did this answer your question?