While seeded states are immensely useful as you build out your test suite, maintaining a clean testing environment can be a tricky obstacle to navigate. With Rainforest, there are several ways to keep your testing environments clean when testing with seeded states.

Method 1: Use your CI process to reset your DB

For teams that work on a typical 2 week agile sprint, using your CI process to reset your database (DB) after each run is complete is a easy way to ensure a clean testing environment for each run. 

To learn how to reset your DB using your CI tool for Rainforest testing, check out our article on the Rainforest CLI!

Method 2: Use a Rainforest webhook to trigger a DB reset

If your team does not, or has not, adopted a CI tool, another great way to maintain clean testing environments is to reset your database before each triggered by a webhook. While we recommend that simple webhooks be used whenever possible, if your database reset takes longer than approximately 25 seconds, advanced webhooks are also supported. 

If you'd like to learn more about resetting your database using a webhook, check out this guide written by our CTO!

Method 3: Use Single-Use variables

Seeded states are generally setup through the use of tabular variables. To help you maintain clean testing test environments and avoid shared state overlap, it is possible to set your tabular variables to be single-use variables. Once enabled, single use variables prevent previously used data from being used a second time by our testers.

To circumvent the necessity of endlessly creating test data, it will still be necessary to reset your DB from time to time. With this method, you would need to reset your DB less and, due to the lower frequency, this can be done manually. 

To note, these three methods for managing seeded states and clean testing environments are not mutually exclusive to one another. If you'd like to discuss the best way for you to do this, please let us know at support@rainforestapp.com.

Did this answer your question?