Accelerating the Mobility of Things

Invoking a Selenium RC test from soapUI

Note: For overall context for this blog please read integration testing with soapUI to understand why extending soapUI to work with Selenium is ever necessary.

A selenium RC groovy script which is one form of customizable edition of the recorded selenium IDE can be invoked in the soapUI. It is useful to perform various tasks in soapUI like as follows:

  • As a test step
  • To control testcase flow based on output of previous steps
  • To trigger the execution of test steps or test cases
  • As a data generator
  • As extended script libraries for common functionalities.
  • To write the results of test steps or test cases to an external source

Selenium RC and IDE

Selenium Remote Control (RC) is a test tool that allows user to write automated web application UI tests in multiple available programming languages against any HTTP website using any mainstream JavaScript-enabled browser.Selenium RC has two processes:

  1. A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them.
  2. Client libraries for multiple computer language.

The RC server also bundles Selenium Core, and automatically loads it into the browser.

Firefox extension calling Selenium IDE (Screenshot001) is used to record the functionality of the web site. It is easy to use and powerful tool for controlling, automating or testing web sites. It has record and playback feature that can be used to automate any thing in the web sites.

000011

(Screenshot001)

Selenium IDE has feature to save and export automated task in Groovy script (Screenshot002) which in turn can be used in soapUI.

0021

(Screenshot002)

For Selenium IDE users, Selenium RC is ideal solution to write tests in a more communicative programming language. So, to be more expressive, compatibility and for extra assertions recorded scripts are exported in Groovy Scripts.

Groovy Scripts

Groovy:

  • is an agile and dynamic language for the Java Virtual Machine
  • builds upon the strengths of Java but has additional power features inspired by other languages.
  • supports Domain Specific Languages and other compact syntax so that code is easy to read and maintain
  • makes writing shell and build scripts easy with its powerful processing primitives, OO abilities and an Ant DSL
  • simplifies testing by supporting unit testing and mocking out-of-the-box
  • seamlessly integrates with all existing Java objects and libraries
  • compiles straight to Java bytecode so you can use it anywhere you can use Java

Groovy scripts can be widely used in a soapUI for different functionalities.

SoapUI

soapUI is open source desktop application for inspecting, invoking, developing, simulating/mocking and functional/load/compliance testing of web services over HTTP. In a given framework, soapUI is used for testing web service.

Following are the functionalities of the groovy scripts in soapUI:

  • As part of a Testcase with the Groovy Script Test Step, allow tests to perform virtually any desired functionality
  • Before and after running a Testcase or Test Suite for initializing and cleaning up before or after running the tests.
  • When starting/stopping a MockService for initializing or cleaning-up MockService state
  • When opening/closing a Project, for initializing or cleaning-up Project related settings
  • As a dynamic DataSource or DataSink with the corresponding DataSource/DataSink test steps
  • For creating arbitrary assertions with the Script Assertion
  • To extend soapUI itself, for adding arbitrary functionality to the soapUI core. User can create his/her own script libraries for common functionality which can be used shared by the Testing team.

Benefits of Groovy Scripts in Test Automation Framework

In Test Automation Framework, we have used groovy scripts mainly:

  • As a test steps. (refer below screen)

0061

(Screenshot003)

  • As a dynamic DataSink. (refer below screen)

0072

(Screenshot004)

  • Before and after running a Testcase or Test Suite for initializing and cleaning up before or after running the tests. (refer below screen)

008

(Screenshot005)

  • To involved Selenium RC scripts for extend soapUI, we have created own script libraries for common functionality which can be used shared by the Testing team. We have further customized it by creating a jar for the same i.e. scripts.jar and kept it in the soapUI setup at “C:\Program Files\eviware\soapUI-Pro-3.0.1\bin\ext”. (refer below screen)

0091

(Screenshot006)

When tester will run the soapUI project either from Test Automation Framework or from soapUI Pro, it will take the extended script libraries from scripts.jar file.

Conclusion

Using test automation framework, a tester can execute the soapUI test suites or test cases automatically segregated by categories and browsers. Framework is customizable by updating the extended soapUI libraries for common functionalities. It will actually help the user to create a groovy script for commonly used functions and then bind those scripts in a jar file so that user can use in soapUI. While executing soapUI, it will automatically use customized selenium groovy scripts with assumption that selenium services are running.

VN:F [1.9.10_1130]
Rating: 9.0/10 (4 votes cast)
Invoking a Selenium RC test from soapUI, 9.0 out of 10 based on 4 ratings

SharePost

0Likes

21 Comments

Hemang

January 1, 2010 at 4:19 am

It’s a gud article…

rutvik

January 1, 2010 at 4:01 pm

Good article Bhaskar.did you use SoapUI/Selenium as integration testing tool or used for UI testing.

Twitted by Infostretch

January 2, 2010 at 12:07 am

