Handling RESTful web services
An increasing number of applications are shifting to RESTful web services due to their simplicity to build, test, and consume compared to their SOAP counterparts. All REST communication is done over the HTTP protocol between the parties involved. HTTP is used for CRUD (create, read, update, and delete) operations. The built-in HTTP Request sampler in JMeter is more than up to the task. It supports GET
, POST
, PUT
, and DELETE
operations, among other things. The body of the request can be in XML or JSON format. An HTTP Header Manager component can be used to send additional HTTP header attributes if needed.
In our sample, we are going to create a new person in our sample application using a POST
request, and then verify that the person was actually created using a GET
request:
Create a new test plan.
Add a new Thread Group (by navigating to Test Plan | Add | Thread Group).
Add an HTTP Request sampler (this retrieves all the people records in our application so far...