forked from apache/jmeter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTMLParserTestFile_2.html
More file actions
1277 lines (1060 loc) · 39.2 KB
/
HTMLParserTestFile_2.html
File metadata and controls
1277 lines (1060 loc) · 39.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Content Stylesheet for Site -->
<!-- start the processing -->
<!-- ====================================================================== -->
<!-- Main Page Section -->
<!-- ====================================================================== -->
<html><head>
<link rel="stylesheet" type="text/css" href="HTMLParserTestFile_2_files/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JMeter - User's Manual: Elements of a Test Plan</title>
</head>
<body bgcolor="#ffffff" link="#525D76" text="#000000">
<table border="0" cellspacing="0">
<!-- TOP IMAGE -->
<tbody><tr>
<td>
<!-- Need to specify height otherwise iframe seems to grab extra -->
<iframe src="HTMLParserTestFile_2_files/halfbanner.htm" style="border-width: 0pt; float: left;" frameborder="0" height="102" scrolling="no"></iframe>
</td>
<td align="left">
<a href="http://jakarta.apache.org/"><img src="HTMLParserTestFile_2_files/jakarta-logo.gif" alt="Jakarta" title="Jakarta" border="0" height="48" width="505"></a>
</td>
<td align="right">
<a href="http://jakarta.apache.org/jmeter/"><img src="HTMLParserTestFile_2_files/logo.jpg" alt="JMeter" title="JMeter" border="0" height="102" width="221"></a>
</td>
</tr>
</tbody></table>
<table border="0" cellspacing="4" width="100%">
<tbody><tr><td colspan="2">
<hr noshade="noshade" size="1">
</td></tr>
<tr>
<!-- LEFT SIDE NAVIGATION -->
<td nowrap="true" valign="top" width="20%">
<p><strong>About</strong></p>
<ul>
<li><a href="http://jakarta.apache.org/jmeter/index.html">Overview</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/changes.html">Changes</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/issues.html">Issues</a>
</li>
<li><a href="http://www.apache.org/licenses/">License</a>
</li>
<li><a href="http://wiki.apache.org/jakarta-jmeter/JMeterCommitters">Contributors</a>
</li>
</ul>
<p><strong>Download</strong></p>
<ul>
<li><a href="http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi">Download Releases</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/nightly.html">Developer (Nightly) Builds</a>
</li>
</ul>
<p><strong>Documentation</strong></p>
<ul>
<li><a href="http://jakarta.apache.org/jmeter/usermanual/index.html">User Manual</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/api/index.html">Javadocs</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/localising/index.html">Localisation (Translator's Guide)</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/building.html">Building JMeter and Add-Ons</a>
</li>
<li><a href="http://wiki.apache.org/jakarta-jmeter">JMeter Wiki</a>
</li>
<li><a href="http://wiki.apache.org/jakarta-jmeter/JMeterFAQ">FAQ (Wiki)</a>
</li>
</ul>
<p><strong>Tutorials (PDF format)</strong></p>
<ul>
<li><a href="http://jakarta.apache.org/jmeter/usermanual/jmeter_distributed_testing_step_by_step.pdf">Distributed Testing</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/usermanual/jmeter_proxy_step_by_step.pdf">Recording Tests</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/usermanual/junitsampler_tutorial.pdf">JUnit Sampler</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/usermanual/jmeter_accesslog_sampler_step_by_step.pdf">Access Log Sampler</a>
</li>
<li><a href="http://jakarta.apache.org/jmeter/extending/jmeter_tutorial.pdf">Extending JMeter</a>
</li>
</ul>
<p><strong>Community</strong></p>
<ul>
<li><a href="http://jakarta.apache.org/site/getinvolved.html">Get Involved</a>
</li>
<li><a href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a>
</li>
<li><a href="http://jakarta.apache.org/site/cvsindex.html">SVN Repositories</a>
</li>
</ul>
<p><strong>Foundation</strong></p>
<ul>
<li><a href="http://www.apache.org/">ASF</a>
</li>
<li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a>
</li>
<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a>
</li>
</ul>
</td>
<td align="left" valign="top" width="80%">
<table>
<tbody><tr>
<td bgcolor="#525D76">
<div align="right"><a href="http://jakarta.apache.org/jmeter/usermanual/index.html"><font color="#ffffff" face="arial,helvetica,sanserif" size="-1">Index</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="http://jakarta.apache.org/jmeter/usermanual/build-web-test-plan.html"><font color="#ffffff" face="arial,helvetica,sanserif" size="-1">Next</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="http://jakarta.apache.org/jmeter/usermanual/build-test-plan.html"><font color="#ffffff" face="arial,helvetica,sanserif" size="-1">Prev</font></a></div>
</td>
</tr>
</tbody></table>
<br>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>4. Elements of a Test Plan</strong></font>
</td></tr>
<tr><td>
<blockquote>
<p>
The Test Plan object has a checkbox called "Functional Testing". If selected, it
will cause JMeter to record the data returned from the server for each sample. If you have
selected a file in your test listeners, this data will be written to file. This can be useful if
you are doing a small run to ensure that JMeter is configured correctly, and that your server
is returning the expected results. The consequence is that the file will grow huge quickly, and
JMeter's performance will suffer. This option should be off if you are doing stress-testing (it
is off by default).
</p>
<p>
If you are not recording the data to file, this option makes no difference.
</p>
<p>
You can also use the Configuration button on a listener to decide what fields to save.
</p>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="thread_group"><strong>4.1 ThreadGroup</strong></a>
<a class="sectionlink" href="#thread_group" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
Thread group elements are the beginning points of any test plan.
All controllers and samplers must be under a thread group.
Other elements, e.g. Listeners, may be placed directly under the test plan,
in which case they will apply to all the thread groups.
As the name implies, the thread group
element controls the number of threads JMeter will use to execute your test. The
controls for a thread group allow you to:
</p><ul>
<li>
Set the number of threads
</li>
<li>
Set the ramp-up period
</li>
<li>
Set the number of times to execute the test
</li>
</ul>
<p></p>
<p>
Each thread will execute the test plan in its entirety and completely independently
of other test threads. Multiple threads are used to simulate concurrent connections
to your server application.
</p>
<p>
The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of
threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then
JMeter will take 100 seconds to get all 10 threads up and running. Each thread will
start 10 (100/10) seconds after the previous thread was begun. If there are 30 threads
and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.
</p>
<p>
Ramp-up needs to be long enough to avoid too large a work-load at the start
of a test, and short enough that the last threads start running before
the first ones finish (unless one wants that to happen).
</p>
<p>
Start with Ramp-up = number of threads and adjust up or down as needed.
</p>
<p>
By default, the thread group is configured to loop once through its elements.
</p>
<p>
Version 1.9 introduces a test run
<b>
scheduler
</b>
.
Click the checkbox at the bottom of the Thread Group panel to reveal extra fields
in which you can enter the start and end times of the run.
When the test is started, JMeter will wait if necessary until the start-time has been reached.
At the end of each cycle, JMeter checks if the end-time has been reached, and if so, the run is stopped,
otherwise the test is allowed to continue until the iteration limit is reached.
</p>
<p>
Alternatively, one can use the relative delay and duration fields.
Note that delay overrides start-time, and duration over-rides end-time.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="controllers"><strong>4.2 Controllers</strong></a>
<a class="sectionlink" href="#controllers" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
JMeter has two types of Controllers: Samplers and Logical Controllers.
These drive the processing of a test.
</p>
<p>
Samplers tell JMeter to send requests to a server. For
example, add an HTTP Request Sampler if you want JMeter
to send an HTTP request. You can also customize a request by adding one
or more Configuration Elements to a Sampler. For more
information, see
<a href="#samplers">
Samplers
</a>
.
</p>
<p>
Logical Controllers let you customize the logic that JMeter uses to
decide when to send requests. For example, you can add an Interleave
Logic Controller to alternate between two HTTP Request Samplers.
For more information, see
<a href="#logic_controller">
Logical Controllers
</a>
.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="samplers"><strong>4.2.1 Samplers</strong></a>
<a class="sectionlink" href="#samplers" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
Samplers tell JMeter to send requests to a server and wait for a response.
They are processed in the order they appear in the tree.
Controllers can be used to modify the number of repetitions of a sampler.
</p>
<p>
JMeter samplers include:
</p><ul>
<li>
FTP Request
</li>
<li>
HTTP Request
</li>
<li>
JDBC Request
</li>
<li>
Java object request
</li>
<li>
LDAP Request
</li>
<li>
SOAP/XML-RPC Request
</li>
<li>
WebService (SOAP) Request
</li>
</ul>
Each sampler has several properties you can set.
You can further customize a sampler by adding one or more Configuration Elements to the Test Plan.
<p></p>
<p>
If you are going to send multiple requests of the same type (for example,
HTTP Request) to the same server, consider using a Defaults Configuration
Element. Each controller has one or more Defaults elements (see below).
</p>
<p>
Remember to add a Listener to your test plan to view and/or store the
results of your requests to disk.
</p>
<p>
If you are interested in having JMeter perform basic validation on
the response of your request, add an
<a href="#assertions">
Assertion
</a>
to
the sampler. For example, in stress testing a web application, the server
may return a successful "HTTP Response" code, but the page may have errors on it or
may be missing sections. You could add assertions to check for certain HTML tags,
common error strings, and so on. JMeter lets you create these assertions using regular
expressions.
</p>
<p>
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#samplers">
JMeter's built-in samplers
</a>
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="logic_controller"><strong>4.2.2 Logic Controllers</strong></a>
<a class="sectionlink" href="#logic_controller" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
Logic Controllers let you customize the logic that JMeter uses to
decide when to send requests.
Logic Controllers can change the order of requests coming from their
child elements. They can modify the requests themselves, cause JMeter to repeat
requests, etc.
</p>
<p>
To understand the effect of Logic Controllers on a test plan, consider the
following test tree:
</p>
<p>
</p><ul>
<li>
Test Plan
</li>
<ul>
<li>
Thread Group
</li>
<ul>
<li>
Once Only Controller
</li>
<ul>
<li>
Login Request (an
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Request">HTTP Request</a>
)
</li>
</ul>
<li>
Load Search Page (HTTP Sampler)
</li>
<li>
Interleave Controller
</li>
<ul>
<li>
Search "A" (HTTP Sampler)
</li>
<li>
Search "B" (HTTP Sampler)
</li>
<li>
HTTP default request (Configuration Element)
</li>
</ul>
<li>
HTTP default request (Configuration Element)
</li>
<li>
Cookie Manager (Configuration Element)
</li>
</ul>
</ul>
</ul>
<p></p>
<p>
The first thing about this test is that the login request will be executed only
the first time through. Subsequent iterations will skip it. This is due to the
effects of the
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Once_Only_Controller">Once Only Controller</a>
.
</p>
<p>
After the login, the next Sampler loads the search page (imagine a
web application where the user logs in, and then goes to a search page to do a search). This
is just a simple request, not filtered through any Logic Controller.
</p>
<p>
After loading the search page, we want to do a search. Actually, we want to do
two different searches. However, we want to re-load the search page itself between
each search. We could do this by having 4 simple HTTP request elements (load search,
search "A", load search, search "B"). Instead, we use the
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Interleave_Controller">Interleave Controller</a>
which passes on one child request each time through the test. It keeps the
ordering (ie - it doesn't pass one on at random, but "remembers" its place) of its
child elements. Interleaving 2 child requests may be overkill, but there could easily have
been 8, or 20 child requests.
</p>
<p>
Note the
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Request_Defaults">HTTP Request Defaults</a>
that
belongs to the Interleave Controller. Imagine that "Search A" and "Search B" share
the same PATH info (an HTTP request specification includes domain, port, method, protocol,
path, and arguments, plus other optional items). This makes sense - both are search requests,
hitting the same back-end search engine (a servlet or cgi-script, let's say). Rather than
configure both HTTP Samplers with the same information in their PATH field, we
can abstract that information out to a single Configuration Element. When the Interleave
Controller "passes on" requests from "Search A" or "Search B", it will fill in the blanks with
values from the HTTP default request Configuration Element. So, we leave the PATH field
blank for those requests, and put that information into the Configuration Element. In this
case, this is a minor benefit at best, but it demonstrates the feature.
</p>
<p>
The next element in the tree is another HTTP default request, this time added to the
Thread Group itself. The Thread Group has a built-in Logic Controller, and thus, it uses
this Configuration Element exactly as described above. It fills in the blanks of any
Request that passes through. It is extremely useful in web testing to leave the DOMAIN
field blank in all your HTTP Sampler elements, and instead, put that information
into an HTTP default request element, added to the Thread Group. By doing so, you can
test your application on a different server simply by changing one field in your Test Plan.
Otherwise, you'd have to edit each and every Sampler.
</p>
<p>
The last element is a
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Cookie_Manager">HTTP Cookie Manager</a>
. A Cookie Manager should be added to all web tests - otherwise JMeter will
ignore cookies. By adding it at the Thread Group level, we ensure that all HTTP requests
will share the same cookies.
</p>
<p>
Logic Controllers can be combined to achieve various results. See the list of
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#logic_controllers">
built-in
Logic Controllers
</a>
.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="test_fragments"><strong>4.2.3 Test Fragments</strong></a>
<a class="sectionlink" href="#test_fragments" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
The Test Fragment element is a special type of
<a href="#controllers">
controller
</a>
that
exists on the Test Plan tree at the same level as the Thread Group element. It is distinguished
from a Thread Group in that it is not executed unless it is
referenced by either a
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Module_Controller">Module Controller</a>
or an
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Include_Controller">Include_Controller</a>
.
</p>
<p>
This element is purely for code re-use within Test Plans and was introduced in Version 2.5
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="listeners"><strong>4.3 Listeners</strong></a>
<a class="sectionlink" href="#listeners" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
Listeners provide access to the information JMeter gathers about the test cases while
JMeter runs. The
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Graph_Results">Graph Results</a>
listener plots the response times on a graph.
The "View Results Tree" Listener shows details of sampler requests and
responses, and can display basic HTML and XML representations of the
response.
Other listeners provide summary or aggregation information.
</p>
<p>
Additionally, listeners can direct the data to a file for later use.
Every listener in JMeter provides a field to indicate the file to store data to.
There is also a Configuration button which can be used to choose which fields to save, and whether to use CSV or XML format.
<b>
Note that all Listeners save the same data; the only difference is in the way the data is presented on the screen.
</b>
</p>
<p>
Listeners can be added anywhere in the test, including directly under the test plan.
They will collect data only from elements at or below their level.
</p>
<p>
There are several
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#listeners">
listeners
</a>
that come with JMeter.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="timers"><strong>4.4 Timers</strong></a>
<a class="sectionlink" href="#timers" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
By default, a JMeter thread sends requests without pausing between each request.
We recommend that you specify a delay by adding one of the available timers to
your Thread Group. If you do not add a delay, JMeter could overwhelm your server by
making too many requests in a very short amount of time.
</p>
<p>
The timer will cause JMeter to delay a certain amount of time
<b>
before
</b>
each
sampler which is in its
<a href="#scoping_rules">
scope
</a>
.
</p>
<p>
If you choose to add more than one timer to a Thread Group, JMeter takes the sum of
the timers and pauses for that amount of time before executing the samplers to which the timers apply.
Timers can be added as children of samplers or controllers in order to restrict the samplers to which they are applied.
</p>
<p>
To provide a pause at a single place in a test plan, one can use the
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Test_Action">Test Action</a>
Sampler.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="assertions"><strong>4.5 Assertions</strong></a>
<a class="sectionlink" href="#assertions" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
Assertions allow you to assert facts about responses received from the
server being tested. Using an assertion, you can essentially "test" that your
application is returning the results you expect it to.
</p>
<p>
For instance, you can assert that the response to a query will contain some
particular text. The text you specify can be a Perl-style regular expression, and
you can indicate that the response is to contain the text, or that it should match
the whole response.
</p>
<p>
You can add an assertion to any Sampler. For example, you can
add an assertion to a HTTP Request that checks for the text, "</HTML>". JMeter
will then check that the text is present in the HTTP response. If JMeter cannot find the
text, then it will mark this as a failed request.
</p>
<p>
Note that assertions apply to all samplers which are in its
<a href="#scoping_rules">
scope
</a>
.
To restrict the assertion to a single sampler, add the assertion as a child of the sampler.
</p>
<p>
To view the assertion results, add an Assertion Listener to the Thread Group.
Failed Assertions will also show up in the Tree View and Table Listeners,
and will count towards the error %age for example in the Aggregate and Summary reports.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="config_elements"><strong>4.6 Configuration Elements</strong></a>
<a class="sectionlink" href="#config_elements" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
A configuration element works closely with a Sampler. Although it does not send requests
(except for
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Proxy_Server">HTTP Proxy Server</a>
), it can add to or modify requests.
</p>
<p>
A configuration element is accessible from only inside the tree branch where you place the element.
For example, if you place an HTTP Cookie Manager inside a Simple Logic Controller, the Cookie Manager will
only be accessible to HTTP Request Controllers you place inside the Simple Logic Controller (see figure 1).
The Cookie Manager is accessible to the HTTP requests "Web Page 1" and "Web Page 2", but not "Web Page 3".
</p>
<p>
Also, a configuration element inside a tree branch has higher precedence than the same element in a "parent"
branch. For example, we defined two HTTP Request Defaults elements, "Web Defaults 1" and "Web Defaults 2".
Since we placed "Web Defaults 1" inside a Loop Controller, only "Web Page 2" can access it. The other HTTP
requests will use "Web Defaults 2", since we placed it in the Thread Group (the "parent" of all other branches).
</p>
<p></p><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td><img src="HTMLParserTestFile_2_files/http-config-example.png"><br>
<font size="-1">Figure 1 -
Test Plan Showing Accessibility of Configuration Elements
</font></td></tr></tbody></table><p></p>
<p>
</p><table bgcolor="#bbbb00" border="1" cellpadding="2" cellspacing="0" width="50%">
<tbody><tr><td>
The
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#User_Defined_Variables">User Defined Variables</a>
Configuration element is different.
It is processed at the start of a test, no matter where it is placed.
For simplicity, it is suggested that the element is placed only at the start of a Thread Group.
</td></tr>
</tbody></table>
<p></p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="preprocessors"><strong>4.7 Pre-Processor Elements</strong></a>
<a class="sectionlink" href="#preprocessors" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
A Pre-Processor executes some action prior to a Sampler Request being
made.
If a Pre-Processor is attached to a Sampler element, then it will
execute just prior to that sampler element running.
A Pre-Processor is most often used to modify the settings of a Sample
Request just before it runs, or to update variables that aren't
extracted from response text.
See the
<a href="http://jakarta.apache.org/jmeter/usermanual/build-test-plan.html#scoping_rules">
<b>
scoping rules
</b>
</a>
for more details on when Pre-Processors are executed.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="postprocessors"><strong>4.8 Post-Processor Elements</strong></a>
<a class="sectionlink" href="#postprocessors" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
A Post-Processor executes some action after a Sampler Request has been made.
If a Post-Processor is attached to a Sampler element, then it will execute just after that sampler element runs.
A Post-Processor is most often used to process the response data, often to extract values from it.
See the
<a href="http://jakarta.apache.org/jmeter/usermanual/build-test-plan.html#scoping_rules">
<b>
scoping rules
</b>
</a>
for more details on when Post-Processors are executed.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="executionorder"><strong>4.9 Execution order</strong></a>
<a class="sectionlink" href="#executionorder" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<ol start="0">
<li>
Configuration elements
</li>
<li>
Pre-Processors
</li>
<li>
Timers
</li>
<li>
Sampler
</li>
<li>
Post-Processors (unless SampleResult is null)
</li>
<li>
Assertions (unless SampleResult is null)
</li>
<li>
Listeners (unless SampleResult is null)
</li>
</ol>
<p>
</p><table bgcolor="#bbbb00" border="1" cellpadding="2" cellspacing="0" width="50%">
<tbody><tr><td>
Please note that Timers, Assertions, Pre- and Post-Processors are only processed if there is a sampler to which they apply.
Logic Controllers and Samplers are processed in the order in which they appear in the tree.
Other test elements are processed according to the scope in which they are found, and the type of test element.
[Within a type, elements are processed in the order in which they appear in the tree].
</td></tr>
</tbody></table>
<p></p>
<p>
For example, in the following test plan:
</p><ul>
<li>
Controller
</li>
<ul>
<li>
Post-Processor 1
</li>
<li>
Sampler 1
</li>
<li>
Sampler 2
</li>
<li>
Timer 1
</li>
<li>
Assertion 1
</li>
<li>
Pre-Processor 1
</li>
<li>
Timer 2
</li>
<li>
Post-Processor 2
</li>
</ul>
</ul>
The order of execution would be:
<pre>
Pre-Processor 1
Timer 1
Timer 2
Sampler 1
Post-Processor 1
Post-Processor 2
Assertion 1
Pre-Processor 1
Timer 1
Timer 2
Sampler 2
Post-Processor 1
Post-Processor 2
Assertion 1
</pre>
<p></p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</tbody></table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="scoping_rules"><strong>4.10 Scoping Rules</strong></a>
<a class="sectionlink" href="#scoping_rules" title="Link to here">¶</a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
The JMeter test tree contains elements that are both hierarchical and
ordered. Some elements in the test trees are strictly hierarchical
(Listeners, Config Elements, Post-Procesors, Pre-Processors, Assertions,
Timers), and some are primarily ordered (controllers, samplers). When
you create your test plan, you will create an ordered list of sample
request (via Samplers) that represent a set of steps to be executed.
These requests are often organized within controllers that are also
ordered. Given the following test tree:
</p>
<p></p><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td><img src="HTMLParserTestFile_2_files/scoping1.png"><br>
<font size="-1">Example test tree
</font></td></tr></tbody></table><p></p>
<p>
The order of requests will be, One, Two, Three, Four.
</p>
<p>
Some controllers affect the order of their subelements, and you can read about these specific controllers in
<a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html">
the component reference
</a>
.
</p>
<p>
Other elements are hierarchical. An Assertion, for instance, is hierarchical in the test tree.
If its parent is a request, then it is applied to that request. If its
parent is a Controller, then it affects all requests that are descendants of
that Controller. In the following test tree:
</p>