Functional Web Services Testing Made Easy with SoapUI - Part 2
Now run it and see lots of green!
You can also right click on the WeatherTestSuite and select the menu item Launch TestRunner, which opens up a dialog as such:
Click the Launch button, and you should be able to see the results in another window:
Running soapUI TestRunner for [Weather]
directory: C:\Program Files\eviware\soapUI-2.0.2\bin\.
command: cmd.exe /C testrunner.bat -sWeatherTestSuite -cWeatherTestCase -r -a -j -f C:\web-services-test C:\Documents and Settings\msubbarao\Desktop\Weather-soapui-project-part2.xml
soapUI 2.0.2 TestCase Runner
Configuring log4j from [jar:file:/C:/Program%20Files/eviware/soapUI-2.0.2/bin/soapui-2.0.2.jar!/soapui-log4j.xml]
18:32:30,692 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Program Files\eviware\soapUI-2.0.2\bin\soapui-settings.xml]
18:32:31,723 INFO [WsdlProject] Loaded project from [file:/C:/Documents%20and%20Settings/msubbarao/Desktop/Weather-soapui-project-part2.xml]
18:32:32,494 INFO [SoapUITestCaseRunner] Running soapUI tests in project [Weather]
18:32:32,504 INFO [SoapUITestCaseRunner] Running soapUI suite [WeatherTestSuite], runType = SEQUENTIAL
18:32:33,015 INFO [log] In the WeatherTestSuite Setup Script
18:32:33,125 INFO [log] In the WeatherTestCase Setup Script
18:32:33,165 INFO [log] 2008-05-11
18:32:33,175 INFO [log] 20904
18:32:33,175 INFO [SoapUITestCaseRunner] Running soapUI testcase [WeatherTestCase]
18:32:33,336 INFO [SoapUITestCaseRunner] running step [Properties]
18:32:33,376 INFO [SoapUITestCaseRunner] running step [LatLonListZipCode - Request 1]
18:32:34,577 INFO [HttpClientSupport$Helper] Initializing SSL
18:32:35,008 WARN [AbstractSoapVersion] Ignoring validation error: error: cvc-complex-type.3.2.2: Attribute not allowed: encodingStyle@http://schemas.xmlsoap.org/soap/envelope/ in element Envelope@http://schemas.xmlsoap.org/soap/envelope/
18:32:35,008 INFO [SoapUITestCaseRunner] Assertion [SOAP Response] has status VALID
18:32:35,048 INFO [SoapUITestCaseRunner] running step [AssertLatLon]
18:32:35,719 INFO [SoapUITestCaseRunner] running step [NDFDgenByDayLatLonList - Request 1]
18:32:35,909 WARN [AbstractSoapVersion] Ignoring validation error: error: cvc-complex-type.3.2.2: Attribute not allowed: encodingStyle@http://schemas.xmlsoap.org/soap/envelope/ in element Envelope@http://schemas.xmlsoap.org/soap/envelope/
18:32:35,909 INFO [SoapUITestCaseRunner] Assertion [SOAP Response] has status VALID
18:32:35,969 INFO [SoapUITestCaseRunner] running step [AssertWeatherResponse]
18:32:36,049 INFO [SoapUITestCaseRunner] Finished running soapUI testcase [WeatherTestCase], time taken: 1097ms, status: FINISHED
18:32:36,110 INFO [log] In the WeatherTestCase TearDown Script
18:32:36,120 INFO [log] In the WeatherTestSuite TearDown Script
18:32:36,120 INFO [SoapUITestCaseRunner] soapUI suite [WeatherTestSuite] finished in 3616ms
SoapUI 2.0.2 TestCaseRunner Summary
-----------------------------
Time Taken: 3621ms
Total TestSuites: 1
Total TestCases: 1 (0 failed)
Total TestSteps: 5
Total Request Assertions: 2
Total Failed Assertions: 0
Total Exported Results: 5
We saw in this article how to use Groovy with SoapUI to create properties, transfer properties to requests, and to validate responses and assert expected results. If you know Java, writing Groovy scripts is a piece of cake. You can run these scripts from within the UI, as we saw. Of course, we have only covered a small fraction of what we actually do in any enterprise application. Once we know how to use Groovy, the entire Java API is available to you for easy use within SoapUI.
The next part of this series covers integrating tests with your build tool, running these tests as part of your builds, and creating JUnit reports.
Stay tuned.
Additional Resources:
1. SoapUI
2. Groovy
3. Java 6 API
- Login or register to post comments
- 34312 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)










Comments
jbaker replied on Wed, 2008/11/19 - 3:20am
Meera Subbarao replied on Wed, 2008/11/19 - 8:05am
esad48 replied on Fri, 2009/01/16 - 6:26am
hi,
one question, is it possible to pass the responce from one test case to another test case. What i'm trying to do is to get a session id and then use that session id to run a load test.
Thx.
Meera Subbarao replied on Fri, 2009/01/16 - 10:58am
in response to: esad48
shanbala replied on Fri, 2009/02/27 - 2:25am
Meera Subbarao replied on Tue, 2009/03/03 - 11:18am
in response to: shanbala
sureshreddy04 replied on Wed, 2009/03/18 - 10:24pm
After seeing into ur article I whould like to know how can i obtain session ID to logout automatically when I login and logout of the webapplicaiton.
mevric75 replied on Tue, 2009/06/16 - 6:47pm
jafar_bt replied on Thu, 2009/08/06 - 4:25am
Hi Meera,
How could I change the project properties, test suite properties or testcase properties values using Groovy script test step. I wasn't able to understand the syntax.
def sessionID = context.expand( '${#Project#SessionID}' )
def testSuiteProperty = context.expand( '${#TestSuite#TestSuiteProperty}' )
def test1 = context.expand('${#TestCase#test}' )
I understood the above lines collect the values of the given properties. Please help me to set the value for SessionID, TestSuiteProperty, test parameters. Thanks in advance.
jafar_bt replied on Fri, 2009/08/07 - 2:29am
in response to: jafar_bt
I have found the info. The format is as follows:
testRunner.testCase.testSuite.project.setPropertyValue("SessionID","2002")
testRunner.testCase.testSuite.setPropertyValue("TestSuiteProperty","testSuiteProperty")
testRunner.testCase.setPropertyValue("test","testcase property")
However, I have another issue. If the assertion is faliled I am unable to continue to execute the further steps of testcase. Please help me regarding this concern...
kkairan replied on Mon, 2009/09/14 - 4:16am
I am trying to get the Node Value but I get it as Null
IST 2009:INFO:null
This is the Script I am running groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) holder = groovyUtils.getXmlHolder("GetData - Request 1#Response") dwmlByDayOut = holder.getNodeValue( "//GetDataResponse" )
Below are the Request Iam sending and the response I get
${Properties#Addvalue}
This is my response
You entered: 500
sztgeza replied on Fri, 2009/10/09 - 3:13am
Hi all!
For the TestCase setup script to work, i think it needs to add the following lines before file.createNewFile(), Otherwise i experienced an IOException, which was thrown by file.createNewFile(), when the parent directory had not existed before.
...
if(!file.exists())
{
if (file.getParentFile() != null) {
file.getParentFile().mkdirs()
}
file.createNewFile()
...
Nice article, anyway!
sunrise1 replied on Mon, 2009/10/26 - 3:26am
nkunchupu replied on Wed, 2009/11/25 - 7:31am