Upload
cristian-fhomer
View
20
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Herramienta para testing Software
Citation preview
JMeter WorkshopFriday 1 December 2006
Anthony ColebourneIT ServicesThe University of Manchester
What is JMeterApache 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 interfaceBuilt in JavaPart of Apache Jakarta projectCan 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.
Features of JMeterGraphical Analysis / Exporting Test ResultsRemote Distributed ExecutionIf 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.html Highly ExtensibleCustom Additions (Write your own samplers / listeners)PlugInsTest plans stored in XML and can be version controlled.
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.
Setting Up and Running JMeterDownload the binary from Jakartahttp://jakarta.apache.org/jmeter/Its 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
JMeter Control Panel
Test PlanA 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.
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.
Elements of a Test Plan ThreadGroupSet the number of threads Set the ramp-up period Set the number of times to execute the test SamplersHTTP Request JDBC Request LDAP Request WebService (SOAP) Request Logic ControllersSimple Controller - The Simple Logic Controller lets you organize your Samplers and other Logic ControllersLoop ControllerOnce Only Controller Interleave ControllerThroughput ControllerOthers (e.g. Transaction Controller)ListenersSimple Data WriterGraph Resultshttp://jakarta.apache.org/jmeter/usermanual/component_reference.html
Elements of a Test Plan TimersThe timer will cause a delay between each request that a thread makes.AssertionsThe test of the response from the serverConfiguration ElementsSets defaultPre-Processor / Post-Processor Elementshttp://jakarta.apache.org/jmeter/usermanual/component_reference.html
Execution orderTimersPre-ProcessorsSampler Post-Processors Assertions Listeners
JMeter User InterfaceThe Test PlanLogin Sequence
View results summary
View results as graph
Portal Test PlansPerformance testingReal life usageStress testingIncreasing number of usersSoak testingVarying how long test runs for, e.g. use loopsSystem level testingUsing assertions
Simplest web testThread GroupHTTP Request - SamplerView Results in Table - Listener
Demo workshop_demo1.jmx
Simplest web testUser Defined Variables Configuration ElementConstant Timer - TimerView Results in Tree Listener - Listener
Demo workshop_demo2.jmx
Simplest web testHTTP Header Manager Configuration ElementSimple Controller - ControllerResponse Assertion - Assertion
Demo workshop_demo3.jmx
Test Fragments for PortalSaved fragments of Test PlansLogin sequenceResponse assertionsUser agentsLoad cluster settings
Portal Performance Test ALoad cluster host namesLoad test usersDo LoginTest LoginGenerate next url based on tabsLoop:Visit tab 1Visit tab 2Visit tab 1Visit tab 3
HTTP Proxy RecorderWorkbench -> HTTP Proxy ServerCannot be used with over SSL
HTTP Proxy RecorderConfiguring FireFox to use the Proxy
Demo workshop_demo_proxy.jmx
Using JMeter with AntJMeter build.xmlSingle JMeter target with 2 argumentsscript Paramter listPortal testing build.xmlOne target for each scenarioParameter EnvironmentParameters for e.g. number of users or running timeBuild.propertiesList of server to useList of usershttp://ant.apache.org
TipsUse timers to avoid hammering the server
Limit the Number of ThreadsHardware will limit the number of threads you can effectively run. A faster machine makes JMeter work harder since it returns request quicker.User variablesCreate 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 requirementsUse 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.
ResourcesApache JMeter Homehttp://jakarta.apache.org/jmeter/ Useful Tutorials and Articleshttp://javaboutique.internet.com/tutorials/JMeter/ http://venus.cs.depaul.edu/se591/JMeter11.ppt http://wiki.manchester.ac.uk/portal/See articles in the Testing [email protected]