JMeter set up and configuration
JMeter installation and configuration
Please follow the steps below for verifying HSLynk APIs using JMeter in Windows environment.
STEP 1: Download Apache JMeter 3.0
This is the version the APIs have been tested with and steps below will focus on the configurations that work with version. You are free to use latest version of Jmeter, if any, however, please check if you need to configure anything differently.
You can download JMeter 3.0 from the following link https://archive.apache.org/dist/jmeter/binaries/ STEP 2: Extract zip file
The script that was set up for verifying HSLynk uses the plug-ins below.
STEP 3 : Add Plug in 1 : JMeterPlugins-Extras-1.3.1.zip
- STEP 3.1: Download the plug-in above from the following link http://jmeterplugins.com/downloads/index.html
- STEP 3.2: Extract zip file
- STEP 3.3: Copy the jar files from the extracted location 1 - JMeterPlugins-Extras-1.3.1\lib\ext to the following location _<JMeter 3.0 extracted location>\lib\ext _
STEP 4 : Plug in 2 : JMeterPlugins-ExtrasLibs-1.3.1.zip
- STEP 4.1: Download the plug-in above from the following http://jmeterplugins.com/downloads/index.html
- STEP 4.2: Extract zip file
- STEP 4.3: Copy the jar files from the extracted location 2- \JMeterPlugins-ExtrasLibs-1.3.1\lib\ext to the following location <JMeter 3.0 extracted location>\lib\ext
Once these steps are complete, you can start using JMeter.
STEP 5: Start JMeter
Start JMeter by executing the jar file located in <JMeter 3.0 extracted location>\bin\ApacheJMeter.jar (double click on the jar file) https://github.com/servinglynk/hmis-lynk-open-source-docs/blob/master/doc/WikiContent/jmeter/start_JMeter.PNG Note: You need to get familiar with the following JMeter concepts to be able to test HSLynk APIs. http://jmeter.apache.org/usermanual/test_plan.html
- Configuring user defined variables
- Creating a Thread group
- Configuring HTTP sampler (to invoke a REST API)
- Configuring HTTP header manager
- Configuring JSON Path extractor (to extract a value from a API response and use the value as an input for the subsequent API call). For example, the session token that is returned by Login API need to be sent as a Authorization Header for the next request. So, you will extract the session token using JSON Path extractor to be able to use that in other API calls.
- Configuring Listeners (Summary report, view results in table, view summary report etc..)
- You can also add assertions as needed to verify the test results with expected results.
HSLynk API enforces Trusted App Id and Authorization token to be sent as part of HTTP request headers. In order to obtain authorization token, the /sessions API need to invoked first with a valid username / password and the token returned by the API should be passed on as a header, for subsequent API calls.