How to setup JMeter and run web services

  • Download the JMeter from the site – https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-3.2.zip
  • After extracting go inside the bin folder and run the ApacheJMeter executable jar file.
  • Now JMeter will get open.
  • Create a test plan and add the thread groups by selecting Add->Threads(Users)-> Thread Group.
  • Add the HTTP Header Manager by Right Click on Thread Group->Add->Config Element->HTTP Header Manager.
  • Add the Headers like Content-Type:application/json
  • Inside Thread group add HTTP sample by selecting Add->Sampler->HTTP Request
  • Make an HTTP request. Refer to the screenshots
  • Make the parameterization of email id and password by ${email} and ${password}.
  • Add the CSV Data Set Config ,Add->Config Element -> CSV Data Set Config for passing the values from CSV file to parameterized variables.
  • Place the CSV file inside the bin folder of JMeter and pass the name of the file.
  • Define the variable names
  • Pass the Delimiter used in CSV file
  • Add the JSON Extractor inside the HTTP Request by  Right Click on HTTP Request->Add->Post Processors->JSON Extractor
  • Add the json path of the keys that you want to extract and store it in a variable like $.data[*].id value from json will get the store in student_id variable.
  • Add the assertion in the response by Right Click on HTTP Request->Add->Assertions->Response Assertions
  • You can select any assertion type like Response code, Response Message etc. In the above screenshot, I have added the assertion for Response code that should be equal to the 200
  • Add the Results listener by Add->Listener->View Results Tree
  • Add the Summary report by Add->Listener->Summary Report
  • Now Run the script and see the results under Results and Report under Summary Reports.

Leave a Reply

Your email address will not be published. Required fields are marked *