Skip to content

Commit 87ad1e1

Browse files
committed
Merging changes synced from https://github.com/MicrosoftDocs/azure-docs-pr (branch live)
2 parents 07d858c + 79cdf10 commit 87ad1e1

20 files changed

+229
-142
lines changed
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
title: Create and run a load test with Azure Load Testing with a JMeter script
3+
description: 'Learn how to load test a website with Azure Load Testing in the Azure portal by using an existing Apache JMeter script.'
4+
services: load-testing
5+
ms.service: load-testing
6+
ms.topic: how-to
7+
author: ntrogh
8+
ms.author: nicktrog
9+
ms.date: 05/16/2022
10+
adobe-target: true
11+
---
12+
13+
# Load test a website with Azure Load Testing Preview in the Azure portal by using an existing JMeter script
14+
15+
This article describes how to load test a web application with Azure Load Testing Preview from the Azure portal. You'll use an existing Apache JMeter script to configure the load test.
16+
17+
After you complete this, you'll have a resource and load test that you can use for other tutorials.
18+
19+
Learn more about the [key concepts for Azure Load Testing](./concept-load-testing-concepts.md).
20+
21+
> [!IMPORTANT]
22+
> Azure Load Testing is currently in preview. For legal terms that apply to Azure features that are in beta, in preview, or otherwise not yet released into general availability, see the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
23+
24+
## Prerequisites
25+
26+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
27+
28+
- 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).
29+
30+
## Create an Apache JMeter script
31+
32+
In this section, you'll create a sample Apache JMeter script that you'll use in the next section to load test a web endpoint. If you already have a script, you can skip to [Create a load test](#create-a-load-test).
33+
34+
1. Create a *SampleTest.jmx* file on your local machine:
35+
36+
```powershell
37+
touch SampleTest.jmx
38+
```
39+
40+
1. Open *SampleTest.jmx* in a text editor and paste the following code snippet in the file:
41+
42+
```xml
43+
<?xml version="1.0" encoding="UTF-8"?>
44+
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1">
45+
<hashTree>
46+
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Azure Load Testing Quickstart" enabled="true">
47+
<stringProp name="TestPlan.comments"></stringProp>
48+
<boolProp name="TestPlan.functional_mode">false</boolProp>
49+
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
50+
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
51+
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
52+
<collectionProp name="Arguments.arguments"/>
53+
</elementProp>
54+
<stringProp name="TestPlan.user_define_classpath"></stringProp>
55+
</TestPlan>
56+
<hashTree>
57+
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
58+
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
59+
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
60+
<boolProp name="LoopController.continue_forever">false</boolProp>
61+
<intProp name="LoopController.loops">-1</intProp>
62+
</elementProp>
63+
<stringProp name="ThreadGroup.num_threads">5</stringProp>
64+
<stringProp name="ThreadGroup.ramp_time">10</stringProp>
65+
<boolProp name="ThreadGroup.scheduler">true</boolProp>
66+
<stringProp name="ThreadGroup.duration">120</stringProp>
67+
<stringProp name="ThreadGroup.delay">5</stringProp>
68+
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
69+
</ThreadGroup>
70+
<hashTree>
71+
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Homepage" enabled="true">
72+
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
73+
<collectionProp name="Arguments.arguments"/>
74+
</elementProp>
75+
<stringProp name="HTTPSampler.domain">your-endpoint-url</stringProp>
76+
<stringProp name="HTTPSampler.port"></stringProp>
77+
<stringProp name="HTTPSampler.protocol"></stringProp>
78+
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
79+
<stringProp name="HTTPSampler.path"></stringProp>
80+
<stringProp name="HTTPSampler.method">GET</stringProp>
81+
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
82+
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
83+
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
84+
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
85+
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
86+
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
87+
<stringProp name="HTTPSampler.response_timeout"></stringProp>
88+
</HTTPSamplerProxy>
89+
<hashTree/>
90+
</hashTree>
91+
</hashTree>
92+
</hashTree>
93+
</jmeterTestPlan>
94+
```
95+
96+
This sample Apache JMeter script simulates a load test of five virtual users simultaneously accessing a web endpoint. It takes less than two minutes to complete.
97+
98+
1. In the file, replace the placeholder text `your-endpoint-url` with your own endpoint URL.
99+
100+
> [!IMPORTANT]
101+
> Don't include `https` or `http` in the endpoint URL.
102+
103+
1. Save and close the file.
104+
105+
## Create a load test
106+
107+
With Azure Load Testing, you can use an Apache JMeter script to create a load test. This script defines the application test plan. It contains information about the web endpoint, the number of virtual users, and other test configuration settings.
108+
109+
To create a load test by using an existing Apache JMeter script:
110+
111+
1. Go to your Azure Load Testing resource, select **Tests** from the left pane, and then select **+ Create new test**.
112+
113+
:::image type="content" source="./media/how-to-create-and-run-load-test-with-jmeter-script/create-new-test.png" alt-text="Screenshot that shows the Azure Load Testing page and the button for creating a new test." :::
114+
115+
1. On the **Basics** tab, enter the **Test name** and **Test description** information. Optionally, you can select the **Run test after creation** checkbox.
116+
117+
:::image type="content" source="./media/how-to-create-and-run-load-test-with-jmeter-script/create-new-test-basics.png" alt-text="Screenshot that shows the Basics tab for creating a test." :::
118+
119+
1. On the **Test plan** tab, select your Apache JMeter script, and then select **Upload** to upload the file to Azure.
120+
121+
:::image type="content" source="./media/how-to-create-and-run-load-test-with-jmeter-script/create-new-test-test-plan.png" alt-text="Screenshot that shows the Test plan tab." :::
122+
123+
> [!NOTE]
124+
> You can select and upload additional Apache JMeter configuration files or other files that are referenced in the JMX file. For example, if your test script uses CSV data sets, you can upload the corresponding *.csv* file(s).
125+
126+
1. (Optional) On the **Parameters** tab, configure input parameters for your Apache JMeter script.
127+
128+
1. For this quickstart, you can leave the default value on the **Load** tab:
129+
130+
|Field |Default value |Description |
131+
|---------|---------|---------|
132+
|**Engine instances** |**1** |The number of parallel test engines that run the Apache JMeter script. |
133+
134+
:::image type="content" source="./media/how-to-create-and-run-load-test-with-jmeter-script/create-new-test-load.png" alt-text="Screenshot that shows the Load tab for creating a test." :::
135+
136+
1. (Optional) On the **Test criteria** tab, configure criteria to determine when your load test should fail.
137+
138+
1. (Optional) On the **Monitoring** tab, you can specify the Azure application components to capture server-side metrics for. For this quickstart, you're not testing an Azure-hosted application.
139+
140+
1. Select **Review + create**. Review all settings, and then select **Create** to create the load test.
141+
142+
:::image type="content" source="./media/how-to-create-and-run-load-test-with-jmeter-script/create-new-test-review.png" alt-text="Screenshot that shows the tab for reviewing and creating a test." :::
143+
144+
> [!NOTE]
145+
> You can update the test configuration at any time, for example to upload a different JMX file. Choose your test in the list of tests, and then select **Edit**.
146+
147+
## Run the load test
148+
149+
In this section, you'll run the load test that you just created.
150+
151+
1. Go to your Load Testing resource, select **Tests** from the left pane, and then select the test that you created.
152+
153+
:::image type="content" source="./media/how-to-create-and-run-load-test-with-jmeter-script/tests.png" alt-text="Screenshot that shows the list of load tests." :::
154+
155+
1. On the test details page, select **Run** or **Run test**. Then, select **Run** on the **Run test** confirmation pane to start the load test.
156+
157+
:::image type="content" source="./media/how-to-create-and-run-load-test-with-jmeter-script/run-test-confirm.png" alt-text="Screenshot that shows the run confirmation page." :::
158+
159+
> [!TIP]
160+
> You can stop a load test at any time from the Azure portal.
161+
162+
## Next steps
163+
164+
- To learn how to export test results, see [Export test results](./how-to-export-test-results.md).
165+
166+
- To learn how to monitor server side metrics, see [Monitor server side metrics](./how-to-monitor-server-side-metrics.md).

articles/load-testing/how-to-move-between-regions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Load and modify the template so you can create a new Azure Load Testing resource
8686

8787
### Create tests
8888

89-
Once the resource is created in the target location, you can create new tests by following the steps mentioned [here](./quickstart-create-and-run-load-test.md#create_test).
89+
Once the resource is created in the target location, you can create new tests by following the steps mentioned [here](how-to-create-and-run-load-test-with-jmeter-script.md#create-a-load-test).
9090

9191
1. You can refer to the test configuration in the config.yaml file of the input artifacts downloaded earlier.
9292

0 commit comments

Comments
 (0)