Share via

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:

  1. Get an Azure authentication token
  2. Create or retrieve a resource group
  3. Create or retrieve an Azure load testing resource
  4. Create a load test, define test fail criteria, and upload the JMeter script using the load test administration client
  5. Add app components to the test for monitoring server-side metrics
  6. Run the load test

Getting started

Preparation

  1. Open the source code in VS Code.

  2. 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.
  3. Add or update the test fail criteria in GetJMeterTestConfiguration().

  4. Add or update the app components to monitor in CreateOrUpdateAppComponents().

  5. 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

  1. Open a command prompt and go to the sample folder.

  2. Enter the following command to run the load test:

    dotnet run
    
  3. Go to the Azure portal.

  4. Go to the Azure load testing resource to view the test results.

Resources