Configure a load test in YAML

Learn how to configure your load test in Azure Load Testing Preview by using YAML. You use the test configuration YAML file to create and run load tests from your continuous integration and continuous delivery (CI/CD) workflow.

Important

Azure Load Testing is currently in preview. For legal terms that apply to Azure features that are in beta, in preview, or otherwise not yet released into general availability, see the Supplemental Terms of Use for Microsoft Azure Previews.

Load test definition

A test configuration uses the following keys:

Key Type Description
version string Version of the YAML configuration file that the service uses. Currently, the only valid value is v0.1.
testName string Required. Name of the test to run. The results of various test runs will be collected under this test name in the Azure portal.
testPlan string Required. Relative path to the Apache JMeter test script to run.
engineInstances integer Required. Number of parallel instances of the test engine to execute the provided test plan. You can update this property to increase the amount of load that the service can generate.
configurationFiles array List of relevant configuration files or other files that you reference in the Apache JMeter script. For example, a CSV data set file, images, or any other data file. These files will be uploaded to the Azure Load Testing resource alongside the test script. If the files are in a subfolder on your local machine, use file paths that are relative to the location of the test script.

Azure Load Testing currently doesn't support the use of file paths in the JMX file. When you reference an external file in the test script, make sure to only specify the file name.
description string Short description of the test run.
failureCriteria object Criteria that indicate failure of the test. Each criterion is in the form of:
[Aggregate_function] ([client_metric]) > [value]

- [Aggregate function] ([client_metric]) is either avg(response_time_ms) or percentage(error).
- value is an integer number.
properties object List of properties to configure the load test.
properties.userPropertyFile string File to use as an Apache JMeter user properties file. The file will be uploaded to the Azure Load Testing resource alongside the JMeter test script and other configuration files. If the file is in a subfolder on your local machine, use a path relative to the location of the test script.
secrets object List of secrets that the Apache JMeter script references.
secrets.name string Name of the secret. This name should match the secret name that you use in the Apache JMeter script.
secrets.value string URI for the Azure Key Vault secret.
env object List of environment variables that the Apache JMeter script references.
env.name string Name of the environment variable. This name should match the secret name that you use in the Apache JMeter script.
env.value string Value of the environment variable.
keyVaultReferenceIdentity string Resource ID of the user-assigned managed identity for accessing the secrets from your Azure Key Vault. If you use a system-managed identity, this information isn't needed. Make sure to grant this user-assigned identity access to your Azure key vault.

The following YAML snippet contains an example load test configuration:

version: v0.1
testName: SampleTest
testPlan: SampleTest.jmx
description: Load test website home page
engineInstances: 1
properties:
  userPropertyFile: 'user.properties'
configurationFiles:
  - 'SampleData.csv'
failureCriteria:
  - avg(response_time_ms) > 300
  - percentage(error) > 50
env:
  - name: my-variable
    value: my-value
secrets:
  - name: my-secret
    value: https://akv-contoso.vault.azure.net/secrets/MySecret
keyVaultReferenceIdentity: /subscriptions/abcdef01-2345-6789-0abc-def012345678/resourceGroups/sample-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sample-identity

Next steps

Learn how to build automated regression testing in your CI/CD workflow.