Before we start Api automation with jmeter you can see below youtube video for better understanding.
Rest Api Automation with jmeter youtube video
Api Automation with Apache Jmeter Steps
Step-1 To install meter firstly install jdk and jre. To learn how to install jdk and jre Click here
Step-2 Install the latest version of jmeter through the apache jmeter official site Click here
Step-3 Now after completion of download install the zip file and run the jmeter.bat file present in bin folder (E:\Software\jmeter\jmeter\bin) you can install in your chooses directory.
Step-4 Firstly add Thread Group in the Test Plan. To do so right click on Test Plan then click on Add >> Thread (Users) >> Thread Group.
Step-5 Now to test the REST apis create a HTTP Request. To create HTTP Request right click on the Thread Group (let us named it as API Test) and then click on Sampler and then choose HTTP Request.
Step-6 Now fill the details of API i.e. Server Name or IP, Method, Path, Api Parameters.
Step-7 Now to check the result we have to add a Listener i.e View Result Tree. To do so right click on your app then click on Add>> Listener >> View Result Tree.
Step-8 Now Save and click run to check the result.
Now we are getting a response from api Now time to put some checks to verify that api result is right that we are expecting or it has some issue or not getting data as we are expecting. Follow the below steps to verify rest api response.
Step 1. Add Json Extractor Click here to see how to use jmeter extractor in api.
Step 2. Add Json path assertion Click here to see how to use them in api.
Step 3. Add Response Assertion to verify that are we getting any php or html code in api response. Add Thread > Assertion > Response assertion.
Step4. Check No on pattern matching rule to verify that given statement should not exist in api response in the pattern.
Step5. write your statement in pattern to test text area.
Congrats you have successfully created a Rest Api automation test.
If you want to do advance api automation and want to write own checks you can use JSR233 Assertion in groovy scripting(don’t afraid of scripting if you know c language and java core basic you can do) Click here to see.
I Hope you get it that you looking for or want to know how to do it. Kindly share your views and like us and subscribe to our YouTube channel Click here to subscribe to latest update about testing it can be automation or manual.