In ReadyAPI, an environment is a set of parameters that match certain configuration for your tests. An environment includes API endpoints, authentication profiles for REST, SOAP, and GraphQL services, database connection settings, custom project properties, and parameters of connection to JMS servers.
By switching an environment, you can quickly change properties of your test without the necessity of changing them manually.
|Note:||Environments can include only project properties. Test suite properties and lower-level properties will not be available.|
To open the Environments editor, select Configure Environments from a drop-down list on the ReadyAPI toolbar:
In the editor, click to add an environment:
|Note:||If you do not have created environments, click Add Environment.|
Specify a name for the new environment.
Select the setup options you need.
Select Empty if you do not want to specify specific options.
Select Copy endpoints & credentials from the project if you want to use the project’s endpoints and credentials in the new environment.
|In ReadyAPI 1.9 or earlier, using services or interfaces with identical names can cause issues. Please update to ReadyAPI 3.3 to make sure your services have unique identifiers.|
To configure environments, select Configure Environments from a drop-down list on the toolbar:
Change API endpoints, project properties, JDBC connections, and JMS servers for different environments by using the corresponding tabs:
Use the buttons on the Environments editor toolbar to add, remove, or modify environments.
|Add||Adds a new environment.|
|Remove||Deletes the selected environment.|
|Rename||Renames the selected environment.|
|Clone||Creates a copy of the selected environment.|
|Sort||Sorts environments alphabetically.|
Moves the selected environment up or down in the list. The order of environments will also be changed in the Environments drop-down.
|Note:||You can also right-click an environment and select one of the above-mentioned commands.|
To switch between environments, use one of the following commands:
Use the drop-down list on the control bar:
Double-click an environment in the Environments editor.
Right-click an environment in the Environments editor, and select Set Active.
<project name>.setActiveEnvironment(<environment name>) code line in the setup or teardown script, or in the Groovy script test step:
In GUI – On the Overrides tab, select the environment you need in the Environments drop-down list.
|Note:||If you need to override the Endpoint, Username, and Password values, do this with the
In command line – Specify the environment you need by using the
-E argument, for example: