SoapUI and Selenium integration

To integrate SoapUI with Selenium and work on creating scripts with it, we need the following prerequisites:

  • Java 1.7 (preferably the latest version)
  • Selenium Jars 2.0 or webdriver
  • Object Inspectors, for example, Firebug or Fire path which are add-ons for Firefox
  • Groovy script Jars
  • Any browser supported by Selenium and compatible with the version used.

Now let's start with Selenium integration with SoapUI:

  1. Download Selenium.jar files from the following link, shown in the image:

    http://www.seleniumhq.org/download/

    SoapUI and Selenium integration
  2. Download the Java language version of the Jars, once that is done a ZIP folder should be downloaded onto your PC.
  3. Unzip the Selenium – Java-'version no' folder.
    SoapUI and Selenium integration
  4. Open the unzipped folder.
    SoapUI and Selenium integration
  5. Copy the selenium-java-2.52.0.jar and selenium-java-2.52.0-srcs.jar from the folder.
  6. Open the SoapUI directory folder (In the previous chapter I opted for a default location, such as C:ProjectSoapUI. Refer to this location).
  7. Place these jars in the following locations: ext folder and lib folders please refer to the following screenshots for the complete path:
    SoapUI and Selenium integration
  8. Once you have pasted the Jars in the ext folder you also need to paste them in the lib folder of SoapUI as well.
    SoapUI and Selenium integration

After this step we are done with the setup we now need to work on the Groovy script.

Following is sample Groovy script for invoking a UI from SoapUI using Groovy script enabled by Selenium Jars:

import com.eviware.soapui.model.*
import com.eviware.soapui.model.testsuite.Assertable
import com.eviware.soapui.support.XmlHolder
import java.io.File;
def regLogger = org.apache.log4j.Logger.getLogger("RegressionTestLoger");
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def properties = new java.util.Properties();
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.thoughtworks.selenium.Selenium;

WebDriver driver = new FirefoxDriver();
driver.manage().deleteAllCookies();
driver.manage().window().maximize();
  WebDriver driver = new FirefoxDriver();  
  driver.get("http://www.google.com ");

The preceding script loads the relevant Jar and then invokes a Firefox driver or the driver of the chosen browser which invokes the URL.

It should also be noted that the version number of Selenium and the browser should be as per the following matrix.

For Windows, the following matrix shows compatibility with Firefox and Selenium versions:

SoapUI and Selenium integration

For Linux, see the following compatibility matrix:

SoapUI and Selenium integration

Also you may look for more details in the changelog at the following URL:

https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG

Here is the matrix for Mac:

SoapUI and Selenium integration

More details on the latest matrix can be seen online at the following link:

https://recordnotfound.com/selenium-firefox-support-matrix-santiycr-120024

Now we have seen how to run our UI test in the Firefox browser, if a need arises to run the test on IE or Chrome, how should we achieve it?

Let's take it step-by-step.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.136.142