Download presentation
Presentation is loading. Please wait.
1
JMeter Workshop Friday 1 December 2006 Anthony Colebourne IT Services The University of Manchester
2
What is JMeter Apache JMeter is a GUI desktop application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions. –Has a rich graphical interface –Built in Java –Part of Apache Jakarta project –Can be distributed It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types.
3
Features of JMeter Graphical Analysis / Exporting Test Results Remote Distributed Execution –If you want to generate load using multiple test servers. You can run multiple server components of JMeter remotely. And you can control it by a single JMeter GUI to gather results. http://jakarta.apache.org/jmeter/usermanual/remote- test.htmlhttp://jakarta.apache.org/jmeter/usermanual/remote- test.html Highly Extensible –Custom Additions (Write your own samplers / listeners) –PlugIns Test plans stored in XML and can be version controlled.
4
What Can You Do With It? JMeter lets you set up test plans that simulate logging into a web site, filling out forms, clicking buttons, links, etc. You can simulate the number of users doing this, the rate that they do it.
5
Setting Up and Running JMeter Download the binary from Jakarta –http://jakarta.apache.org/jmeter/http://jakarta.apache.org/jmeter/ –It’s platform independent, so the same download will run on Windows, Linux, Mac. –You need Java, with the JAVA_HOME environment variable set. –Uncomment SSL settings in jmeter.properties Unpack the zip or tar.gz and execute jmeter.bat or jmeter.sh
6
JMeter Control Panel
7
Test Plan A complete test plan will consist of one or more Thread Groups, logic controllers, samplers, listeners, timers, assertions, and configuration elements. Test Plans are represented as an Ordered Tree.
9
Scoping Rules Some elements are primarily ordered (e.g. controllers and samplers). Other elements are hierarchical. An Assertion, for example, 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.
11
Elements of a Test Plan ThreadGroup –Set the number of threads –Set the ramp-up period –Set the number of times to execute the test Samplers –HTTP Request –JDBC Request –LDAP Request –WebService (SOAP) Request Logic Controllers –Simple Controller - The Simple Logic Controller lets you organize your Samplers and other Logic Controllers –Loop Controller –Once Only Controller –Interleave Controller –Throughput Controller –Others … (e.g. Transaction Controller) Listeners –Simple Data Writer –Graph Results http://jakarta.apache.org/jmeter/usermanual/component_reference.html
12
Elements of a Test Plan Timers –The timer will cause a delay between each request that a thread makes. Assertions –The ‘test’ of the response from the server Configuration Elements –Sets default Pre-Processor / Post-Processor Elements http://jakarta.apache.org/jmeter/usermanual/component_reference.html
13
Execution order Timers Pre-Processors Sampler Post-Processors Assertions Listeners
14
JMeter User Interface The Test PlanLogin Sequence
15
View results summary
16
View results as graph
17
Portal Test Plans Performance testing –Real life usage Stress testing –Increasing number of users Soak testing –Varying how long test runs for, e.g. use loops System level testing –Using assertions
18
Simplest web test Thread Group HTTP Request - Sampler View Results in Table - Listener Demo – workshop_demo1.jmx
19
Simplest web test User Defined Variables – Configuration Element Constant Timer - Timer View Results in Tree Listener - Listener Demo – workshop_demo2.jmx
20
Simplest web test HTTP Header Manager – Configuration Element Simple Controller - Controller Response Assertion - Assertion Demo – workshop_demo3.jmx
21
Test Fragments for Portal Saved fragments of Test Plans –Login sequence –Response assertions –User agents –Load cluster settings
22
Portal Performance Test A Load cluster host names Load test users Do Login Test Login Generate next url based on tabs Loop: 1.Visit tab 1 2.Visit tab 2 3.Visit tab 1 4.Visit tab 3
23
HTTP Proxy Recorder Workbench -> HTTP Proxy Server –Cannot be used with over SSL
24
HTTP Proxy Recorder Configuring FireFox to use the Proxy Demo – workshop_demo _proxy.jmx
25
Using JMeter with Ant JMeter build.xml –Single JMeter target with 2 arguments script Paramter list Portal testing build.xml –One target for each scenario –Parameter – Environment –Parameters for e.g. number of users or running time Build.properties –List of server to use –List of users http://ant.apache.org
26
Tips Use timers to avoid hammering the server Limit the Number of Threads –Hardware will limit the number of threads you can effectively run. A faster machine makes JMeter work harder since it returns request quicker. User variables –Create a text file containing the user names and passwords. –Add a CSV DataSet configuration element. Name the variables USER and PASS. Use ${USER} and ${PASS} within samplers. Reducing resource requirements –Use non-GUI mode. –Use as few Listeners as possible. –Reduce samplers by looping (by thread and by controller), and use variables (CSV Data Set) to vary the sample. –Use CSV output rather than XML.
27
Resources Apache JMeter Home –http://jakarta.apache.org/jmeter/http://jakarta.apache.org/jmeter/ Useful Tutorials and Articles –http://javaboutique.internet.com/tutorials/JMeter/http://javaboutique.internet.com/tutorials/JMeter/ –http://venus.cs.depaul.edu/se591/JMeter11.ppthttp://venus.cs.depaul.edu/se591/JMeter11.ppt http://wiki.manchester.ac.uk/portal/ –See articles in the Testing category anthony.colebourne@manchester.ac.uk
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.