2

In my project I have some API (Web Services). Currently, I am testing the web services manually and using POSTMAN to automate tests.

Does Selenium support automate the Web services with JSON or XML?

Please share your feedback.

10

From SeleniumHQ:

Selenium automates browsers. That's it!

You don't need a browser to automate API testing.

There're dozens of tools for almost every popular programming language. If you like JavaScript, you can stick to Postman for automation.

3
  1. Theoretically yes, but it will be not very convenient as you will need to create a HTML form in JavaScript via JavaScriptExecutor, append it to the current page and submit it.

  2. Another option is using underlying network libraries (which can come with Selenium Java Client) , i.e. Apache HttpComponents for building individual HTTP requests

  3. You can plug in an extra library designed for APIs testing i.e. RestAssured
  4. And finally you can use a special web services testing tool like SoapUI or another HTTP-protocol-based tool like Apache JMeter (by the way JMeter can be integrated with Selenium via WebDriver Sampler plugin)
1

Selenium is a set of tools that automate web browser.so go API you can use JMeter, Postman or SoapUi.

Selenium does not support API testing.

1

As others have already said, you'd probably want to pick a different tool to handle most service level testing.

But to answer your question, for a hackathon in a previous job I wound up extending the node implementation of selenium-webdriver to send and process http requests from the browser using driver.executeScript() calls. I would not recommend this route unless you have a very specific need in mind.

1

Selenium itself is only a driver for a web browser. As it's written on a homepage:

Selenium is a suite of tools to automate web browsers across many platforms.

If you already have an automation testing framework built around Selenium, consider creating a separate project within your framework related to API testing. For a toolset, I would recommend RestAssured for Java or it's .NET port - RestSharp.

If you're interested in building a long-term API automation, I would not recommend to build it around some tool, since it will increase maintenance overhead and limit you in actions, at some point.

0

Selenium Does not support API Testing. SOAP UI is the best tool for Automating the API's. However, if you want and if you are comfortable with JAVA for API Automation you can use Cucumber -- for test cases and data required for API's Rest Assured -- For sending Request and saving the Response Java -- For Parsing the XML and writing code

0

I use Rest Assured for API testing. Since you are already using Postman, I recommend that you also look into Newman to integrate your Postman tests into a continuous integration solution.

0

You can use Postman as an automation tool using Postman BDD library and automate the API Testing and can even integrate it with Jenkins to have the whole process in a CI-environment. We run approx thousand test cases for our api's using that and it works out pretty well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.