Creating Environments
Environments are a way of differentiating between stages of development, and set specific data for each stage, managing and running tests against multiple environments
Last updated
Environments are a way of differentiating between stages of development, and set specific data for each stage, managing and running tests against multiple environments
Last updated
Environments allow you to run tests against multiple testing or production environments. It allows you to easily switch between different environments, tagging each test result with environment name for post-run results analysis. Additionally, it allows you to inject environment-related variables into the automation tests.
Go to Environments under Projects and click on Add Environment:
This screen allows you to add new environments, set environment variables, modify and delete already defined records. Note that environment is defined on per project basis.
Defined environment can be assigned to a Test Case, Test Suite or Monitor in Runtime Settings tab.
Environment Variables allow to easily switch between different environment without a need to adjust automation scripts per selected environment. By utilizing environment variable in your automation tests code, you can seamlessly run the scripts against different environment with no changes to your code or configuration files.
In order to define a new environment variable, select the relevant environment from the left-side environment list and then click on Name column in an empty row. Type the environment name and the value you want it to contain. Make sure to provide a unique environment variable name within the same environment.
Environment name can contain letters, numbers and _ (underscore) character only. It should not include space or any other special characters.
You can create different environments, and set unique data for each one:
You can retrieve variables value of the specified environment in your test automation code. To retrieve the values, you need to use CloudBeat's Test Development Kit (TDK) suitable for your testing project language and framework.
There are two options to retrieve environment variable's value in Oxygen. As the first option, you can use "${<variable_name>}" syntax in most of Oxygen modules commands. For example, you can retrieve BASE_URL variable's value to set your test's main starting page URL. Here is an example of opening a web page based on BASE_URL environment variable:
As the second option, you can access your environment variables using a special env
variable inside your Oxygen script. The above example can be rewritten in the following way using env
variable:
You can find more information on using Environment Variables inside Oxygen here.
To use them in a test case, go to settings and pick your environment:
To access their data, we simple use the env object, which will be referred to the environment selected, for example if we choose the TEST environment, env will be assigned to it: