Web Services / REST API Testing Interview Questions
Web Services / REST API Testing Interview Questions, What is Web services testing, web service test tools, and SoapUI for Web services tests.
1. What are Web Services?
Web services are web components that transfer data between client and server. Client sends a web request to the server and the server then responds to client. The response and request are related and different requests evoke the corresponding response.
2. What are REST API?
3. What is WSDL?
WSDL stands for Web Service Description Language and is a document written in XML. It uses XML to define the service layer document which consists of origin of the web service, headers, port types, and request and response data. This one can provide the information about web methods and web service.
Origin of the web service
Input and output messages
4. What is the primary challenge when testing Web Services?
Majority of the functional testing is carried out via the GUI; the biggest challenge of Web Services is that they do not have a UI.
5. What are the communication channels available for a Web Services?
In general, web service is combined with the following protocols. They are, HTTP / POST
HTTP / GET SOAP
While exposing the web services, these channels will be used for communication with the clients. Here HTTP / POST protocol transfers the information between the clients with secure mode. HTTP / GET protocol allows the clients to view transferred data partially at the browser’s address bar. SOAP is used for transferring the confidential data safely.
6. What are the different components can be used in the Web Services?
There are four components are used in web services. They are,
WSDL – Web Service Description Language
SOAP – Simple Access Object Protocol
UDDI – Universal Description, Discovery and Integration RDF – Resource Description Framework
XML – eXtensible Markup Language
7. What are the tools used for testing Web Services?
To perform functional testing for web services, we can use the following tools. SoapUI
RESTClient – This is a Firefox plug-in
JMeter – Specially made it for performance testing tool and also we can do functional testing the web services.
8. What is the role of WSDL document in Web Service testing?
Validating webservices in only possible with WSDL document because to configure web services in SoapUI, WSDL document is mandatory. If the WSDL document is not valid, SoapUI will throw an exception immediately.
9. What is UDDI?
Universal Description, Discovery and Integration- a directory or global repository where all the webservices can be found. A new Webservice can also be registered through this. This is also the place where WSDL detailed definitions are found.
10. What is SOAP?
Simple Object access protocol that uses XML to interact with web applications. It uses XML based content to communicate between two client machines across any network.
11. What would be the message format of SOAP protocol?
Generally, all the SOAP based web services are written by using XML language which uses standard message format that is accepted across the universe. In this format, it is easy to read, identify the errors, avoids interoperability problems etc.
12. What are the advantages of SOAP?
Since its XML based, it is platform and programming language independent. RPC (Remote procedure calls) are sometimes blocked by firewalls and proxy servers- Soap overcomes that.
13. What does a SOAP document contain?
Envelope element is the top most tag which identifies the XML document as a SOAP message. Followed by Envelope element, you see the header element that has header information. The Body element specifies the call and response information. Finally, you have a Fault element which contains errors and status information.
14. What is meant by Protocols and what are the major types are used in Web Services?
A protocol is a set of standard rules that helps to communicate the hardware devices through the software applications. There are different types of protocols used in the Internet and Intranet applications.
TCP which stands for Transmission Control Protocol. It has the rules to exchange the messages between two different Internet applications.
Internet Protocol uses the rules for sending and receiving the information between two different Internet addresses.
Similarly, HTTP, FTP and DHCP protocols are used the set of rules to transfer the data other than Internet applications.
15. What is XML?
XML (eXtensible Markup Language) is a mark-up language that is used for storing, sharing and formatting data. In general, an XML document is built by the tags. For more info and examples
16. What is SoapUI?
SOAPUI is the leading open source cross-platform API/Web Services Testing tool.
SOAPUI allows testers to execute automated functional, regression, compliance, and load tests on different Web API.
SOAPUI supports all the standard protocols and technologies to test all kinds of API’s.
SOAPUI interface is simple that enables both technical and non-technical users to use seamlessly.
17. What we can do with the help of SoapUI?
SoapUI offers us to perform automation testing which includes functional testing, load testing and data driven testing.
It also provides in build reporting tool and export test results log provision We assert our services using various types of assertions
17. What is Mocking?
Mock services are a great way of getting testing early into the picture of a service- oriented project. Once the WSDL of the web service is ready, you can simulate the service implementation and start testing the consumer applications.
18. What is Property Transfer Step in SoapUI?
Property Transfer enables to transfer the values from one API Response to other API Request
19. How many kind of Assertions we have in SoapUI Tool?
Xpath Match , Contains, Script Assertion, Xquery Match,Http Status codes etc
20. What hierarchy SoapUI follows to build a proper testing project?
In a SoapUI project, the following order should be maintained.
TestSuite – This is combination of functional tests and logical blocks
Testcase – Its a group that contains several test steps for the specific aspects of the service.
Teststep – it contains the set of functional tests.
21. What is the basic method to automate Web Services in SoapUI?
Create a project and add the WSDL file
Add test suites, Test cases and Test cases- in that order
Include custom programming/validation using by adding Groovy steps
Call external data sources if using
Add assertions if necessary
22. What are SoapUI Assertions?
Assertions compare the parts/all of the response message to the expected outcome.
23. What are the major types of assertions available in SoapUI?
Assertions are the one of the major feature in SoapUI. It offers the following types of assertions.
Simple not contains
WS security status
WS- Addressing Request or Response Assertion
Additionally Equals assertion is introduced in SoapUI NG Pro version.
24. Explain about XPath Assertion in SoapUI
In SoapUI, XPath assertion is used for asserting the web service response value by specifying the absolute path. If the absolute path is matched with the response value, then the test case or test suite will be considered as PASS otherwise it will be notified as FAILED. We can see the results of assertion at bottom of the screen where the Assertion tab will have resultant information.
25. What is Data Driven Testing?
Data driven testing means to store our test data which includes input and expected output in an external data source called Excel / Database / XML file. Later, we need to iterate the data source using respective component. In SoapUI, Datasource and Datasource Loop test steps are used for performing data driven testing.
26. What are the different types of assertions used in SoapUI?
The following are the different types of assertions:
Contains & Not Contains
WS security Status
WS- Addressing Request or Response Assertion
27. How can assertions be added in SoapUI?
Receive a response to a request as you normally would follow the below steps:
Create a project, add WSDL
Add Test suite, Test case and Test steps
Run the request
To add assertions:
Click on the Add Assertions at the top of log tabs.
Configure the assertions as per the type and data required.
28. What is Groovy script and where can it be used?
Groovy is a scripting language which internally includes all the java libraries – it helps us to customize and add custom validations to SoapUI tests
29. Can custom code be added to SoapUI? If yes, what can be added?
30. How to group tests?
The basic Test suite is a way for us to group tests in SoapUI. When you need a different set of tests, you just have to create a new test suite and create tests as required under it as test cases.