Environments are named groups of variables that can be applied to test runs in the SnapTest extension. They give you flexibility and scalability when working on teams, with multiple servers, or a large amount of changing test data.
Let's say you develop your web application on a local url at:
localhost:3000. When you start recording your tests in the extension, the
baseUrl will be auto-generated as follows:
SnapTest created the standard
baseUrl variable for you. It lives in this test only and can't be shared across other tests... This is an issue if you have many tests and the url changes. Since
baseUrl is in each individual test, you have to go back and change them manually.
Does the url change often? You'd be suprised... here are some reasons:
Environments can solve this issue by letting you apply multiple groups of variables across ALL tests. For example, this set of environments change the baseUrl based upon three different servers:
When you run your tests, you can select the environment you'd like to use. The QA team can selected "Staging server", you can select "local dev". When running the test with an environment selected, they will be applied OVER the default test variables.