31
Fiddler ENHANCE YOUR WEBTESTING SKILLS WITH FIDDLER 1

Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Embed Size (px)

Citation preview

Page 1: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Fiddler ENHANCE YOUR WEBTESTING SKILLS WITH FIDDLER

1

Page 2: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Agenda

> What is Fiddler and how does it work?

> Inspecting traffic

> Modifying traffic: Breakpoints, Composer and AutoResponder

> Live examples

> Q&A session

2

Page 3: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

About

> http://www.telerik.com/download/fiddler

> Created by Eric Lawrence

> First version was released in October 2003

> Distributed by Telerik since 2012

3

Page 4: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Early Fiddler version:

4

Page 5: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Current Fiddler version:

5

Page 6: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

What is Fiddler and how does it work?

6

Page 7: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Intercepting traffic

> No browser/platform restrictions

> Allows capturing traffic from remote locations

> Intercepts traffic sent over:

◦ http and https

◦ ftp

◦ WebSockets

7

Page 8: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Https? > Fiddler uses self-signed certificates, they are not trusted by default

> Similar to the 'Man in the middle' attack

> Each generated certificate has it's own private key

Hint: FiddlerHook add-on for Mozilla provides an easy way to add the certificate to Mozilla trusted CAs.

8

Page 9: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Filters > Has strong filtering options:

◦ drag and drop on process

◦ filter by origin,

◦ hostname,

◦ request header,

◦ response type,

◦ response size, ...

Hint: You can save the filters you have created and import them in a later session or pass them to a colleague in need :).

9

Page 10: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Statistics and Timeline > Shows statistics for the selected sessions

> Timeline diagram in streaming and buffering mode

> Gives an estimate on load times from various client locations

Hint: Pressing ‘p’ will select the parent request, while pressing ‘c’ will select all child requests of the selected session.

10

Page 11: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Exporting/Importing sessions > Save the entire collection or only a single item

> Save only session request or session response

> Export as cURL script or .webtest

> Export/import .saz files

Hint: Adding a .saz archive to a bug report makes it always 'Always reproducible'. (You can include a screenshot too.)

11

Page 12: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

FiddlerCap

12

Page 13: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

DEMO INTERCEPTING HTTPS, INSPECTORS, FILTERS

13

Page 14: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

How can I use Fiddler to... TEST IF ALL IMAGES FROM MY WEBSITE ARE PROPERLY CACHED?

14

Page 15: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

How can I use Fiddler to... ISOLATE WHY AN ISSUE REPRODUCES ONLY ON A CERTAIN ENVIRONMENT?

15

Page 16: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Reissuing requests

> Replay a single request or a chain of requests

> Reissue and repeat the same request for several times.

> Reissue and edit

16

Page 17: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Breakpoints > Allows editing of 'real-time' web traffic

> Easiest way to enable is from Rules/Automatic Breakpoints

> Downside is that is has weak filtering possibilities

Hint: Typing 'g' in the QuickExec bar will release all paused traffic.

17

Page 18: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Breakpoints

Before Request

After Response

18

Page 19: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Breakpoints

19

Page 20: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

AutoResponder > Define a rule to identify a request and then return a custom response.

> Response are returned without hitting the actual server

> Offers a list of predefined responses

> Matching rules are very configurable

> Drag and drop for easy set-up

> Possibility to add latency for a response

Hint: Don't forget to tick 'Unmatched responses pass through' if you want to mock the response of a specific response

20

Page 21: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Composer > Create and execute http requests without recording them first

> Drag and drop a session into the Composer tab to prefill data

> Has a request history log

Hint: In 'Options' tab make sure you have: “Fix Content-Length Header” and “Follow Redirects” checked

21

Page 22: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

DEMO BREAKPOINTS, AUTORESPONDER, API CALL

22

Page 23: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

How can I use Fiddler to... TEST SERVER SIDE VALIDATIONS?

23

Page 24: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

How can I use Fiddler to... TEST CLIENT SIDE TIMEOUT SETTINGS?

24

Page 25: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

How can I use Fiddler to... TEST OFFLINE BEHAVIOR?

25

Page 26: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

How can I use Fiddler to... MOCK THIRD PARTY APIS?

26

Page 27: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

How can I use Fiddler to... TEST BEFORE THE UI IS READY?

27

Page 28: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Take Away: > Inspect internet traffic, even https

> Can capture traffic from any device

> Saving the entire session list will document the entire user flow.

> Compare sessions to isolate issues

> Use breakpoints to modify real traffic (ex: bypass client validation, mock server errors, ...)

> Use AutoResponder to mock third APIs, delay/block content or simulate offline browsing

> Use Composer to test server side components before the UI is ready

> There is plenty more to say about Fiddler, check out the documentation provided by Telerik http://docs.telerik.com/fiddler

28

Page 29: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Thank you! [email protected]

29

Page 30: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

EXTRA: Fiddler script > Written in Jscript.NET

> All options provided in the Rules menu are actually reflected in FiddlerScript

> FiddlerScript Editor allows some easy manipulation of the script, it even has intellisense build in.

> Allows automatic manipulation of requests and responses. You can change Headers, Body text, redirect URL, basically anything you need :)

> Allows UI customization

30

Page 31: Fiddler - Meetupfiles.meetup.com/3106682/Fiddler_OZ.pdf · > Export as cURL script or .webtest ... Fiddler script > Written in Jscript.NET > All options provided in the Rules menu

Fiddler script examples: > Add a custom column that shows the client ip:

// Add in Main() function

FiddlerObject.UI.lvSessions.AddBoundColumn("Client IP", 120,"x-clientIP");

> Redirect traffic from one host to another:

// In OnBeforeRequest add:

if (oSession.HostnameIs("www.bing.com")){ oSession.bypassGateway = true;

oSession["x-overrideHost"] = "www.google.com";}

31