Soft Test Ireland - Introduction to Jakarta Jmeter - Philip Bannon


Published on

Published in: Technology
1 Like
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Soft Test Ireland - Introduction to Jakarta Jmeter - Philip Bannon

  1. 1. Introduction to Jakarta Jmeter <ul><li>With Philip Bannon
  2. 2. Mail: [email_address] </li></ul>
  3. 3. Presentation Objectives <ul><li>Give you an introduction into: </li><ul><li>Functional testing with Jmeter
  4. 4. Performance testing with Jmeter
  5. 5. Non-Functional testing with Jmeter </li></ul><li>Help you figure out if Jmeter is suited for testing your applications </li></ul>
  6. 6. Brief Introduction to Jmeter <ul><li>So what is Jmeter: </li><ul><li>Jmeter is an automated testing tool from the Jakarta project (active)
  7. 7. It's 100% Open Source
  8. 8. Written in Java so its completly portable
  9. 9. Can be used for Unit Test Tool for JDBC, FTP, LDAP, Web Services, JMS, HTTP and TCP connections (plus more) </li></ul></ul>
  10. 10. What can You do with it?? <ul><li>Most test related activities: </li><ul><li>Perform automated Functional Tests
  11. 11. Perform Performance tests ( Load, Stress, Soak)
  12. 12. Carry out Non-Functional Tests
  13. 13. Unit Testing </li></ul></ul>
  14. 14. Benifits of Using Jmeter <ul><li>Excellent cost saving solution for small projects as it is an open source tool
  15. 15. Robust in handling complex test scenarios that demand ‘n’ number of virtual users.
  16. 16. Complete portability and supports 100% all the Java based applications.
  17. 17. Less scripting efforts as compared to other tools because of its user effective GUI.
  18. 18. Really Designed to conduct Load, Stress, Volume & Endurance tests on the Web & Webservice based applications
  19. 19. HTTP & HTTPS load testing can be done without any adding additional pluggable samplers </li></ul>
  20. 20. How Jmeter works Jmeter simulates a group of users sending requests to a target server, and return statisticts that show the perfomance / funcationality of the target server / application via tables, graphs etc. Start Creates requests to target server and simulates a number of users End Jmeter gathers Data to calculate Statistical info Server Responds Jmeter Saves All Responses Report
  21. 21. Build Blocks <ul><li>Test Plan
  22. 22. Thread Group
  23. 23. Controllers & Config elemets
  24. 24. Samplers
  25. 25. Listeners
  26. 26. Timers
  27. 27. Assertions
  28. 28. Pre-Processor Elements
  29. 29. Post Processor Elements </li></ul>
  30. 30. Thread Group <ul><li>Thread Group elements are the beginning points of your test plan. All samplers and controllers are children of a thread group node.
  31. 31. As the name suggests, the thread group elements controls the number of threads Jmeter will use during the test.
  32. 32. We can also control the following via the thread Group: </li><ul><li>Set the number of Threads
  33. 33. Set the Ramp Up Time
  34. 34. Set the number of test itterations </li></ul></ul>
  35. 35. Controllers & Config Elements <ul><li>Logic Controllers: </li><ul><li>Logic Controllers let you control the flow of your test for example you can have IF conditions for selecting certain samplers. </li></ul><li>Configuration Elements: </li><ul><li>Config elements can be used to set up defaults and variables for later use by samplers. </li><ul><li>HTTP Manager
  36. 36. HTTP Request Defaults
  37. 37. Cache Managers
  38. 38. Cookie Manager </li></ul></ul></ul>
  39. 39. Logic Controllers <ul><li>Logic Controllers let you control the flow of your test.
  40. 40. Logic Controllers can change the order of request coming from any of their child elements
  41. 41. Some Examples: </li><ul><li>ForEach Controller
  42. 42. While Controller
  43. 43. Loop Controller
  44. 44. IF Controller
  45. 45. Run Time Controller
  46. 46. Interleave Controller
  47. 47. Throughput Controller
  48. 48. Run Once Controller </li></ul></ul>
  49. 49. Samplers <ul><li>Samplers tell Jmeter to send requests to a server. For example, you can add a HTTP Request sampler if you need to perform a POST, GET, DELETE on a HTTP service
  50. 50. Some usefull samplers: </li><ul><li>HTTP Request
  51. 51. FTP Request
  52. 52. JDBC Request
  53. 53. Java Request
  54. 54. SOAP/XML Request
  55. 55. RPC Requests </li></ul></ul>
  56. 56. Listeners <ul><li>Listeners provide access to the information that Jmeter gathers about the tests which are executing. For instance Response codes, messages etc. Some Listeners are: </li><ul><li>View Results Tree: </li><ul><li>This shows the details of the sampler requests and the responses and can display them in different formats </li></ul><li>Summary Report: </li><ul><li>This shows a summary in tabular form of the results from executing samplers </li></ul><li>Graph Results: </li><ul><li>This will show us the response times and response codes on a graph </li></ul></ul><li>Listeners can write their information out to files in XML or CSV format </li></ul>
  57. 57. <ul>Timers </ul><ul><li>By default, a Jmeter thread will send send requests without pausing between each sampler. This may not be what you want....
  58. 58. We can add a timer element which will allow us to define a period to wait between each request.
  59. 59. Timers can act as a throttle!
  60. 60. Note the scope of the Timer! </li></ul>
  61. 61. <ul>Assertions </ul><ul><li>A test isn't a test unles it checks something!
  62. 62. Assertions are what do the checking
  63. 63. Assertions allow you to assert facts about the responses received from the application under test. Using assertions you can prove that your application is returning the correct data.
  64. 64. Jmeter will highlight when an assertion fails </li></ul>
  65. 65. <ul>Pre-Processor & Post Processor </ul><ul><li>A Pre-Procesor is something that will happen before a sampler executes.
  66. 66. A Post Processor executes after a sampler finishes its execution.
  67. 67. The are usufull processing the response which is recieved from the application
  68. 68. For exmple: </li><ul><li>Perfoming Xpath Extractions
  69. 69. Regular Expression Extractions </li></ul></ul>
  70. 70. Lets do a functional Test <ul><li>DEMO!! </li></ul>
  71. 71. Record and playback <ul><li>Jmeter can act as a proxy server between your browser and the web recording your actions.
  72. 72. This can help in writing your web tests.....
  73. 73. Lets do another small demo? </li></ul>
  74. 74. Performance Testing <ul><li>Good Performance testing </li></ul>
  75. 75. What is performance testing <ul>Performance Testing sets the ‘best possible’ performance expectation under a given configuration of infrastructure. It also highlights early in the testing process if changes need to be made before application goes into production </ul>
  76. 76. Aims of Performance Tests <ul><li>What level of load can your Application handle
  77. 77. How fast your system will perform
  78. 78. Find bottlenecks
  79. 79. Determine how much hardware you'll need for Production (scalability)
  80. 80. How reliable is your software </li></ul>
  81. 81. Some definitions <ul><li>Load Testing </li><ul><li>Load testing identifies the maximum operating capacity of your app as well as any bottlenecks </li></ul><li>Stress Testing </li><ul><li>Stress testing is focused on finding out the robustness and availability of your app under heavy loads (When will your system fail?) </li></ul><li>Soak Test </li><ul><li>Like load but over a long duration </li></ul><li>Scalabitilty testing </li><ul><li>This will determine whether adding extra hardware will increase your apps response time </li></ul></ul>
  82. 82. Performance Testing <ul><li>The Usual Problem </li><ul><li>Write Code
  83. 83. Execute Unit Tests
  84. 84. Pass it to QA
  85. 85. Just before Production do some Performance testing....and Panic!! </li></ul></ul>
  86. 86. A Better Way <ul><li>Performance test artifacts as soon as they pass Unit and Functional Testing
  87. 87. Fast feedback for Dev's
  88. 88. No Suprises
  89. 89. Get the software out the door on time!!! </li></ul>
  90. 90. What do you need for Performance Testing <ul><li>System Under Test i.e. Your application!
  91. 91. Benchmark & Profile
  92. 92. Realistic Hardware of what is or will be in production
  93. 93. Load Generating machines (Jmeter)
  94. 94. Monitoring tools
  95. 95. Data Repository
  96. 96. Prepare your environment (Network, storage etc)
  97. 97. Isolation! </li></ul>
  98. 98. Traffic Model, Traffic Model, Traffic Model! <ul><li>Without a Traffic Model you just putting load on your server for the sake of it!
  99. 99. Based on projections you should be able to work out what your users will be doing and how often!
  100. 100. This can all be reflected in your test! </li></ul>
  101. 101. Demo <ul><li>Lets write a basic script in Jmeter to test performance of a HTTP web app </li></ul>
  102. 102. Non-Functional Testing with Jmeter <ul><li>Demo </li></ul>
  103. 103. Automated Testing <ul><li>Jmeter integrates seemlessly with CL tools </li><ul><li>ANT
  104. 104. HTML Report Generation </li></ul></ul>
  105. 105. Q&A <ul><li>Questions and hopefully answers </li></ul>