Options for maintaining a clean testing environment
A seeded state is having the environment a tester is accessing already have the data they need to complete a test before they start executing the test. Seeding data into your pre-production environments allow tests to complete faster while using less steps.
Seeded states are immensely useful as you build out your test suite and 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 staging environment Database
For teams that work on a typical 2-week agile sprint, using your CI server to reset your database (DB) after each run is complete is an 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 using 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
To help you maintain clean testing test environments and avoid tester overlap, it is possible to set your tabular variables to be single-use variables.
A single-use variable is a variable that is only used once as opposed to over and over like normal tabular variables. The single-use variables will be consumed as you execute tests. If there are not enough single-use variables for a run to execute, the run will error. If a run is in progress and more single-use variables are needed, the run will error out.
Using single-use variables, you can create the test data you need and oftentimes need to reset your staging environment DB less.
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 firstname.lastname@example.org.