Skip to content

Commit 72f3cd4

Browse files
authored
Merge pull request #286591 from saloniagrawal1997/PFServerPR
Changes for PF criteria
2 parents 93d1464 + 0b6c971 commit 72f3cd4

File tree

7 files changed

+67
-17
lines changed

7 files changed

+67
-17
lines changed

articles/load-testing/how-to-define-test-criteria.md

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,27 @@ ms.topic: how-to
1212

1313
# Define fail criteria for load tests by using Azure Load Testing
1414

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

1717
## Prerequisites
1818

1919
- 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.
2020
- 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).
2121

22-
## Load test fail criteria
22+
## Load test fail criteria
2323

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

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

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
3429

3530
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.
3631

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

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`.
4136

4237
The following table describes the different components:
4338

@@ -61,11 +56,11 @@ Azure Load Testing supports the following client metrics:
6156
|`requests_per_sec` | `avg` (average) | Numerical value with up to two decimal places. | `>` (greater than) <BR> `<` (less than) | Number of requests per second. |
6257
|`requests` | `count` | Integer value. | `>` (greater than) <BR> `<` (less than) | Total number of requests. |
6358

64-
## Define load test fail criteria
59+
### Define load test fail criteria for client metrics
6560

6661
# [Azure portal](#tab/portal)
6762

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

7065
1. In the [Azure portal](https://portal.azure.com), go to your Azure Load Testing resource.
7166

@@ -95,7 +90,7 @@ In this section, you configure test criteria for a load test in the Azure portal
9590

9691
# [Azure Pipelines / GitHub Actions](#tab/pipelines+github)
9792

98-
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).
9994

10095
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.
10196

@@ -105,7 +100,7 @@ To specify fail criteria in the YAML configuration file:
105100

106101
1. Add your test criteria in the `failureCriteria` setting.
107102

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

110105
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.
111106

@@ -135,6 +130,59 @@ To specify fail criteria in the YAML configuration file:
135130
:::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.":::
136131
137132
---
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.":::
138186
139187
## Auto stop configuration
140188

articles/load-testing/how-to-use-a-managed-identity.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ You can create an Azure load testing resource by using an ARM template and the r
196196
197197
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.
198198
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+
199201
## Related content
200202
201203
* [Use secrets or certificates in your load test](./how-to-parameterize-load-tests.md)
62.2 KB
Loading
27 KB
Loading
59.2 KB
Loading
53.1 KB
Loading
49.7 KB
Loading

0 commit comments

Comments
 (0)