Podcast

137: APIs and Automated Testing with Bas Dijkstra

By Test Guild
  • Share:
Join the Guild for FREE
Bas Dijkstra


Is API testing at the top of your list of things to do this year? Not sure where to start? Or are you currently testing APIs but want to know more about mocking or service virtualization? In this episode Bas Dijkstra, founder of the blog ontestautomation and author of the book Service Virtualization: Implementation, Practices, and Trends for On-Demand Test Environments, shares with us some tips, tools and best practices around API testing.

About Bas Dijkstra

Bas Dijkstra Headshot

Bas is a test automation and service virtualization consultant who's always looking for more intelligent ways to use tools to improve test processes and software quality. He is also the founder of the blog ontestautomation and author of the O'Reilly book Service Virtualization: Implementation, Practices, and Trends for On-Demand Test Environments.

>Quotes & Insights from this Test Talk with Bas Dijkstra

  • In those cases it would be a good idea to at least try and find out if there's an API that exposes that application logic to you, and start writing your automation against that. From my current work there's one example that I've already coded a couple of times which was a … Workshop, based in the US actually, it does sell electronic cigarettes and all kinds of accessories for that. Because I heard they are selling those products in the United States and their selling different kinds of product categories. There are almost 50 different states, each with their own rules and regulations around electronic cigarettes and customers have different ages of course, different dates of birth, then their classified in different age groups.
  • If the only part of your test that's featuring the UI is validating whether data is present or data is presented in a given manner or perspective manner, then why waste time and effort writing and running automated tests through user interface just to set up your starting point of your test or the extracted the test preconditions.
  • For anybody who knows a little about Selenium web drivers that it's a … I'm not even call it a test tool per say, because it's a browser automation tool that simulates the interaction of a user with a browser. It does not simulate the interaction of a user of a system we make. That should make it pretty clear that Selenium is not a tool for API testing. Well of course, if you have a user interface base or custom framework which is built around Selenium web browser you could easily extend that framework to include API testing, but you need a different tool or library for doing that.
  • Also, for those of you watched my session on the Automation Guild, I'm a big fan of using REST-assured for that. Just because it's integrates seamlessly with your any existing automation framework, which written in Java, because it has an easy yet powerful interface or API itself. The actual API of Rest-assured is really powerful, so it helps you to write really powerful, yet really readable and maintainable tests on the API level. So, that would be my first … best suggestion that of course there are also other ways to do exactly the same thing. You can leverage or write something around the HTTP client library yourself, or any other Java or whatever language that you are using. Any kind of library that allows you to search requests and catch validated responses on the API level or the HTP level yourself.
  • One possible approach to tackling that problem is using, as you said in the question, mark steps or service fertilization as an approach of simulating the behavior of those dependencies instead of having to deal with managing the dependencies themselves you build simulations using a mocking library or stubs or service virtualization solutions which simulate the behavior of the dependency that you want to use in your tests and integrations and your end to end tests.
  • To improve your API test automation efforts is basically a more general tip. Just start exploring your applications and see whether there is anything that you are currently testing at the user interface level which you could also test sufficiently and just as effectively on the API or maybe on the unit test level. So don't think you have to do everything through the user interface, but try and explore, ask around or use a tool like Fiddler to explore your application to see what APIs are available what business logic they expose and how you can leverage those for more efficient test automation in general.

Connect with Bas Dijkstra

May I Ask You For a Favor?

Thanks again for listening to the show. If it has helped you in any way, shape or form, please share it using the social media buttons you see on the page.

Additionally, reviews for the podcast on iTunes are extremely helpful and greatly appreciated! They do matter in the rankings of the show and I read each and every one of them.

SponsoredBySauceLabs

Test Talks is sponsored by the fantastic folks at Sauce Labs. Try it for free today!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

267: Smart Test Execution with Eran Sher

Posted on 08/25/2019

Do you run an entire automation test for every build because you don’t ...

266: Automation Journey and TestNG with Rex Jones II

Posted on 08/18/2019

In this episode we’ll test talk with Rex Jones about his automation testing ...

265: TestProject a Community Testing Platform with Mark Kardashov

Posted on 08/11/2019

In this episode, we’ll talk to Mark Kardashov, CEO and Co-Founder of TestProject, ...