Virtual Services Configuration

Rather than hard-coding recurring configuration values in a virtual service, transaction, or processing action, you can define environment variables for virtual services to use at runtime, such as a different server and port for testing and staging. Use the Configurations tab to create custom configurations to store your attribute-value pairs. To use a configuration value, refer to it in ${config.name} format. For example, to reference a custom port, use ${config.port}.

Configurations are similar to Using Test Data With Service Virtualization. Use test data if you want to reuse the same values at Service level or in Performance and Functional tests. Use Virtual Services Configurations to provide common values at the virtual service's workspace level if you don't have the requirement to share them with tests.

Create a Virtual Services Configuration

Before deploying a virtual service, create and select the desired configuration.

  1. Go to the Service Virtualization tab and open the Configurations tab.
  2. For each configuration, click Create New Configuration.
  3. Enter a Name for the configuration, for example staging, development, testing.
  4. (Optional) Enter a Description that informs team members of the purpose of this configuration.
  5. For each property, click Add Property and enter a Name and its Value.
  6. Click Save.

Now you can use the values and enable this configuration for a virtual service.

virtual service configurations tab

Use the Configuration Values

  1. Go to the Service Virtualization tab and open the virtual service.
  2. For each virtual service, identify the respective hard-coded values.
  3. Replace the hard-coded values with custom properties in ${config.name} format.
    Click the Copy button next to the property name to copy the correct syntax into the clipboard.

 

Enable or Change a Virtual Services Configuration

You cannot change the active configuration while the virtual service is running.

  1. Go to the Service Virtualization tab and open the virtual service.
  2. If the virtual service is running, click Stop.
  3. (Optional) Edit the configuration values on the Configurations tab if needed.
  4. Open the virtual service definition and select the desired configuration.
  5. Click Run Virtual Service to restart the virtual service with the new profile.

virtual service configurations tab