Using SoapUI with Selenium for Web Service Testing

SoapUI is the most popular open source functional Testing tool for Api Testing. It provides complete Test coverage and supports all standard protocols and technologies.

What is SOAP?

SOAP is a simple XML-based protocol. It allows applications to exchange information over HTTP. It uses Web services description language(WSDL) language for communication. Other applications can also interact with web services using WSDL interface.

What is SOAPUI?

SOAPUI is an open source cross-platform web service testing tool. The SOAPUI-Pro has extra functionality for companies dealing with critical web services. Web services play a significant role in Internet applications.


  • Selenium: – It is a test tool to automate browsers across many platforms.
  • Selenium Webdriver: – It makes direct calls to the browsers. It uses browser’s native support for automation.

Selenium with SoapUI

The simplest and easiest way to integrate Selenium with Soapui is to use Groovy. SoapUI extensively supports Groovy.

Groovy is an object-oriented scripting language. Groovy includes all the Java libraries. So all Java related keywords and functions can be used in the groovy script directly. It integrates with JVM (Java Virtual Machine).

Pre-requisites for using Selenium with SoapUI

Call the SoapUI Testcase runner in Selenium.

The below code will be used to call SoapUI testcase. It will set the properties of city and corresponding zip codes. When the code is executed, it will get the value of cities and zip codes. Also, display the failure count that does not match with the corresponding city and zip code. This code will run in Selenium.

Note: “usePropertyFileFlag=true” here instead of using a static property file to store zip code and city. The information of zip code and city will pass at runtime dynamically by setProjectProperties() method.

Instructions to run the code.

  • Start up SoapUI
  • Start a new test case
  • Add a new groovy step.
  • Copy paste the sample code into the step.
  • Click on Play.
  • You can see Firefox starting up and navigating to Google. After that, you can see SoapUI log entries.
  • Code runs using Junit

Code Example

@when("<I use the weather service to get the weather information")						
    public void i_use_the_weather_service_to_get_the_information() {
        Set<Entry<String, string>> set = zipAndCities.entrySet();
        while (iterator,hasNext)) {
            Entry<String, String> entry =;
            String zipCode = entry.getkey();
            String city = entry.getValue();
            String[] prop = {"usePropertyFileFlag=true","zipCode=" +zipCode, "city=" +city};									
                SoapUITestCaseRunner soapUITestCaseRunner = new	SoapUITestCaseRunner();
            } catch (Exception e) {
                System.err.println("checking" + zipCode + " failed!");
                zipCodes.append(zipCode + " [" + city +"] ");

The console view enables us to have a glance at all the test cases executed. You will find a list of zip codes, cities fetched and passed into the SoapUI Test Case 1.

View SoapUI Log file

Log files record every action occurred in the operating system or software application. To view, SoapUI log files. Go to the main directory and you will see a file name “soapui.log.”

View SoapUI Log file

In SoapUI, the log file is located in the bin folder in the installation directory. E.g C:\Program files\SmartBear\soapUI-Pro-4.0.1\bin

View SoapUI Log file

When you open this log file by clicking on it, it will look similar to the screenshot below.

View SoapUI Log file


  • Soap is simple XML-based protocol. It allows the exchange of information over HTTP.
  • SoapUI is an open source cross-platform web service testing tool.
  • Selenium is a suite of test tools to automate browsers across many platforms.
  • Selenium Webdriver makes direct calls to the browsers. It uses browsers native support for automation.
  • Selenium integrates with SoapUI using Groovy.