or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

administration.mdindex.mdtest-execution.md
tile.json

tessl/pypi-azure-developer-loadtesting

Microsoft Azure Developer LoadTesting Client Library for Python providing programmatic access to Azure's load testing platform.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-developer-loadtesting@1.0.x

To install, run

npx @tessl/cli install tessl/pypi-azure-developer-loadtesting@1.0.0

index.mddocs/

Azure Developer LoadTesting

Microsoft Azure Developer LoadTesting Client Library for Python provides programmatic access to Azure's fully managed load testing platform. The library enables developers to create, configure, and execute load tests, monitor performance metrics, and integrate load testing into CI/CD pipelines through comprehensive Python APIs.

Package Information

  • Package Name: azure-developer-loadtesting
  • Package Type: pypi
  • Language: Python
  • Installation: pip install azure-developer-loadtesting
  • Supported Python Versions: 3.7+

Core Imports

from azure.developer.loadtesting import LoadTestAdministrationClient, LoadTestRunClient

For asynchronous operations:

from azure.developer.loadtesting.aio import LoadTestAdministrationClient, LoadTestRunClient

Basic Usage

from azure.core.credentials import DefaultAzureCredential
from azure.developer.loadtesting import LoadTestAdministrationClient, LoadTestRunClient

# Initialize credentials
credential = DefaultAzureCredential()
endpoint = "https://your-loadtest-resource.loadtest.azure.com"

# Create clients
admin_client = LoadTestAdministrationClient(endpoint=endpoint, credential=credential)
run_client = LoadTestRunClient(endpoint=endpoint, credential=credential)

# Create a load test
test_definition = {
    "displayName": "My Load Test",
    "description": "Load test for my application"
}

with admin_client:
    # Create the test
    test = admin_client.create_or_update_test("my-test-id", test_definition)
    print(f"Created test: {test['displayName']}")
    
    # Upload a test script (JMeter .jmx file)
    with open("test-script.jmx", "rb") as f:
        upload_result = admin_client.begin_upload_test_file(
            test_id="my-test-id",
            file_name="test-script.jmx", 
            body=f,
            file_type="JMX_FILE"
        )

# Execute the test
test_run_definition = {
    "testId": "my-test-id",
    "displayName": "My Test Run"
}

with run_client:
    # Start the test run
    run_poller = run_client.begin_test_run("my-test-run-id", test_run_definition)
    test_run = run_poller.result()
    print(f"Test run status: {test_run['status']}")
    
    # Monitor test run progress
    test_run = run_client.get_test_run("my-test-run-id")
    print(f"Current status: {test_run['status']}")

Architecture

The library provides two primary client interfaces:

  • LoadTestAdministrationClient: Manages test definitions, test scripts, application components, and server metrics configuration
  • LoadTestRunClient: Handles test execution, monitoring, metrics collection, and result analysis

Both clients support:

  • Context management for automatic resource cleanup
  • Long Running Operations (LRO) with polling for file uploads and test execution
  • Pagination for listing operations
  • Custom request support through send_request() method
  • Synchronous and asynchronous programming models

Capabilities

Test Administration

Complete management of load test definitions, test scripts, and configuration. Includes creating and updating tests, uploading JMeter scripts and supporting files, configuring application components for monitoring, and setting up server-side metrics collection.

def create_or_update_test(test_id: str, body: Union[JSON, IO], **kwargs) -> JSON: ...
def delete_test(test_id: str, **kwargs) -> None: ...
def get_test(test_id: str, **kwargs) -> JSON: ...
def list_tests(*, orderby: Optional[str] = None, search: Optional[str] = None, **kwargs) -> Iterable[JSON]: ...
def begin_upload_test_file(test_id: str, file_name: str, body: IO, **kwargs) -> JSON: ...

Test Administration

Test Execution and Monitoring

Execution of load tests with real-time monitoring and comprehensive metrics collection. Includes starting and stopping test runs, monitoring execution progress, collecting performance metrics, and accessing detailed results and logs.

def begin_test_run(test_run_id: str, body: Union[JSON, IO], *, old_test_run_id: Optional[str] = None, **kwargs) -> LROPoller[JSON]: ...
def get_test_run(test_run_id: str, **kwargs) -> JSON: ...
def stop_test_run(test_run_id: str, **kwargs) -> JSON: ...
def list_test_runs(*, orderby: Optional[str] = None, search: Optional[str] = None, test_id: Optional[str] = None, execution_from: Optional[datetime] = None, execution_to: Optional[datetime] = None, status: Optional[str] = None, **kwargs) -> Iterable[JSON]: ...
def list_metrics(test_run_id: str, body: Optional[Union[JSON, IO]] = None, *, metric_name: str, metric_namespace: str, time_interval: str, aggregation: Optional[str] = None, interval: Optional[str] = None, **kwargs) -> Iterable[JSON]: ...

Test Execution and Monitoring

Types

# Type aliases for API responses and requests
JSON = MutableMapping[str, Any]

# Long Running Operation types
from azure.core.polling import LROPoller
LROPoller[JSON]  # For test run operations

# Async equivalents
from azure.core.polling import AsyncLROPoller
AsyncLROPoller[JSON]  # For async test run operations

# Pagination types
from typing import Iterable, AsyncIterable
Iterable[JSON]  # For sync list operations
AsyncIterable[JSON]  # For async list operations

# Credential types
from azure.core.credentials import TokenCredential
from azure.core.credentials_async import AsyncTokenCredential

# HTTP types for custom requests
from azure.core.rest import HttpRequest, HttpResponse, AsyncHttpResponse

# Time handling
from datetime import datetime