Can You Use Selenium Testing for API Testing?

Automation Testing Published on:
Selenium API Testing

One question that came up during this years Automation Guild session on Testing RESTful APIs with Rest-Assured with Bas Dijkstra was was if you can use Selenium for API testing.

This is actually a question that surprisingly I get asked all the time. But I liked Bas's answer on our TestTalks interview as well as during the Automation Guild Conference so much I decided to share it with you.

How do I incorporate API testing with my Selenium Testing functional tests

As I mentioned whenever I talk about API testing one question that probably comes to mind to most testers is, can I use Selenium for API testing, and if not how do I incorporate API testing with my functional tests.

Bas pointed out that he actually wrote a blog post on this fairly recently on what Selenium is and what it is not. Because he also sees this question quite often, surprisingly often on media such as LinkedIn or specialized test automation forums and twitter even.

For anybody who knows a little about Selenium web drivers that it's a … I'm not even calling 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.

Selenium is not a tool for API testing

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.

One of those libraries that Bas uses is Rest-assured. The Serenity framework also has nice integration for Selenium Testing and Rest-Assured that you should check out.

For more API Testing Awesomeness

For those of you that missed Bas and all the other awesome speakers at this year's Automation Guild conference –no worries! Due to demand, I decided to keep registration open.

So you can still get all pre-recorded sessions and recorded Q&A now!

Selenium API Testing