@@ -32,24 +32,25 @@ Set the values of the client ID, tenant ID, and client secret of the AAD applica
32
32
Use the returned token credential to authenticate the client:
33
33
34
34
``` python
35
- from azure.developer.loadtesting import LoadTestClient
35
+ from azure.developer.loadtesting import LoadTestingClient
36
36
from azure.identity import DefaultAzureCredential
37
- client = LoadTestClient (endpoint = ' <endpoint>' , credential = DefaultAzureCredential())
37
+ client = LoadTestingClient (endpoint = ' <endpoint>' , credential = DefaultAzureCredential())
38
38
```
39
39
40
40
## Examples
41
41
42
42
### Creating a load test
43
43
``` python
44
- from azure.developer.loadtesting import LoadTestClient
44
+ from azure.developer.loadtesting import LoadTestingClient
45
45
from azure.identity import DefaultAzureCredential
46
46
from azure.core.exceptions import HttpResponseError
47
47
48
48
TEST_ID = " some-test-id"
49
49
DISPLAY_NAME = " new_namespace-new-namespace"
50
50
SUBSCRIPTION_ID = os.environ[" SUBSCRIPTION_ID" ]
51
51
52
- client = LoadTestClient(endpoint = ' <endpoint>' , credential = DefaultAzureCredential())
52
+ client = LoadTestingClient(endpoint = ' <endpoint>' , credential = DefaultAzureCredential())
53
+
53
54
try :
54
55
result = client.load_test_administration.create_or_update_test(
55
56
TEST_ID ,
@@ -77,34 +78,35 @@ except HttpResponseError as e:
77
78
78
79
### Uploading .jmx file to a Test
79
80
``` python
80
- from azure.developer.loadtesting import LoadTestClient
81
+ from azure.developer.loadtesting import LoadTestingClient
81
82
from azure.identity import DefaultAzureCredential
82
83
from azure.core.exceptions import HttpResponseError
83
84
84
85
TEST_ID = " some-test-id"
85
86
FILE_ID = " some-file-id"
86
87
88
+ client = LoadTestingClient(endpoint = ' <endpoint>' , credential = DefaultAzureCredential())
89
+
87
90
try :
88
- # opening .jmx file
89
- body = {}
90
- body[" file" ] = open (" sample.jmx" , " rb" )
91
91
92
- result = client.load_test_administration.upload_test_file(TEST_ID , FILE_ID , body )
92
+ result = client.load_test_administration.upload_test_file(TEST_ID , FILE_ID , open ( " sample.jmx " , " rb " ) )
93
93
print (result)
94
94
except HttpResponseError as e:
95
95
print (" Failed to send JSON message: {} " .format(e.response.json()))
96
96
```
97
97
98
98
### Running a Test
99
99
``` python
100
- from azure.developer.loadtesting import LoadTestClient
100
+ from azure.developer.loadtesting import LoadTestingClient
101
101
from azure.identity import DefaultAzureCredential
102
102
from azure.core.exceptions import HttpResponseError
103
103
104
104
TEST_ID = " some-test-id"
105
105
TEST_RUN_ID = " some-testrun-id"
106
106
DISPLAY_NAME = " new_namespace-new-namespace"
107
107
108
+ client = LoadTestingClient(endpoint = ' <endpoint>' , credential = DefaultAzureCredential())
109
+
108
110
try :
109
111
result = client.load_test_runs.create_and_update_test(
110
112
TEST_RUN_ID ,
0 commit comments