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
Copy file name to clipboardExpand all lines: articles/load-testing/how-to-define-test-criteria.md
+65-17Lines changed: 65 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,32 +12,27 @@ ms.topic: how-to
12
12
13
13
# Define fail criteria for load tests by using Azure Load Testing
14
14
15
-
In this article, you learn how to define fail criteria or auto stop criteria for your load tests with Azure Load Testing. Fail criteria let you define performance and quality expectations for your application under load. Azure Load Testing supports various client metrics for defining fail criteria, such as error rate or response time. Auto stop criteria enable you to automatically stop your load test when the error rate surpasses a given threshold.
15
+
In this article, you learn how to define fail criteria or auto stop criteria for your load tests with Azure Load Testing. Fail criteria let you define performance and quality expectations for your application under load. Azure Load Testing supports various client and server metrics for defining fail criteria, such as error rate or CPU percentage for an Azure resource. Auto stop criteria enable you to automatically stop your load test when the error rate surpasses a given threshold.
16
16
17
17
## Prerequisites
18
18
19
19
- An Azure account with an active subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
20
20
- An Azure load testing resource. If you need to create an Azure Load Testing resource, see the quickstart [Create and run a load test](./quickstart-create-and-run-load-test.md).
21
21
22
-
## Load test fail criteria
22
+
## Load test fail criteria
23
23
24
-
Load test fail criteria are conditions for client-side metrics, that your test should meet. You define test criteria at the load test level in Azure Load Testing. A load test can have one or more test criteria. When at least one of the test criteria evaluates to true, the load test gets the *failed* status.
24
+
Load test fail criteria are conditions for metrics, that your test should meet. You define test criteria at the load test level in Azure Load Testing. A load test can have one or more test criteria. When at least one of the test criteria evaluates to true, the load test gets the *failed* status.
25
25
26
-
You can define test criteria at two levels. A load test can combine criteria at the different levels.
26
+
You can define a maximum of 50 test criteria for a load test. If there are multiple criteria for the same metric, the criterion with the lowest threshold value is used.
27
27
28
-
- At the load test level. For example, to ensure that the total error percentage doesn't exceed a threshold.
29
-
- At the JMeter request level (JMeter sampler). For example, you could specify a response time threshold of the *getProducts* request, but disregard the response time of the *sign in* request.
30
-
31
-
You can define a maximum of 50 test criteria for a load test. If there are multiple criteria for the same client metric, the criterion with the lowest threshold value is used.
32
-
33
-
### Fail criteria structure
28
+
### Fail criteria structure for client metrics
34
29
35
30
The format of fail criteria in Azure Load Testing follows that of a conditional statement for a [supported metric](#supported-client-metrics-for-fail-criteria). For example, ensure that the average number of requests per second is greater than 500.
36
31
37
-
Fail criteria have the following structure:
32
+
For client-side metrics, you can define test criteria at two levels. A load test can combine criteria at the different levels.
38
33
39
-
-Test criteria at the load test level: `Aggregate_function (client_metric) condition threshold`.
40
-
-Test criteria applied to specific JMeter requests: `Request: Aggregate_function (client_metric) condition threshold`.
34
+
-At the load test level. For example, to ensure that the total error percentage doesn't exceed a threshold. The structure for the criteria is: `Aggregate_function (client_metric) condition threshold`.
35
+
-At the JMeter request level (JMeter sampler). For example, you could specify a response time threshold of the *getProducts* request, but disregard the response time of the *sign in* request. The structure for the criteria is: `Request: Aggregate_function (client_metric) condition threshold`.
41
36
42
37
The following table describes the different components:
43
38
@@ -61,11 +56,11 @@ Azure Load Testing supports the following client metrics:
61
56
|`requests_per_sec`|`avg` (average) | Numerical value with up to two decimal places. |`>` (greater than) <BR> `<` (less than) | Number of requests per second. |
62
57
|`requests`|`count`| Integer value. |`>` (greater than) <BR> `<` (less than) | Total number of requests. |
63
58
64
-
## Define load test fail criteria
59
+
###Define load test fail criteria for client metrics
65
60
66
61
# [Azure portal](#tab/portal)
67
62
68
-
In this section, you configure test criteria for a load test in the Azure portal.
63
+
In this section, you configure test criteria for client metric for a load test in the Azure portal.
69
64
70
65
1. In the [Azure portal](https://portal.azure.com), go to your Azure Load Testing resource.
71
66
@@ -95,7 +90,7 @@ In this section, you configure test criteria for a load test in the Azure portal
In this section, you configure test criteria for a load test, as part of a CI/CD workflow. Learn how to [set up automated performance testing with CI/CD](./quickstart-add-load-test-cicd.md).
93
+
In this section, you configure test criteria for a client metric for a load test, as part of a CI/CD workflow. Learn how to [set up automated performance testing with CI/CD](./quickstart-add-load-test-cicd.md).
99
94
100
95
For CI/CD workflows, you configure the load test settings in a [YAML test configuration file](./reference-test-config-yaml.md). You store the load test configuration file alongside the JMeter test script file in the source control repository.
101
96
@@ -105,7 +100,7 @@ To specify fail criteria in the YAML configuration file:
105
100
106
101
1. Add your test criteria in the `failureCriteria` setting.
107
102
108
-
Use the [fail criteria format](#fail-criteria-structure), as described earlier. You can add multiple fail criteria for a load test.
103
+
Use the [fail criteria format](#fail-criteria-structure-for-client-metrics), as described earlier. You can add multiple fail criteria for a load test.
109
104
110
105
The following example defines three fail criteria. The first two criteria apply to the overall load test, and the last one specifies a condition for the `GetCustomerDetails` request.
111
106
@@ -135,6 +130,59 @@ To specify fail criteria in the YAML configuration file:
135
130
:::image type="content" source="media/how-to-define-test-criteria/azure-pipelines-log.png" alt-text="Screenshot that shows the test criteria in the CI/CD workflow log.":::
136
131
137
132
---
133
+
### Access app component for test criteria on server metrics
134
+
135
+
When you set failure criteria on a metric in your app component, your load testing resource uses a [managed identity](./how-to-use-a-managed-identity.md) for accessing that component. After you configure the managed identity, you need to grant the managed identity of your load testing resource permissions to read these values from the app component.
136
+
137
+
To grant your Azure load testing resource permissions to read the metrics from your app component:
138
+
139
+
1. In the [Azure portal](https://portal.azure.com), go to your app component.
140
+
141
+
2. On the left pane, select **Access Control (IAM)**, then select **+ Add**, and then select **Add role assignment**.
142
+
143
+
:::image type="content" source="media/how-to-define-test-criteria/add-role-assignment.png" alt-text="Screenshot of the Access Control(IAM) in the application component on which failure criteria is to be set.":::
144
+
145
+
3. On the **Role **tab, under** Job functions roles**, search for **Monitoring Reader** or **Monitoring Contributor**.
146
+
147
+
4. On the **Members** tab, under **Assign access to**, select **Managed Identity**.
148
+
149
+
5. Click on **Select members**, search and select the managed identity for the load testing resource, and then select **Next**.
150
+
If you're using a system-assigned managed identity, the managed identity name matches that of your Azure load testing resource.
151
+
152
+
6. Select **Review + assign** to assign the identity the permission.
153
+
154
+
:::image type="content" source="media/how-to-define-test-criteria/assign-permissions.png" alt-text="Screenshot of assigning the permissions to read metrics to the load testing resource.":::
155
+
156
+
When your test runs, the managed identity that's associated with your load testing resource can now read the metrics for your load test from your app component.
157
+
158
+
### Define load test fail criteria for server metrics
159
+
160
+
>[!IMPORTANT]
161
+
>Azure Load Testing doesn't support configuring failure criteria on server-side metrics from Azure Pipelines/Github Actions.
162
+
163
+
In this section, you configure test failure criteria on server-side metrics for a load test in the Azure portal.
164
+
165
+
1. In the [Azure portal](https://portal.azure.com), go to your Azure Load Testing resource.
166
+
167
+
2. Select **Create Test**.
168
+
169
+
3. Under the **Monitoring** Tab, [configure the app components](./how-to-monitor-server-side-metrics.md) you want to monitor during the test.
170
+
171
+
4. Configure the **Metrics reference identity**. The identity can be the system-assigned identity of the load testing resource, or one of the user-assigned identities. Make sure you use the same identity you've granted access previously.
172
+
173
+
:::image type="content" source="media/how-to-define-test-criteria/monitoring-tab.png" alt-text="Screenshot of configuring metrics reference identity.":::
174
+
175
+
6. On the **Test criteria** pane, fill the **Resource ID, Namespace, Metric, Aggregation, Condition, Threshold values** for your test. You can set failure criteria only for those resources/app components that you are monitoring during the test.
176
+
177
+
:::image type="content" source="media/how-to-define-test-criteria/server-failure-criteria.png" alt-text="Screenshot of configuring failure criteria on server metrics.":::
178
+
179
+
8. Select **Apply** to save the changes.
180
+
When you now run the load test, Azure Load Testing uses the test criteria to determine the status of the load test run.
181
+
182
+
9. Run the test and view the status in the load test dashboard.
183
+
The dashboard shows each of the test criteria and their status. The overall test status is failed if at least one criterion was met.
184
+
185
+
:::image type="content" source="media/how-to-define-test-criteria/dashboard.png" alt-text="Screenshot of the dashboard displaying test results.":::
Copy file name to clipboardExpand all lines: articles/load-testing/how-to-use-a-managed-identity.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -196,6 +196,8 @@ You can create an Azure load testing resource by using an ARM template and the r
196
196
197
197
You might need to configure the target resource to allow access from your load testing resource. For example, if you [read a secret or certificate from Azure Key Vault](./how-to-parameterize-load-tests.md), or if you [use customer-managed keys for encryption](./how-to-configure-customer-managed-keys.md), you must also add an access policy that includes the managed identity of your resource. Otherwise, your calls to Azure Key Vault are rejected, even if you use a valid token.
198
198
199
+
Similarly, if you want to [set failure criteria on server metrics](./how-to-define-test-criteria.md), you should specify a Metrics Reference Identity to fetch metrics for. You should configure the target resource such that the identity can read the metrics from the resource.
200
+
199
201
## Related content
200
202
201
203
* [Use secrets or certificates in your load test](./how-to-parameterize-load-tests.md)
0 commit comments