Top 39 Soap Ui Interview Questions You Must Prepare 24.May.2024

Properties in SOAPUI is used to retrieve and store data. The data is stored as key, value or format.

The general format for reading the custom or default property value is ${#levelname#key}

This can come in handy both from the Project onLoad script (if you want to start your MockServices when the project is opened) or from a TestCase/TestSuite setup script (if you need the MockService running for your functional tests). Here from a TestCase setup script: 

  1. def runner = testCase.testSuite.project.mockServices["My MockService"].start()
  2. context.mockRunner = runner 

The returned runner object is required to stop the MockService... so save it to the context and use it in the tearDown script: 

context.mockRunner.stop() 

Have a look at the WsdlMockService and the WsdlMockRunner classes for more methods and properties that might come in handy.

The following are the different types of assertions:

  • Contains & Not Contains
  • XPath match
  • XQuery match
  • Schema compliance
  • Soap Faults
  • Response SLA
  • WS security Status
  • Script Assertion
  • WS- Addressing Request or Response Assertion

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.

Here’s the sample SOAP message format.

POST /InStock HTTP/1.1

Host: localhost

Content-Type: application/soap+xml; charset=utf-8

Content-Length: 399

SOAPAction: “http://www.wisdomjobs.com/soap-envelope”

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.

  • 200 OK This response code indicates that the request was successful.
  • 201 Created This indicates the request was successful and a resource was created. It is used to confirm success of a PUT or POST request.
  • 400 Bad Requests The request was malformed. This happens especially with POST and PUT requests, when the data does not pass validation, or is in the wrong format.
  • 404 Not Found This response indicates that the required resource could not be found. This is generally returned to all requests which point to a URL with no corresponding resource.
  • 401 Unauthorized. This error indicates that you need to perform authentication before accessing the resource.
  • 405 Method Not Allowed The HTTP method used is not supported for this resource.
  • 409 Conflicts This indicates a conflict. For instance, you are using a PUT request to create the same resource twice.
  • 500 Internal Server Errors When all else fails; generally, a 500 response is used when processing fails due to unanticipated circumstances on the server side, which causes the server to error out.

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

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.

Data-driven testing is when you store test data (input, expected output, etc) in some external storage (database, spreadsheet, xml-files, etc) and then use that data iteratively in your tests when running them. For example to test your phone-lookup service, you might have a list of names and expected phone-numbers in a database which you would use to “drive” your test, checking that each name gets the right phone-number back. It’s really quite simple.

  • Right-click on one of the SOAP interfaces and selects Generate Mock Service.
  • In the dialog Generate Mock Service you can specify the local port/path for the service you’re creating but for the moment just click OK.
  • Enter the name of your Mock Service in the Name dialog and click OK.
  • after creating the Mock Service, you should get a Mock Service with one operation and one request.

SOAP UI uses three levels to structure functional tests:

  • TestSuite: It is a pool of test cases used for combining functional tests into logical units
  • TestCase: It is a group of test steps that are bring together to test some specific aspect of your services. You can augment any number of testcases to test suites
  • TestSteps: They are “building blocks” of functional tests in SOAPUI. They together makes TestCase and determines the flow of execution of the service to be tested.

To parameterize the endpoints in SOAP UI is most important as it is the first step in automation testing. It is more time consuming for changing endpoints manually. In order to do that

  • Define a project property holding the endpoint
  • Change the endpoint to use this property via property expansion
  • Ensure that your requests are availing the configured endpoint
  • When a request is run, the property will inevitably be with its current value. To use a different value just configure the endpoint in the UI, you can use the P option from the command line

Soap UI automatically saves everything on exit. If you want to save your projects without exiting (for example if you want to commit your project file to CVS) use the “Save All” option in the main File menu

Assertions compare the parts/all of the response message to the expected outcome.

Web services are a medium through which web based application can be integrated or communicated over an internet protocol backbone. Web based application can be integrated using XML, SOAP, UDDI and WSDL. SOAP is used for transmitting the data; WSDL is used for describing or relating the services, UDDI is used for listing what services are accessible, XML is used to tag the data.

Assertions are the one of the major feature in SoapUI. It offers the following types of assertions:

  • Simple contains
  • Schema compliance
  • Simple not contains
  • Soap Faults
  • Response SLA
  • XPath Match
  • XQuery Match
  • WS security status
  • Script Assertion
  • WS- Addressing Request or Response Assertion
  • Additionally Equals assertion is introduced in SoapUI NG Pro version.

SoapUI is a webservices testing tool and SoapUI Pro is its commercial version. SoapUI can help create functional, security and load testing test suites. SoapUI Pro does all that with advanced drag and drop, data driven testing, advanced reporting and coverage analysis.

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.

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.

  • It is a document written in XML and used to describe web services.
  • It specifies the location of the service and the operations (or methods) the service exposes.

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

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.

Web Service is a web component or software program that can be accessed on the Internet. It is mainly used to communicate with the web based applications through XML messaging concepts. For example, if we want to access a particular location using Google Maps, we can use the corresponding web service URL. For that we have to pass the appropriate inputs.

testRunner.testCase.testSuite.project.name (Almost all items have a name property)

  • 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
  • Then RUN.

SoapUI can:

  • It can do automated testing like load tests, scenario-based tests and data driven tests
  • It has got built-in reporting abilities
  • It has got unique ability to impersonate web services and run functional and load test against them even before they are executed

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. They are

  • 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.

SOAP UI is a free, open source cross-platform functional testing solution. It enables you to rapidly and easily create and execute automated regression, compliance, functional and load tests.

Groovy is a scripting language which internally includes all the java libraries – it helps us to customize and add custom validations to SoapUI tests

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.

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.

In general, web service is combined with the following protocols:

  • 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.

Majority of the functional testing is carried out via the GUI; the biggest challenge of webservices is that they do not have a UI.

We can read the property values into test step endpoint, username, header values, password, domain, POST, PUT, GET and DELETE method properties.

  • Open the request editor.
  • In the request editor, click the Add an Assertion to Test Request button.
  • Select Response SLA from the drop down in the Select Assertion dialog box.
  • In the Configure Response SLA Assertion dialog box, write 500 and click OK. This will validate that the response of the SLA is fewer than 50@
  • Now that you’ve added the assertion, you are going to run the request to validate the response. If all assertions are successful, the SOAP icon should turn green in three places .
  • You can also validate the response by adding an X-Path Match assertion.
  • In Soap UI Pro you can open the Select X-Path dialog, which lets you select nodes to assert using point-and-click. As a result Soap UI creates the matching X-Path expression that refers to the selected node.
  • Soap UI automatically populates the expected result to match what’s in the response. But of course, you can change this to what’s relevant for you.

There are five components are used in web services.

They are:

  1. WSDL – Web Service Description Language
  2. SOAP – Simple Access Object Protocol
  3. UDDI – Universal Description, Discovery and Integration
  4. RDF – Resource Description Framework
  5. XML – eXtensible Markup Language

Inside the SOAPUI groovy script can be used in two places

  • Groovy script test step
  • Script Assertion- within test step