Using system variables
When running our tests from the command line, we can set up user variables easily to indicate which test environment to use or run. This can be done with an environment {
process.env.ENV}
variable:
> Env=dev
This variable can then be read inside our framework and redirect our login method to the proper environment, like this:
prod=www.candymapper.com dev=www.candymapperr2.com
Quick tip
Be extra vigilant when testing in production. Discuss with leadership the potential impact it can have. Slowing down the production database with inefficient SQL calls that return a million results will overshadow any bugs that are found. Set up your job runs with a marker that indicates your production environment’s safe test cases.