Create a load test with an existing JMeter script by using the Azure Load Testing library for .NET
This sample demonstrates how to create and run a load test by using an existing JMeter script with the Azure Load Testing .NET language libraries.
The sample performs the following steps:
- Get an Azure authentication token
- Create or retrieve a resource group
- Create or retrieve an Azure load testing resource
- Create a load test, define test fail criteria, and upload the JMeter script using the load test administration client
- Add app components to the test for monitoring server-side metrics
- Run the load test
Getting started
Preparation
Open the source code in VS Code.
Update the
Program.cs
file and replace the text placeholders:Placeholder Description {my-load-test-resource-group}
Resource group that contains the Azure Load Testing resource. {my-load-test-resource}
Name of the Azure Load Testing resource. Add or update the test fail criteria in
GetJMeterTestConfiguration()
.Add or update the app components to monitor in
CreateOrUpdateAppComponents()
.Update the
sample.jmx
file and replace the text placeholders:Placeholder Description {my-app-endpoint}
URL of the application endpoint to test.
Run the sample
Open a command prompt and go to the sample folder.
Enter the following command to run the load test:
dotnet run
Go to the Azure portal.
Go to the Azure load testing resource to view the test results.