You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`delete_app_components` method from `azure.developer.loadtesting.LoadTestingClient.load_test_administration.delete_app_components` was not discoverable in expected location, fixed discoverability.
# Azure Developer LoadTesting client library for Python
3
-
Azure Developer LoadTesting provides client library in python to the user by which they can interact natively with Load Test Service.The service is for performing the load test to optimize application performance, scalability or capacity. The user can get the client-side and server-side metrices to see the details reported by the test engine and information about your Azure application components.
2
+
# Azure Load Testing client library for Python
3
+
Azure Load Testing provides client library in python to the user by which they can interact natively with Azure Load Testing service. Azure Load Testing is a fully managed load-testing service that enables you to generate high-scale load. The service simulates traffic for your applications, regardless of where they're hosted. Developers, testers, and quality assurance (QA) engineers can use it to optimize application performance, scalability, or capacity.
4
4
5
+
## Documentation
6
+
Various documentation is available to help you get started
As an example, sign in via the Azure CLI `az login` command and [DefaultAzureCredential](https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python) will authenticate as that user.
37
+
38
+
Use the returned token credential to authenticate the client.
31
39
32
-
Use the returned token credential to authenticate the client:
40
+
#### Create the client
41
+
42
+
The data plane URI should be provided as the endpoint to create the client.
33
43
34
44
```python
35
45
from azure.developer.loadtesting import LoadTestingClient
46
+
47
+
# for managing authentication and authorization
48
+
# can be installed from pypi, follow: https://pypi.org/project/azure-identity/
49
+
# using DefaultAzureCredentials, read more at: https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python
The following components make up te Azure Load Testing service. The Azure Load Test client library for python allows you to interact with each of these components through the use of clients. There are two top-level clients which are the main entry points for the library
These sub-clients are used for managing and using different components of the service.
71
+
72
+
### Load Test Administration Client
73
+
74
+
The `load_test_administration` sub-clients is used to administer and configure the load tests, app components and metrics.
75
+
76
+
#### Test
77
+
78
+
A test specifies the test script, and configuration settings for running a load test. You can create one or more tests in an Azure Load Testing resource.
79
+
80
+
#### App Component
81
+
82
+
When you run a load test for an Azure-hosted application, you can monitor resource metrics for the different Azure application components (server-side metrics). While the load test runs, and after completion of the test, you can monitor and analyze the resource metrics in the Azure Load Testing dashboard.
83
+
84
+
#### Metrics
85
+
86
+
During a load test, Azure Load Testing collects metrics about the test execution. There are two types of metrics:
87
+
88
+
1. Client-side metrics give you details reported by the test engine. These metrics include the number of virtual users, the request response time, the number of failed requests, or the number of requests per second.
89
+
90
+
2. Server-side metrics are available for Azure-hosted applications and provide information about your Azure application components. Metrics can be for the number of database reads, the type of HTTP responses, or container resource consumption.
91
+
92
+
### Test Run Client
93
+
94
+
The `load_test_runs` sub-clients is used to start and stop test runs corresponding to a load test. A test run represents one execution of a load test. It collects the logs associated with running the Apache JMeter script, the load test YAML configuration, the list of app components to monitor, and the results of the test.
95
+
96
+
### Data-Plane Endpoint
97
+
98
+
Data-plane of Azure Load Testing resources is addressable using the following URL format:
The first GUID `00000000-0000-0000-0000-000000000000` is the unique identifier used for accessing the Azure Load Testing resource. This is followed by `aaa` which is the Azure region of the resource.
103
+
104
+
The data-plane endpoint is obtained from Control Plane APIs.
result = client.load_test_runs.create_and_update_test(
177
+
result = client.load_test_runs.create_or_update_test(
112
178
TEST_RUN_ID,
113
179
{
114
180
"testId": TEST_ID,
115
181
"displayName": DISPLAY_NAME,
116
-
"requestSamplers": [],
117
-
"errors": [],
118
-
"percentiles": ["90"],
119
-
"groupByInterval": "5s",
120
182
},
121
183
)
122
184
print(result)
123
185
except HttpResponseError as e:
124
-
print("Failed to send JSON message: {}".format(e.response.json()))
186
+
print("Failed with error: {}".format(e.response.json()))
125
187
```
126
-
## Key concepts
127
-
The following components make up the Azure Load Testing Service. The Azure Load Test client library for Python allows you to interact with each of these components through the use of a dedicated client object.
128
-
129
-
### Load testing resource
130
-
The Load testing resource is the top-level resource for your load-testing activities. This resource provides a centralized place to view and manage load tests, test results, and related artifacts. A load testing resource contains zero or more load tests.
131
-
132
-
### Test
133
-
A test specifies the test script, and configuration settings for running a load test. You can create one or more tests in an Azure Load Testing resource.
134
-
135
-
### Test Engine
136
-
A test engine is computing infrastructure that runs the Apache JMeter test script. You can scale out your load test by configuring the number of test engines. The test script runs in parallel across the specified number of test engines.
137
-
138
-
### Test Run
139
-
A test run represents one execution of a load test. It collects the logs associated with running the Apache JMeter script, the load test YAML configuration, the list of app components to monitor, and the results of the test.
140
-
141
-
### App Component
142
-
When you run a load test for an Azure-hosted application, you can monitor resource metrics for the different Azure application components (server-side metrics). While the load test runs, and after completion of the test, you can monitor and analyze the resource metrics in the Azure Load Testing dashboard.
143
-
144
-
### Metrics
145
-
During a load test, Azure Load Testing collects metrics about the test execution. There are two types of metrics:
146
-
147
-
1. Client-side metrics give you details reported by the test engine. These metrics include the number of virtual users, the request response time, the number of failed requests, or the number of requests per second.
148
-
149
-
2. Server-side metrics are available for Azure-hosted applications and provide information about your Azure application components. Metrics can be for the number of database reads, the type of HTTP responses, or container resource consumption.
150
-
151
-
## Troubleshooting
152
-
More about it is coming soon...
153
188
154
189
## Next steps
155
190
156
-
More examples are coming soon...
191
+
More samples can be found [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/loadtestservice/azure-developer-loadtesting/samples).
0 commit comments