--- title: "Understanding Cleanup Steps in Autify | Autify Guide" slug: "cleanup-steps" description: "Learn How to Effectively Implement Cleanup Steps for Efficient Test Automation Management in Autify. Start Your Free Trial!" updated: 2023-09-22T05:44:23Z published: 2023-09-22T05:44:23Z canonical: "help.autify.com/cleanup-steps" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # Cleanup Steps ⚠️ Cleanup Steps are available on Advanced, Enterprise, or any other equivalent plans. ## Overview Cleanup Steps are special steps that always run at the end of test execution even when the scenario failed in the preceding steps. This is very useful when you have steps that need to be run when the test finishes regardless of the result, such as deleting data generated during the test so that the next test will run under the same conditions. ## Enable Cleanup Steps Cleanup Steps can be added to existing scenarios, however, they are hidden by default. To enable the feature, open the Options tab on the scenario details page and check Show Cleanup Steps. ![Screen Shot 2023-08-27 at 21.30.58.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-08-27%20at%2021.30.58.png?sv=2026-02-06&spr=https&st=2026-11-08T18%3A56%3A05Z&se=2026-11-08T19%3A56%3A05Z&sr=c&sp=r&sig=T9Zjt5lf0e9dMvzKyGsO5L8CRUT5viyS%2FTddBVEG304%3D) When you go back to the Scenario tab, the Cleanup Steps section is added to the bottom of the screen. ![Screen Shot 2023-08-27 at 21.31.16.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-08-27%20at%2021.31.16.png?sv=2026-02-06&spr=https&st=2026-11-08T18%3A56%3A05Z&se=2026-11-08T19%3A56%3A05Z&sr=c&sp=r&sig=T9Zjt5lf0e9dMvzKyGsO5L8CRUT5viyS%2FTddBVEG304%3D) ## Create Cleanup Steps Cleanup Steps can be created in two ways: ### Drag and drop existing steps to mark them as Cleanup Steps If you already have steps in the scenario that can be used as Cleanup Steps, you can drag and drop them into the Cleanup Steps area. ![Screen Shot 2023-09-15 at 11.05.25.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-09-15%20at%2011.05.25.png?sv=2026-02-06&spr=https&st=2026-11-08T18%3A56%3A05Z&se=2026-11-08T19%3A56%3A05Z&sr=c&sp=r&sig=T9Zjt5lf0e9dMvzKyGsO5L8CRUT5viyS%2FTddBVEG304%3D) ### Record new steps as Cleanup Steps Alternatively, you can also record Cleanup Steps from scratch. Note that the recording starts from the URL specified in Step 1 of the scenario. If you would like to start recording from a different URL, add a Go To step to the beginning of the Cleanup Steps. ![Screen Shot 2023-09-15 at 11.04.43.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-09-15%20at%2011.04.43.png?sv=2026-02-06&spr=https&st=2026-11-08T18%3A56%3A05Z&se=2026-11-08T19%3A56%3A05Z&sr=c&sp=r&sig=T9Zjt5lf0e9dMvzKyGsO5L8CRUT5viyS%2FTddBVEG304%3D) ## Run a scenario with Cleanup Steps Scenarios with Cleanup Steps can run just as regular scenarios. However, how the steps will be run is different. ### Scenario In the following example where Step 1 - 3 are regular steps (with the setting `When this step fails: Abort`) and Step 4 - 5 are Cleanup steps: - If successful, the steps will be run in the order of `1` → `2` → `3` → `4` → `5` - If the scenario fails at Step 2, it will continue to run `1` → `2` → `4` → `5` ![Screen Shot 2023-09-06 at 15.50.52.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-09-06%20at%2015.50.52.png?sv=2026-02-06&spr=https&st=2026-11-08T18%3A56%3A05Z&se=2026-11-08T19%3A56%3A05Z&sr=c&sp=r&sig=T9Zjt5lf0e9dMvzKyGsO5L8CRUT5viyS%2FTddBVEG304%3D) ### Results The test result details page is divided into two parts: regular steps and Cleanup Steps. Here are some examples: #### Successful test result ![Screen Shot 2023-09-14 at 15.52.07.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-09-14%20at%2015.52.07.png?sv=2026-02-06&spr=https&st=2026-11-08T18%3A56%3A05Z&se=2026-11-08T19%3A56%3A05Z&sr=c&sp=r&sig=T9Zjt5lf0e9dMvzKyGsO5L8CRUT5viyS%2FTddBVEG304%3D) #### Failed test result with Cleanup Steps run Even if regular steps failed in the middle, Cleanup Steps will run. ![Screen Shot 2023-09-14 at 16.24.04.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-09-14%20at%2016.24.04.png?sv=2026-02-06&spr=https&st=2026-11-08T18%3A56%3A05Z&se=2026-11-08T19%3A56%3A05Z&sr=c&sp=r&sig=T9Zjt5lf0e9dMvzKyGsO5L8CRUT5viyS%2FTddBVEG304%3D) #### Failed test result with Cleanup Steps failure It's also possible that Cleanup Steps may fail in the test. The test is considered to have failed, but the error message area is highlighted in yellow so that it's easy to make a distinction from a regular steps failure. ![Screen Shot 2023-09-14 at 16.25.14.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-09-14%20at%2016.25.14.png?sv=2026-02-06&spr=https&st=2026-11-08T18%3A56%3A05Z&se=2026-11-08T19%3A56%3A05Z&sr=c&sp=r&sig=T9Zjt5lf0e9dMvzKyGsO5L8CRUT5viyS%2FTddBVEG304%3D) ## Tips ### Add Go To steps at the beginning Cleanup Steps can work without a starting URL specified. Make sure to add a Go To step at the beginning if you want to make sure that Cleanup Steps start from a specific URL. ### Prepare an API endpoint to clear data One of the best practices to clean up data created during tests is to prepare an API endpoint that clears your test data that can be called from a JS Step. Alternatively, you can simply record steps to delete or recover data by interacting with your application. Note Since this is an advanced feature provided for Advanced, Enterprise, or equivalent plans, Cleanup Steps will be hidden if you downgrade your contract plan to one where Cleanup Steps are not available.