Telerik blogs
TW_870x220

In part 1 and part 2 of this Fiddler how-to series, we covered the basics of the Composer tab and how it makes your life better. Now to the best part – automation.

Manually testing API calls is OK when we're initially developing the service. But what about when we change something? Should we execute all these requests again, one by one, and verify the responses? Or even worse, go through the UI and click every single button again? No! Fiddler Classic and Fiddler Everywhere have got you covered here. Again.

The API Test Fiddler extension greatly enhances its power to execute and validate the behavior of web APIs. Just go to View > Tabs > APITest to show the APITest tab.

api

Creating a Test

You can create a new test by simply dragging and dropping sessions from Fiddler’s Sessions list. You can then use the context menu to specify a Validator and optionally mark it with a Note (comment) or assign it to a group.

Setting a Validator

With validators you can specify if a test is success or failure. Fiddler tooling supports the following validator types:

  • EXACT: Ensures that body contains (case-sensitively) the text
  • REGEX: Ensures that body matches the text
  • NOT: Ensures that body doesn’t contain the text
  • {CODE}: Ensures that the response status code matches the original status.
  • {BODY}: Ensures that body is identical
  • HEADER: Ensures that the response bears a specified header containing a given value
  • SCRIPT: This prefix allows you to specify a FiddlerScript function in your CustomRules.js file to use to evaluate the response

Working with Test Lists

Test List is a set of Sessions that contain several specific session flags. They can be easily exported as a SAZ files and their “Test List” functionality will only light up when loaded into the APITest tab. This functionality is available through the contextual menu.

api-2

Disabling Tests

You can temporarily disable one or more tests from running by pressing the spacebar with the desired tests selected.

FiddlerScript Events

Fiddler supports two test list events that can be used:

  • BeforeTestList: Fires before the Test List is executed
  • AfterTestList: Fires after all of the tests in the Test List are executed

Conclusion

Telerik Fiddler’s APITest tab can help you test your REST APIs with ease, allowing you to make sure you maintain good quality, even when changes are made.

P.S. Don’t forget to follow us on Twitter to get the latest news, tips and tricks and more 😉


Kamen Velikov
About the Author

Kamen Velikov

Kamen is software developer and manager of the Fiddler team at Progress. He has more than 11 years of professional experience in software development. Programming has always been his passion and he feels lucky to work his hobby. In his free time, he enjoys traveling, motorcycling, freshly-roasted coffee, and trying new experiences. Geek by design. Writing is a new thing to him and he’ll appreciate your feedback and comments. 

Related Posts

Comments

Comments are disabled in preview mode.