Applies to ReadyAPI 3.5, last modified on November 26, 2020

About Environments

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.

Create environment

  1. To open the Environments editor, select Configure Environments from a drop-down list on the ReadyAPI toolbar:

    Environments in ReadyAPI: Configure Environments

    Click the image to enlarge it.

  2. In the editor, click Add to add an environment:

    ReadyAPI: Creating the first environment

    Click the image to enlarge it.

    Note: If you do not have created environments, click Add Environment.
  3. Specify a name for the new environment.

    ReadyAPI: Creating an environment
  4. 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.

  5. Click OK.

In ReadyAPI 1.9 or earlier, using services or interfaces with identical names can cause issues. Please update to ReadyAPI 3.5 to make sure your services have unique identifiers.

Configure environment

To configure environments, select Configure Environments from a drop-down list on the toolbar:

Environments in ReadyAPI: Configure Environments

Click the image to enlarge it.

Change API endpoints, project properties, JDBC connections, and JMS servers for different environments by using the corresponding tabs:

Toolbar

Use the buttons on the Environments editor toolbar to add, remove, or modify environments.

ReadyAPI: The Environments editor toolbar
Icon Option Description
Add Add Adds a new environment.
Remove Remove Deletes the selected environment.
Rename Rename Renames the selected environment.
Clone Clone Creates a copy of the selected environment.
Sort Sort Sorts environments alphabetically.
Move Up
Move Down
Move Up
Move Down
Moves the selected environment up or down in the list. The order of environments will also be changed in the Environments drop-down.
Tip: You can also drag an environment to change its position in the list.
Note: You can also right-click an environment and select one of the above-mentioned commands.

Switch between environments

To switch between environments, use one of the following commands:

  • Use the drop-down list on the control bar:

    ReadyAPI: Selecting an environment

    Click the image to enlarge it.

  • Double-click an environment in the Environments editor.

  • Right-click an environment in the Environments editor, and select Set Active.

  • Use the <project name>.setActiveEnvironment(<environment name>) code line in the setup or teardown script, or in the Groovy script test step:

    Groovy

    // Replace the project and environment names with those you need

    def proj = testRunner.testCase.project.workspace.getProjectByName("Sample Project")

    proj.setActiveEnvironment("Test Environment")

Set environments in command line runners

You can also force ReadyAPI to switch the environment while running tests with the functional test runner, performance test runner, or security test runner:

  • 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 -e, -u, and -p command-line arguments. See Command-Line Arguments for details.
  • In command line – Specify the environment you need by using the -E argument, for example:

    "-ETest Environment"

See Also

Testing APIs
Starting ReadyAPI Tests by Using Command-Line Runners

Highlight search results