[…] This post was Twitted by Infostretch […]

Harshil Sheth

January 2, 2010 at 7:29 am

It’s a Nice article.

Philippe Marsteau

January 2, 2010 at 6:36 pm

Interresting article, but I don’t get the point of using soapUI for UI testing (what Selenium is all about). What would be the advantage compared to invoking the Selenium tests directly (i.e. using JUnit) from automated/continuous build machine (i.e. using cruisecontrol)

Manish

January 3, 2010 at 10:57 am

Hi Philippe,
For over all context about this blog, please read my blog at http://blog.infostretch.com/?p=49

Customizing soapUI reports

February 19, 2010 at 4:45 am

[…] Capturing screen shots where failed test step invoked selenium (please read our blog about selenium integration with soapUI) […]

Suman

June 24, 2010 at 4:04 am

Hi Bhaskar ,
very good article .. But i am interested in freeware soapui how to generate a customized report ,, as of now i have created a html template and and i am putting request and response for each iteration by providing a link in main page and also collecting each and every assertion weather passed r failed . is there any other way to customise the reports . as i am using template and there is lot more to do changes when ever a new testsuite comes or new service comes . imean lot of code dependency resides here.
can you suggest me how to progress here.

sumit mishra

July 20, 2010 at 9:31 am

thanks for putting up this info. I tried your method, and am bumping into an error:
groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class com.example.tests.goog. Reason: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘org.apache.log4j.Logger@31b549’ with class ‘org.apache.log4j.Logger’ to class ‘java.util.logging.Logger’

any help/suggestion will be appreciated

chirag

October 18, 2010 at 5:11 am

Hi Suman/ Sumit
Please check Customizing soapUI reports at http://blog.infostretch.com/?p=128

ship4

October 31, 2010 at 11:08 pm

Does anyone have detail instructions on how the intergration is done. I am not from java envrionment and need some help setting up web test cased in soapui using selenium IDE.

Balaji

January 31, 2011 at 6:23 am

Hi Sumit,

did you get the solution for your problem? i am having the same problem as well

2011-01-31 15:16:54,362 ERROR [errorlog] groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class com.example.tests.CEM. Reason: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘org.apache.log4j.Logger@13781e7’ with class ‘org.apache.log4j.Logger’ to class ‘java.util.logging.Logger’

Thanks,
Balaji

Pardeep Kapoor

February 16, 2011 at 7:15 am

Hi Sumit,

Any idea, Can we integrate the SOAPUI with Groovy Scripts ?

Thanks – Paddy !

Rishi M

March 23, 2011 at 7:15 am

Hi Bhaskar.Joshi,

Is it possible to post some sample files to play and and edit in turn learn. A sample script in selenium and the groovy code needed for soapui.

PS. Do you need the pro version of SOAPUI as i think standard is limited.

Please provide some feedback..This is wonderful article and a follow up would be amazing.

Invoke a Selenium RC test from soapUI - Websphere Tutorial

June 6, 2011 at 11:31 am

[…] Here is a good tutorial show you the way to Invoke a Selenium RC test from soapUI: A selenium RC groovy script which is one form of customizable edition of the recorded selenium IDE can be invoked in the soapUI. It is useful to perform various tasks in soapUI like as follows: […]

Chandrasekaran

September 12, 2012 at 10:21 am

Hi,

I want to integrate selenium IDE with Soap UI. How to do that?

Thanks in advance for your help.

mical hikon

September 16, 2015 at 7:20 am

It see journalists are twenty assents an eight-month I look a bit less confounding to a demonstration of notice just looks more like it and Brain Alert standard trailer Saints change 626 can help facilitate the strain experiences issues recognizing and missing 22 motor with Grant her castor max additionally be youngster am and you must be more acceptable option to simply remember that could be a congregation skipper I’m following connected to college financing incorporate .

http://alphabrainonnit.com/

voctori mixal

September 18, 2015 at 2:18 am

From a story from see Parkinson back in 1957 so and was discussing a nuclear vitality office reactor and the exchange was raised about exceptionally Neuro Clarity specialized a specialized issue not very many individuals even comprehended the problem thus not very many individuals add to the dialog yet then the motivation moved to the color of the bicycle shed and everybody can comprehend called .

http://neuroclaritybrain.com/

victoria juri

September 25, 2015 at 4:06 am

recently i came your blog and have been read along it was very interesting..we are offering SOAP UI ONLINE TRAINING in india,usa,uk..etc.

victoria juri

September 26, 2015 at 7:17 am

thank u for giving this nice information bcz after reading this blog i gain more knowledge about soap ui…SOAP UI ONLINE TRAINING .

Jorge

October 3, 2015 at 3:24 pm

See this vídeohttps://youtu.be/9eqSuma6pfQ
About how to extend SoapUi with Selenium.

Leave a comment

Your email address will not be published. Required fields are marked *