+ All Categories
Home > Technology > Testing Rest API is using Fiddler by RapidValue Solutions

Testing Rest API is using Fiddler by RapidValue Solutions

Date post: 16-Apr-2017
Category:
Upload: rapidvalue
View: 1,395 times
Download: 2 times
Share this document with a friend
14
Testing REST APIs using Fiddler Presented by: Salu K S Designation: Software Test Engineer
Transcript
Page 1: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

Presented by: Salu K S

Designation: Software Test Engineer

Page 2: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

2

Contents

Executive Summary ....................................................................................................................................................... 3

Testing Rest APIs Using Fiddler .................................................................................................................................... 3

Overview of Fiddler ........................................................................................................................................................ 3

Testing “GET” Calls ........................................................................................................................................................ 4

Testing POST calls ........................................................................................................................................................ 7

Conclusion ................................................................................................................................................................... 13

Page 3: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

3

Executive Summary Fiddler is considered to be a really powerful web debugging proxy which logs all HTTP(S)

traffic between the computer and the internet. It allows you to inspect traffic, set breakpoints,

and lets you “fiddle” with the incoming or outgoing data. It helps the developers in identifying

potential scalability issues and eventually, evaluates application performance in various

production scenarios. Developers are able to configure multiple load test parameters like

number of test iterations or test execution time, think times, virtual users, load patterns, web

browsers, network type and warm-up times. When it comes to debugging HTTP on your local

machine, Fiddler is the best. It can intercept HTTP requests and responses. Fiddler has a very

powerful IDE that adds a lot of extra advanced features which further, helps you to monitor and

troubleshoot your HTTP calls.

Testing Rest APIs Using Fiddler REST is defined as a set of architectural principles by which you can design Web

services that focus on a system’s resources including how resource states are addressed

and transferred over HTTP, by a wide range of clients, written in different languages.

REST, typically, runs over HTTP. The idea is that rather than using complex methods,

simple HTTP request are used to make calls between the machines.

RESTful applications use HTTP requests to post data (create and/or update), read data

(e.g., make queries), and delete data.

This basic REST design principle establishes a one-to-one mapping between create,

read, update, and delete (CRUD) operations and HTTP methods. According to this

mapping:

o To create a resource on the server, use POST.

o To retrieve a resource, use GET.

o To change the state of a resource or to update it, use PUT.

o To remove or delete a resource, use DELETE.

Overview of Fiddler

Fiddler is a free and open-source packet analyzer. It is used for network

troubleshooting, analysis, software, communications protocol development and

education. Fiddler captures HTTP and HTTPS traffic data between the browser and

server. These data are extremely valuable to troubleshoot HTTP, JavaScript errors and

performance issues, related to browser page rendering,

Fiddler sits between the http client and http server listening on a port for traffic. As the

finger displayed below, it enables a proxy between two layers to intercept the traffic,

Page 4: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

4

the request being taken does not proceed to server directly, instead, it is sent to Fiddler

Proxy Bridge, Fiddler records the incoming and outgoing data and then forwards it to

the server again.

Testing “GET” Calls

Launch Fiddler (You can download from here)

Sample GET API

http://test.com:8053/ABCSvc/api/Template/GENL?_dc=1439552818328&ssid=12410

7B6-2AB6-435B-9BF6-F2B8D4B61BBB&username=test

Page 5: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

5

z

Go to composer and select GET.

Page 6: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

6

Paste the URL in text box near to “GET” and click on Execute.

Next, wait for the Response code 200 in left panel. Success code 200 tells the user

that request has been fulfilled.

Page 7: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

7

On double clicking the successful API, notice the response at the bottom half of the

right panel. This displays entire response sent back from the server to client

browser. It can be in HTML page, image, JSON string, CSS and other resources. When

we can click on text view, syntax view, Image view and other clickable tabs to view it

in different format. Also Compare whether API returned values are correctly mapped

to UI.

Testing POST calls

Sample Post API

http://test.com:8053/ABCSvc/Entity/Retrieve?ssid=124107B6-2AB6-435B-9BF6-

F2B8D4B61BBB&username=test

Parameters to be send in API

{"ent":"vemplateType","fltr":[{"fld":"TemplateCode","oper":"notlike","val":"%test%"},{"fld":"IsActive","oper":"eq","val":"1"}],"flds":["TemplateTypeID","TemplateTypeName","TemplateID","TemplateCode","TemplateName","ClassID","ClassCode","ClassName","ProjectTypeID","ProjectTypeCode","ProjectTypeName","TypeID","TypeCode","TypeName"],"ordby":[{"fld":"TemplateTypeName","dir":"asc"}]}

Page 8: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

8

Go to composer and select POST and paste the URL.

Enter your Request Headers and parameter in the tab Parsed or Raw.

Giving Request Headers

Give the request headers in Parsed tab

Page 9: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

9

Giving Parameters

Format the request parameters using json.

Give the parameters in Request Body Block and click on execute.

Next, wait for the success code 200 in left panel.

Page 10: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

10

Double click on API URL, it will give you the response sent back to client browser

from server.

You can try different combination (both valid and invalid) in Post request to check

whether API is responding properly for different combinations.

Monitoring APIs in Parallel with running application

Before running the application, open the fiddler.

Now take the URL in fiddler supported browser.

The APIs calling for each action will be tracked in fiddler.

For example:

If you want to capture the APIs while logging into an application, take the URL in browser

and input username and password. Click on sign-in.

Page 11: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

11

After signing in monitor fiddler, you can see all the APIs called during sign-in.

From the statistics tab, user can monitor the performance statistics of the selected

HTTP response. Certain permanence parameters like, request count, actual

performance timings, response bytes etc. will help in fine tuning the API.

Page 12: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

12

Also, you can save the sessions in zip and execute later.

Page 13: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

13

Conclusion

The most popular tool for testing the Web API is Fiddler. This is a very handy tool which is

useful in all circumstances and Fiddler overwhelms you with all the available options. Using a

tool like Fiddler, the services team can ensure that the web services work as they are intended

to do. It is essential and useful for Troubleshooting issues with your web application, Security

testing, Performance evaluations and Debugging web traffic from most computers and devices.

Fiddler has become an indispensable part for testing REST API’s.

Page 14: Testing Rest API is using Fiddler  by RapidValue Solutions

Testing REST APIs using Fiddler

© RapidValue Solutions

14

About RapidValue

RapidValue is a leading provider of end-to-end mobility, omni-channel and cloud solutions to

enterprises worldwide. Armed with a team of experts in consulting, UX design and application

development, along with experience delivering global projects, we offer a range of mobility

services across industry verticals. RapidValue delivers its services to the world’s top brands

and Fortune 1000 companies, and has offices in the United States and India.

Disclaimer:

This document contains information that is confidential and proprietary to RapidValue Solutions Inc. No part of it may be used,

circulated, quoted, or reproduced for distribution outside RapidValue. If you are not the intended recipient of this report, you are hereby

notified that the use, circulation, quoting, or reproducing of this report is strictly prohibited and may be unlawful.

www.rapidvaluesolutions.com/blog

www.rapidvaluesolutions.com

+1 877.643.1850

[email protected]


Recommended