top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

My first stab at API testing!

Pooja Tavag

 


 

What is Web Service?

A web service is a software system that supports machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically, web Service Definition Language, or WSDL)


What is API (Application Programming Interface)?

APIs are mechanisms that enable two software components to communicate with each other using a set of definitions and protocols. For example, The weather app on your phone “talks” to this system via APIs and shows you daily weather updates on your phone. Here weather database is the server and the mobile app is the client.


All Web Services are API's but not all API's are Web Services. APIs are valuable in reducing costs by not using different coding languages and streamlining internal processes


Different types of APIs

  • Open or Public APIs - any developer can access.

  • Partner APIs - only authorized developers may access.

  • Internal APIs - only internal teams may access.

  • Composite APIs - combine multiple APIs

Types of API Protocols

  1. REST ( Representational State Transfer ) API.

  2. SOAP ( Simple Object Access Control ) API.

  3. RPC ( Remote Procedure Call Protocol ) API.

  4. EDA ( Event Driven Architecture ) API.

Widely used API testing tools

Steps involved in testing web services using SOAPUI

  1. Setup SOAPUI

  2. Get started with your 1st project

  3. Add a test suit

  4. Add a test case

  5. Add an assertion

  6. Run a test suit

How to test a Case using SOAPUI tool

  • Open the SOAPUI tool and select New Soap Project. "New SOAP project" window pops up as shown in the screenshot.



  • Enter the web-service URL you want to test in the "Initial WSDL" field. For the illustration purpose lets use calculator web-service - http://dneonline.com/calculator.asmx?wsdl . Copy and paste the URL in the initial WSDL field. Provide suitable project name in the "Project Name" field. If not provided, soapui tool auto populates with url name.Make sure "Create requests box is checked" then click ok to create the project.



  • Now you can see calculatorSoap on the left hand side of the screen, if you expand that you will see the operations, add , divide, multiply and subtract. Lets expand Multiply and double click on request1. (You can create multiple request also)


  • Now you will see a request window with a "?" , that means you have to insert an integer as input to each int A and int B.



  • Let's give int A as 18 and int B as 16 and click on the green arrow Run button. On the right hand side you will see the response window, by default it will be in the raw code, click on XML to change it to XML code.


  • We can see the multiplication of two numbers ( 18 * 16 = 288 ) on the right side . As we got the correct answer, it means our API is working. Similarly we can insert different values and try API testing for other operators.



Thank you!


90 views0 comments

Recent Posts

See All
bottom of page