Is there any difference in testing of a API and a Web services?
-
1There are already many questions discussing this topic. You may also refer to this which discusses difference with respect to testing .. sqa.stackexchange.com/questions/16177/…– TestingWithArifCommented Dec 2, 2016 at 9:55
-
@TestingWithArif : Your accepted answer is explaining the difference between SOAP and RESTful services, while i need to know the difference in verification of a web service and API. Also as you had mentioned in your question as well, there are many discussions on this topic but from development prospective, My intent here is to understand these technologies and their differences from a Tester's perspective.– KeshavCommented Dec 2, 2016 at 10:46
-
2Why is this closed? For example there is a job position for WebDriver testing and there is a note that you have to "know how to test API" and I really wonder is there is really any big difference so I googled it and hit this page.– NakilonCommented Jul 5, 2018 at 8:37
2 Answers
Following points helps the user to do API Testing approach:
- Understanding the functionality of the API program and clearly define the scope of the program
- Apply testing techniques such as equivalence classes, boundary value analysis and error guessing and write test cases for the API
- Input Parameters for the API need to be planned and defined appropriately
- Execute the test cases and compare expected and actual results.
API testing should cover atleast following testing methods apart from usual SDLC process
- Discovery testing: The test group should manually execute the set of calls documented in the API like verifying that a specific resource exposed by the API can be listed, created and deleted as appropriate
- Usability testing: This testing verifies whether the API is functional and user-friendly. And does API integrates well with another platform as well
- Security testing: This testing includes what type of authentication is required and whether sensitive data is encrypted over HTTP or both
- Automated testing: API testing should culminate in the creation of a set of scripts or a tool that can be used to execute the API regularly
Documentation: The test team has to make sure that the documentation is adequate and provides enough information to interact with the API. Documentation should be a part of the final deliverable
WebService can be called by a Software Application using SOAP or HTTP protocol.
Web Services can be implemented in different ways, but the following two are the popular implementations approaches.- SOAP (Simple Object Access Protocol)
REST (Representational State Transfer architecture) Software Applications communicate and exchange data with each other using a WebService
SOAP and REST are 2 popular protocols to create a WebService
- SOAP supports XML based data exchange
- REST support XML, Json or exchange of data in simple URL.
- WSDL is XML based language which will be used to describe the services offered by a web service. SOAP is defined using WSDL.
- To test WebService you can Create your own code. For instance use Axis2 API for Java Use WebService Test Automation tools like SoapUI
- Automation Tools like SoapUI will jumpstart your testing efforts, will require less coding effort compared to creating your own code using Axis2 API
Web Services Testing basically involves - Understand the WSDL file - Determine the operations that particular web service provides - Determine the XML request format which we need to send - Determine the response XML format - Using a tool or writing code to send request and validate the response
Suppose we want to test a WebService which provides Currency Conversion Facility. It will the current conversion rates between the different countries currency. This service we can use in our applications to convert the values from one currency to the other currency.
-
I hate when people downvote without providing explanation what they don't like or was wrong in the answer.– dzieciouCommented Dec 3, 2016 at 7:51
-
How do we know what is to be improved ?? Downvote without explanation is not fair.– prinzCommented Dec 3, 2016 at 8:39
-
1I'll leave the comment. This answer is long but does not answer the question. The @dzieciou 's answer is better. It also has links pretty useful for subject.– NakilonCommented Jul 5, 2018 at 8:39
The difference between testing APIs and testing Web services stems from the difference between APIs and Web services. So, according to Wikipedia:
An application programming interface (API) is a set of subroutine definitions, protocols, and tools for building application software.
Intuitively, Web services are APIs available over the Web. However, again we should be precise on how those Web services are implemented (again from Wikipedia):
Although "web API" is sometimes considered a synonym for web service, many Web 2.0 web applications have moved away from SOAP-based web services towards collections of RESTful web resources.
You may ask whethere there are APIs that are not Web APIs. There are: libraries and frameworks can have APIs. There are also remote APIs that are not available over the Web, like Java RMI.
So when you ask
Is there any difference in testing of a API and a Web services?
you need to be more precise what type of API you have in mind and what exactly you understand by Web services term.
When it comes to difference between testing RESTful resources and SOAP Web services, there is already a question on that topic.