Git Product home page Git Product logo

load-tests-jmeter's Introduction

Using the JMeter Script

  1. Download and extract JMeter

https://jmeter.apache.org/download_jmeter.cgi

  1. Execute the GUI

    $ cd jmeter/bin
    $ ./jmeter
    
  2. Load the JMeter Script

  3. File > Open (CTRL + O)

  4. Locate the "jmeter/HTTP Request.jmx" file contained on this repo

  5. Open that file

  6. The Test Plan will be loaded

Test Plan

  1. Test Plan description

  2. The Test Plan item has general configuration about how the tests will run, for instance if the Thread Groups will run in parallel or sequential.

  3. The HTTP Request Defaults has some values that will be used by all HTTP Requests, like Server IP, Port Number, and Content Encoding.

  4. Each Thread Group defines how to execute the HTTP Requests. 1. Number of Threads: is used to know how many parallel "users" will be simulated. 2. Loop Count: defines how many actions each "user" will do.

  5. Inside Thread Groups, the first item is the HTTP Header Manager, that allows to define the Request Headers that will be used by the following HTTP Requests. Generally we use three headers: Content-Type, Prefer and Accept, but this depends on the specific REST service that will be invoked.

  6. On Thread Group 1, we have the HTTP Requests as direct children, since those are used to upload the OPTs that will be referenced from the COMPOSITION commits (mentioned below). 1. The HTTP Request item needs to specify the Method and Path (the rest of the parameters are taken from the HTTP Request Defaults item) 2. Inside each HTTP Request we have Listener items, those are used to display results from the executed HTTP Requests.

  7. On Thread Group 2, we have requests to create EHRs and commit COMPOSITIONs. 1. Multiplying Number of Threads by Loop Count, that will determine the total number of EHRs that will be created. 2. It contains a HTTP Header Manager item where the headers for the following HTTP Requests are configured. 3. The HTTP Request to POST /ehr creates one EHR, needs to Method and Path to be set, the rest are configured by the HTTP Request Defaults and the HTTP Header Manager. 4. Inside the HTTP Request to /ehr we have a JSON Assertion, used to check the format of the ehr_id, using a JSON Path to extract the value and a regex to check the value. 5. Then we have a JSON Extractor, that will extract a value from the JSON Path $.ehr_id.value and set the ehr_id variable, available for any step that comes after. 6. The View Results Tree Listener is included to see the details of each individual request to POST /ehr 7. And the Graph Results Listener is included to see the response times as a chart.

  8. After the POST /ehr HTTP Request we have Loop Controller items, each represents a number of requests to commit COMPOSITIONS on POST /composition, the Loop Count is used to specify how many executions of the internal HTTP Request will be executed, this allows to execute many POST /composition for each POST /ehr, since POST /composition needs the ehr_id extracted from the each EHR created.

  9. Inside each Loop Controller item, we have a POST /composition HTTP Request item, that needs the Method, Path and Body Data. The rest of the configuration is taken from the HTTP Request Defaults and the HTTP Header Manager.

  10. Inside each POST /composition HTTP Request, we have a View Results Tree item (to see the response of each individual request) and a Graph Results item (that charts the response times of the requests).

  11. On Thread Group 3, we have requests to POST /query/aql, to execute ad-hoc queries. 1. Contains a HTTP Header Manager with the Request Header configuration for all the HTTP Requests in the Thread Group. 2. Each Loop Controller item simulate many requests to each query execution. 3. The HTTP Request items execute one query, each query example was taken from the tests designed for Conformance Testing. 4. Inside each POST /query/aql HTTP Request, we have a View Results Tree item (to see the response of each individual request) and a Graph Results item (that charts the response times of the requests).

  12. Test execution from the GUI (only for testing the definitions, not to run the full load tests!)

  13. Just click on the Play icon to run the tests.

  14. If you select a listener (View Results Tree or Graph Results), you will see the results as they are coming.

  15. To clean the results, right click on the listener and select "Clear".

  16. Test execution (from the Terminal)

  17. JMeter should be initialized in non-gui mode.

  18. $ jmeter/bin/jmeter -n -t HTTP\ Request.jmx -l testresults.jtl

  19. -n: non GUI mode

  20. -t: test plan to execute

  21. -l: output file with results

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.