0

How to Automate web services using JMETER?

I need to check URL links are working and image are loading properly and with the response code given.

see more details in below example, i just want to check that highlighted links(blue color) are working fine through jmeter.

just think this is web service url -> https://api.github.com/users/lrei

{
  "login": "lrei",
  "id": 35857,
  "avatar_url": "**https://avatars.githubusercontent.com/u/35857?v=3**",
  "gravatar_id": "",
  "url": "**https://api.github.com/users/lrei**",
  "html_url": "**https://github.com/lrei**",
  "followers_url": "**https://api.github.com/users/lrei/followers**",
  "following_url": "https://api.github.com/users/lrei/following{/other_user}",
  "gists_url": "https://api.github.com/users/lrei/gists{/gist_id}",
  "starred_url": "https://api.github.com/users/lrei/starred{/owner}{/repo}",
  "subscriptions_url": "https://api.github.com/users/lrei/subscriptions",
  "organizations_url": "https://api.github.com/users/lrei/orgs",
  "repos_url": "https://api.github.com/users/lrei/repos",
  "events_url": "https://api.github.com/users/lrei/events{/privacy}",
  "received_events_url": "https://api.github.com/users/lrei/received_events",
  "type": "User",
  "site_admin": false,
  "name": "Luis Rei",
  "company": null,
  "blog": "http://luisrei.com",
  "location": null,
  "email": "me@luisrei.com",
  "hireable": null,
  "bio": null,
  "public_repos": 31,
  "public_gists": 3,
  "followers": 36,
  "following": 2,
  "created_at": "2008-11-21T14:48:42Z",
  "updated_at": "2017-01-04T05:43:28Z"
}
  • Can you give more information about what exactly it is that you are looking for? JMeter is a performance testing tool and your description of the question suggests that you are looking to do a functionality or link testing! – IAmMilinPatel Jan 30 '17 at 3:23
  • @TESTasy i have updated issue description could you please look in to this? – lak Jan 30 '17 at 5:32
  • Found no references to the images in the provided json? – Rao Jan 30 '17 at 6:53
  • @Rao this is image -> avatars.githubusercontent.com/u/35857?v=3 – lak Jan 30 '17 at 15:44
  • I meant that where in the json has the reference to the images. Haven't found any keys related to that. – Rao Jan 30 '17 at 15:45
2

I wouldn't recommend using Selenium for API testing as using browser it will be very tricky to send HTTP requests other than GET and manipulate request body and headers. Check out Testing SOAP/REST Web Services Using JMeter article for more information on web services load testing

1

As I understood that, your requirement is to test URLs and their status codes. For this, you does not require jmeter. Even if you want to test in jmeter then you need to follow below steps,

  1. Create a test plan
  2. Add a HTTP Sampler and configure the web service URL
  3. Add a Post Processor and collect the required info and save it into variables
  4. For checking the URLs and images, create separate samplers and add assertions as per your requirement.

I suggest, as per your requirement, you can use Selenium/java. Please review the below attached link API Automation link

I hope my answer will help you

0

@Dmitri T @TESTasy @QAMember @Rao

I have created Jmeter test plan see in below, and now i want to check the urls marked in red arrow(which are in json response). how is it possible to check them are working fine with response assertions?? could please show me as by getting this example?

enter image description here

=====================================================

After adding JSON extractor and Debug Sampler avatar_url=https://avatars.githubusercontent.com/u/35857?v=3 shown like below, but i want to check that this url working properly or not does it check according to this way?

  • Now add a JSON Extractor after HTTP Request enter "$.html_url" in JSON Path Expressions. Create another Http Request and add this variable to it. – QAMember Jan 31 '17 at 5:56
  • May be this link will helpful for you charithaka.blogspot.in/2014/05/… – QAMember Jan 31 '17 at 7:17
  • Hi @QAMember see above screen i updated i want to check yellow highlighted url is working fine or not(by clicking) is it checking in that Debug sampler? – lak Jan 31 '17 at 12:23
  • checking means, what you want to check in that url ?? – QAMember Jan 31 '17 at 14:28
  • @QAMember i want to check that this url is loading properly or not giving 404 or not crashing.. so..on is it possible to check? – lak Jan 31 '17 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.