You are on page 1of 15

Web Services/SOA Testing

Made Easy

Software Confidence. Achieved.


Meera Subbarao
Senior Software Consultant
msubbarao@cigital.com www.cigital.com
info@cigital.com
+1.703.404.9293

Sunday, March 08, 2009 1


Web!Services!Are!Everywhere!!

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 2
Testing!Challenges

! No User Interface
! Combination of Several
Components
! Integration Layers
! Coverage
! Security

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 3
Why!SoapUI?
! WSDL Service Inspection
! REST Service Inspection
! WSDL Service Invocation
! REST Service Invocation
! Web Service Development and Validation
! Web Service Functional Testing
! Web Service Load Testing
! Web Service Simulation

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 4
Functional!Web!Services!Testing

! Create a Web Service Test from SOAP request


! Add Assertions to a test
! Run your web service test!
! Generating Test Suites
! Test Suite Runner
! Test Cases
! Test Case Actions
! The TestCase Editor

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 5
SoapUI!And!Groovy
! Scripting your test with Groovy
! The Groovy Script Editor
! Add a Properties step
! Read back from the properties file and assign
the values to the properties step
! Script Execution
! Groovy Script Examples
! SoapUI GroovyUtils
! Parse the response from the request using
Groovy and assert
© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 6
Groovy!Examples
today = new Date()
sdf = new java.text.SimpleDateFormat("yyyy-MM-dd")
todayStr = sdf.format(today)

groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )


holder = groovyUtils.getXmlHolder("LatLonListZipCode - Request
1#Response")
listLatLonOut = holder.getNodeValue( "//listLatLonOut" )
latlonNode = groovyUtils.getXmlHolder(listLatLonOut)
latlon = latlonNode.getNodeValue("//latLonList")

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 7
SoapUI!and!Ant
! Command line tools
! com.eviware.soapui.tools.SoapUITestCaseRunner
! Generating JUnit Reports
! Reporting and Exporting Functional Web Service Tests
<property name="soapui-location" location="C:/dev/soapUI-2.5/bin"/>
<property name="soapui.project.file" location="Weather-soapui-project.xml"/>

<target name="soapuiTests" depends="init">


<exec dir="${soapui-location}" executable="cmd.exe">
<arg line="/c testrunner.bat -f${soapui-
report-dir} -j -r -a ${soapui.project.file}"/>
</exec>
</target>

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 8
SoapUI and JUnit
<junitreport todir="${soapui-report-dir}">
<fileset dir="${soapui-report-dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${soapui.html.dir}" />
</junitreport>

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 9
Code!Coverage
Measuring code coverage
• Facilitates understanding
what’s not tested
• Promotes collaboration
between development
and QA

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 10
Code!Coverage!Tools
Java .NET
• Cobertura • NCover
• Clover • Clover.NET

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 11
Using!Cobertura!With!Ant
! Instrument your code
! Deploy instrumented code
! Run Tests
! Generate Reports
! Generate coverage report
<target name="instrument" depends="build">
<cobertura-instrument datafile="${cobertura-data-dile}" todir="{classes.dir}">
< fileset name="**/*.class" />
</fileset>
</cobertura-instrument>
</target>

<target name="coverage-report“
<cobertura-report datafile="${cobertura-data-file}" srcdir="${src.dir}
destdir="${coverage.xml.dir}" format="xml" />
<cobertura-report datafile="${cobertura-data-file}" srcdir="${src.dir}"
destdir="${coverage.html.dir}" />
</target>

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 12
Continuous!Integration

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 13
Integration!With!Hudson
! Configure Hudson Job
! Force a Build
! Publish the Coverage
Report
! Publish the SoapUI JUnit
Reports

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 14
Having!Trouble?

msubbarao@cigital.com

© 2006 Cigital Inc. All Rights Reserved. Proprietary and Confidential. Sunday, March 08, 2009 15