Azure Load Testing: You can run load tests from command-line now
Published Jun 27 2023 07:12 AM 5,294 Views

Azure Load Testing is a fully managed load testing service that enables you to easily generate large scale load. I am excited to share that you can now run the tests using Azure CLI (Command-Line Interface).

 

Azure CLI is a powerful tool for managing Azure resources from the command line. It is cross-platform (Windows, macOS, and Linux), offers flexible output options (JSON, YAML, tables, etc.), and enables integration with automation systems (like CI/CD workflows) via scripting.

 

Azure Load Testing already supports tools like SDKs, Azure DevOps and GitHub extensions. We are launching the support for Azure CLI since it can be easily integrated CI/CD tools and tools and enable templated test creation. The newly available az load extension for Azure enables end-to-end load testing. With this extension you can use commands for:

  1. az load  to create and manage Azure Load Testing resources
  2. az load test  to create and manage load tests
  3. az load test-run  to create and manage test runs

Note that the extension will automatically install the first time you run the az load command.

 

Run a load test using Azure CLI

Now let’s see how you can run a load test using Azure CLI. Ensure that you have an Azure subscription (create one for free) and have installed Azure CLI (you can follow these steps ). The load extension is for Azure CLI version 2.41.0 or higher.

You can run the commands below to get started.

 

 

# Create and run a load test and download results
# Variables
subscription="subscriptionId" # add subscription here
resourceGroup="myRG"
location="East US"
loadTestResource="myLoadTestResource"
testId = "myLoadTest"

az account set -s $subscription # ...or use 'az login'
az configure --defaults group=$resourceGroup

# Create a resource
az load create --name $loadTestResource --location $location

# Create a test
testPlan="sample.jmx"
az load test create --load-test-resource  $loadTestResource --test-id $testId  --display-name "My CLI Load Test" --description "Created using Az CLI" --test-plan $testPlan --engine-instances 1

# Run the test
testRunId="run_"`date +"%Y%m%d%_H%M%S"`
displayName="Run"`date +"%Y/%m/%d_%H:%M:%S"`
az load test-run create --load-test-resource $loadTestResource --test-id $testId --test-run-id $testRunId --display-name $displayName --description "Test run from CLI"

# Get test run client-side metrics
az load test-run metrics list --load-test-resource $loadTestResource --test-run-id $testRunId --metric-namespace LoadTestRunMetrics

 

 

 

 

Download the sample script for creating and running a test from this repository.

 

So, what are you waiting for? Run az load and get started with running tests from Azure CLI. If you have any feedback, let us know through our feedback forum. You can refer to our previous blog posts here and can find more samples for using Azure CLI for Azure Load Testing here.

 

Happy Load Testing...!

Co-Authors
Version history
Last update:
‎Jun 27 2023 10:16 AM
Updated by: