Skip to content

Commit ae93f69

Browse files
authored
Merge pull request #235905 from ntrogh/alt-move-code-samples
[Azure Load Testing] Move code samples to samples repo
2 parents 677ab07 + 3bdfc5e commit ae93f69

File tree

3 files changed

+27
-77
lines changed

3 files changed

+27
-77
lines changed

.openpublishing.publish.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,12 @@
969969
"branch_mapping": {}
970970
},
971971
{
972+
"path_to_root": "azure-load-testing-samples",
973+
"url": "https://github.com/Azure-Samples/azure-load-testing-samples",
974+
"branch": "main",
975+
"branch_mapping": {}
976+
},
977+
{
972978
"path_to_root": "microsoft-graph",
973979
"url": "https://github.com/MicrosoftGraph/microsoft-graph-docs",
974980
"branch": "main",

articles/load-testing/how-to-create-and-run-load-test-with-jmeter-script.md

Lines changed: 16 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -30,84 +30,36 @@ Use cases for creating a load test with an existing JMeter script include:
3030

3131
- 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).
3232

33+
- [Clone or download the samples project from GitHub](https://github.com/Azure-Samples/azure-load-testing-samples/tree/main/jmeter-basic-endpoint)
34+
3335
## Create an Apache JMeter script
3436

3537
If you already have a script, you can skip to [Create a load test](#create-a-load-test). In this section, you'll create a sample JMeter test script to load test a single web endpoint.
3638

3739
You can also use the [Apache JMeter test script recorder](https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.html) to record the requests while navigating the application in a browser. Alternatively, [import cURL commands](https://jmeter.apache.org/usermanual/curl.html) to generate the requests in the JMeter test script.
3840

39-
To create a sample JMeter test script:
40-
41-
1. Create a *SampleTest.jmx* file on your local machine:
41+
To get started with a sample JMeter script:
4242

43-
```powershell
44-
touch SampleTest.jmx
45-
```
43+
1. [Clone or download the samples project from GitHub](https://github.com/Azure-Samples/azure-load-testing-samples/tree/main/jmeter-basic-endpoint)
4644

47-
1. Open *SampleTest.jmx* in a text editor and paste the following code snippet in the file:
45+
1. Open the *SampleTest.jmx* file in a text editor.
4846

4947
This script simulates a load test of five virtual users that simultaneously access a web endpoint, and takes 2 minutes to complete.
5048

51-
```xml
52-
<?xml version="1.0" encoding="UTF-8"?>
53-
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1">
54-
<hashTree>
55-
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Azure Load Testing Quickstart" enabled="true">
56-
<stringProp name="TestPlan.comments"></stringProp>
57-
<boolProp name="TestPlan.functional_mode">false</boolProp>
58-
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
59-
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
60-
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
61-
<collectionProp name="Arguments.arguments"/>
62-
</elementProp>
63-
<stringProp name="TestPlan.user_define_classpath"></stringProp>
64-
</TestPlan>
65-
<hashTree>
66-
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Web endpoint test" enabled="true">
67-
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
68-
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
69-
<boolProp name="LoopController.continue_forever">false</boolProp>
70-
<intProp name="LoopController.loops">-1</intProp>
71-
</elementProp>
72-
<stringProp name="ThreadGroup.num_threads">5</stringProp>
73-
<stringProp name="ThreadGroup.ramp_time">10</stringProp>
74-
<boolProp name="ThreadGroup.scheduler">true</boolProp>
75-
<stringProp name="ThreadGroup.duration">120</stringProp>
76-
<stringProp name="ThreadGroup.delay">5</stringProp>
77-
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
78-
</ThreadGroup>
79-
<hashTree>
80-
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP request" enabled="true">
81-
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Sample web test" enabled="true">
82-
<collectionProp name="Arguments.arguments"/>
83-
</elementProp>
84-
<stringProp name="HTTPSampler.domain"></stringProp>
85-
<stringProp name="HTTPSampler.port"></stringProp>
86-
<stringProp name="HTTPSampler.protocol"></stringProp>
87-
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
88-
<stringProp name="HTTPSampler.path"></stringProp>
89-
<stringProp name="HTTPSampler.method">GET</stringProp>
90-
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
91-
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
92-
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
93-
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
94-
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
95-
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
96-
<stringProp name="HTTPSampler.response_timeout"></stringProp>
97-
</HTTPSamplerProxy>
98-
<hashTree/>
99-
</hashTree>
100-
</hashTree>
101-
</hashTree>
102-
</jmeterTestPlan>
103-
```
104-
105-
1. In the file, set the value of the `HTTPSampler.domain` node to the host name of your endpoint. For example, if you want to test the endpoint `https://www.contoso.com/app/products`, the host name is `www.contoso.com`.
49+
1. Set the value of the `HTTPSampler.domain` node to the host name of your endpoint.
10650

107-
> [!IMPORTANT]
51+
For example, if you want to test the endpoint `https://www.contoso.com/app/products`, the host name is `www.contoso.com`.
52+
53+
> [!CAUTION]
10854
> Don't include `https` or `http` in the endpoint URL.
10955
110-
1. In the file, set the value of the `HTTPSampler.path` node to the path of your endpoint. For example, the path for the URL `https://www.contoso.com/app/products` is `/app/products`.
56+
:::code language="xml" source="~/azure-load-testing-samples/jmeter-basic-endpoint/sample.jmx" range="29-46" highlight="5":::
57+
58+
1. Set the value of the `HTTPSampler.path` node to the path of your endpoint.
59+
60+
For example, the path for the URL `https://www.contoso.com/app/products` would be `/app/products`.
61+
62+
:::code language="xml" source="~/azure-load-testing-samples/jmeter-basic-endpoint/sample.jmx" range="29-46" highlight="9":::
11163

11264
1. Save and close the file.
11365

articles/load-testing/how-to-read-csv-data.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ In this article, you'll learn how to read data from a comma-separated value (CSV
1818

1919
Use data from an external CSV file to make your JMeter test script configurable. For example, you might invoke an API for each entry in a customers CSV file.
2020

21+
Get started by [cloning or downloading the samples project from GitHub](https://github.com/Azure-Samples/azure-load-testing-samples/tree/main/jmeter-read-csv).
22+
2123
In this article, you learn how to:
2224

2325
> [!div class="checklist"]
@@ -62,21 +64,11 @@ To edit your JMeter script by using Visual Studio Code or your editor of prefere
6264

6365
1. Update the `filename` element and remove any file path reference.
6466

67+
:::code language="xml" source="~/azure-load-testing-samples/jmeter-read-csv/read-from-csv.jmx" range="30-41" highlight="4":::
68+
6569
1. Add the CSV field names as a comma-separated list in `variableNames`.
6670

67-
```xml
68-
<CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="Search parameters" enabled="true">
69-
<stringProp name="delimiter">,</stringProp>
70-
<stringProp name="fileEncoding">UTF-8</stringProp>
71-
<stringProp name="filename">search-params.csv</stringProp>
72-
<boolProp name="ignoreFirstLine">true</boolProp>
73-
<boolProp name="quotedData">false</boolProp>
74-
<boolProp name="recycle">true</boolProp>
75-
<stringProp name="shareMode">shareMode.all</stringProp>
76-
<boolProp name="stopThread">false</boolProp>
77-
<stringProp name="variableNames">username,query</stringProp>
78-
</CSVDataSet>
79-
```
71+
:::code language="xml" source="~/azure-load-testing-samples/jmeter-read-csv/read-from-csv.jmx" range="30-41" highlight="10":::
8072

8173
1. Save the JMeter script and add it to your [test plan](./how-to-create-manage-test.md#test-plan).
8274

0 commit comments

Comments
 (0)