Skip to main content Skip to complementary content

Creating environments

Create environments and use variables in your tests.

About this task

You can create two environments with a URL variable in order to easily switch between your mock and your service while running tests.

Procedure

  1. Open your test project and click Add an environment in the top right corner of the window.
  2. Enter a name for your environment, Mock for example, and click Create.
  3. Enter endpoint in the Name field and your mock endpoint in the Value field, https://e5df96j.us.api-mocks.com for example.
    Information noteNote: You can find your mock endpoint in your API's general settings in Talend Cloud API Designer.
    Environments dialog box.
  4. Click Add an environment and name your new environment, Service for example.
  5. Select the Copy variables from check box, and choose Mock in the drop-down list.
  6. Replace the value of the endpoint variable with the endpoint that you entered in Talend Cloud API Designer.
  7. Click Close.

Results

Your environments are created. You can now replace the base URL in your requests with ${"endpoint"}. You will be able to switch between the mock and the service URL by selecting the corresponding environment.
Example of configuring the base URL of a request to ${"endpoint"}/movies.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!