......................................................................................................................................

soapUI v.2.5.1
Project Documentation
......................................................................................................................................
eviware 01 February 2009
Table of Contents
......................................................................................................................................
1 User Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Tabbed Desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.2 License Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.3 Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.4 XPath Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.1.5 WSDL Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.2 Workspaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.3 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.3.1 Project View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
1.3.2 Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.3.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.3.4 WS-Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
1.3.5 Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
1.3.6 Composite Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
1.3.7 Project Resolving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
1.4 WSDL Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
1.4.1 Interface View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
1.4.2 WS-I Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
1.4.3 WSDL Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
1.4.4 WSDL Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
1.4.5 Working with SOAP Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
1.4.5.1 Form Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
1.4.5.2 Overview View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
1.4.5.3 Outline Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
1.4.5.4 Pro Inspectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
1.4.5.5 Attachments/Inline Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
T A B L E O F C O N T E N T S
i
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.5 REST Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
1.5.1 Parameters/Representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
1.5.2 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
1.5.3 Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
1.6 Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
1.6.1 Script Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
1.6.2 Dynamic Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
1.7 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
1.7.1 Property Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
1.8 Functional Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
1.8.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
1.8.2 TestSuites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
1.8.3 TestCases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
1.8.4 TestSteps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
1.8.4.1 Test Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
1.8.4.2 Property Transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
1.8.4.3 Conditional Gotos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
1.8.4.4 Groovy Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
1.8.4.5 Properties Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
1.8.4.6 Delay Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
1.8.4.7 Run TestCase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
1.8.4.8 Mock Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
1.8.4.9 DataSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
1.8.4.10 DataSource Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
1.8.4.11 DataSink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
1.8.4.12 DataGen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
1.9 Load Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
1.9.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
1.9.2 Limit & Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
1.9.3 Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
1.9.4 Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
1.9.5 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
1.9.6 JMeter comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
T A B L E O F C O N T E N T S
ii
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.10 Mocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
1.10.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
1.10.2 Mock Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
1.10.2.1 Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
1.10.3 Mock Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
1.10.4 Mock Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
1.11 SOAP Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.11.1 Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.12 Usage Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.12.1 Data Driven Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.12.2 Template Driven Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.12.3 Interactive Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.12.4 Surveillance Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.13 Tool Integrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.13.1 Code Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.13.2 Apache TCPMon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
1.14 CommandLine Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
1.14.1 TestCase Runner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
1.14.2 LoadTest Runner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
1.14.3 MockService Runner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
1.14.4 Tool Runner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
1.15 IDE/Tool Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
1.15.1 Maven Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
1.15.1.1 Maven 1.X Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
1.15.1.2 Maven 2.X Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
1.15.2 NetBeans Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
1.15.2.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
1.15.3 IntelliJ Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
1.15.4 Eclipse Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
1.15.4.1 soapUI Nature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
1.16 Keyboard shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
T A B L E O F C O N T E N T S
iii
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
TABLE OF CONTENTS
iv
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.1
Overview
......................................................................................................................................
soapUI Overview
Prerequisites
Although soapUI should be easv to get started with. vou should ha·e a good grasp oí the íollowing
concepts and technologies to get the most out oí soapUI's íunctionalitv.
· WSDL - \ou should ha·e a grasp oí basic concepts like ser·ices. ports. bindings. port tvpes. and the
relation to XML Schema
· SOAP - \ou should ha·e a grasp oí basic concepts and relation to \SDL bindings. etc,. diííerent
encoding tvpes soap encoded´literal, and message stvles document´rpc,
· RLS1/H11P - Understand the concepts behind RLS1 and l11P-based ser·ices´resources.
· XML and related technologies - Useíul knowledge is XPath. XML Schema. namespaces. etc
\ou can íind most speciíications at \3( and tutorials at se·eral sites. íor example \3Schools and
z·on.org .
The soapUI Interface
soapUI is a standard desktop application adhering to established User Interíace concepts íor Integrated
De·elopment Ln·ironments. as a·ailable in íor example Lclipse. NetBeans and IDLA. Most actions
ha·e kevboard shortcuts and tooltips. vou should ha·e no problems íinding vour wav around. soapUI
makes hea·v use oí "Inspectors": i.e. tabs that can be shown and hidden bv selecting them.
1he soapUI window is di·ided into the íollowing ·iews:
bottom-left
• The Properties panel will show information on the item currently
selected in the navigator
bottom right
A color coded log view showing log messages from soapUI
1 . 1 O V E R V I E W
1
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
\ou can set a centered background image íor the deíault desktop bv placing a
soapui-backgroung.gií´jpg´png íile in the soapUI bin íolder when using the deíault desktop
The Navigator
1he íollowing objects are currentlv shown in the na·igator tree:
· Projects node : the soapUI workspace
·
Project nodes, : íor each project in the workspace
·
Interíace ´ Ser·ice nodes, : íor each \SDL Interíace or RLS1 Ser·ice in the project
·
Operation ´ Resource nodes, : íor each \SDL Operation or RLS1 Resource in the
containting Interíace´Ser·ice
·
Request nodes, : íor each \SDL or RLS1 Request created íor the containing
Operation or Resource
·
RLS1 Resource nodes, : íor each child RLS1 Resource
·
1estSuite nodes, : íor each 1estSuite in the project
·
1est(ase nodes, : íor each 1est(ase in the testsuite
·
1estSteps node. contains the 1est(ases'
1 . 1 O V E R V I E W
2
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
·
1estStep nodes, : íor each 1est(ase-step. together with a colored icon indicating
the status oí that step.
·
Load1ests node. contains the 1est(ases'
·
Load1est nodes, : íor each loadtest in the containing 1est(ase
·
MockSer·ice nodes, : íor each MockSer·ice in the project
·
MockOperation nodes, : íor each MockOperation in the MockSer·ice
·
MockResponse nodes, : íor each MockResponse in the containing MockOperation
1he tree can be na·igated using the standard kevboard actions. An items' associated desktop panel can be
opened bv double clicking it or selecting it and pressing Lnter.
Property Mode
1he Na·igator described abo·e contains a small toggle button on top oí the tree. Pressing it will put the
Na·igator into Property Moae. displaving all Properties íor their corresponding objects in the tree green ~
read´write. black ~ read-onlv,. gi·ing an o·er·iew oí all deíined or a·ailable properties within a project.
· Items containing custom properties Projects. 1estSuites. 1est(ases. MockSer·ices and
MockResponse, will in the tree get a Propertie. cbita voae contain that objects custom properties.
· Double clicking a propertv prompts to set its ·alue.
· Right clicking the Properties node open a menu íor adding new properties.
One oí the main Use cases íor this mode is the possibilitv to drag a propertv írom the tree into anv text
editor that supports Propertv Lxpansion . making it extremelv easv to create propertv expansions as
desired. Ií the propertv being dragged contains an XML ·alue. the XPath Selector will be displaved aíter a
drop. allowing íor íurther propertv-expansion reíinement
1 . 1 O V E R V I E W
3
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Drag and Drop
soapUI pro·ides extensi·e support íor dragging and dropping items in the Na·igator. resulting in
corresponding (lone or Mo·e operations. alternati·elv add or import actions. íor example dragging a
Request to a 1est(ase creates a 1estRequest Step corresponding to the dragged Request. It is also
possible to drag and drop within or between the 1estSuite and 1est(ase editors and the Na·igator to
rearrange. mo·e. or copv items.
Main Menu
Most actions in soapUI are períormed through toolbar buttons or context sensiti·e right-button menus.
1he íollowing actions are a·ailable írom the main menu:
Iile Menu
1he íirst 9 actions are the same as those íor the \orkspace popup menu. please go to the \orkspaces
page íor details. Aíter these come the íollowing actions:
· Preferences - Sets global soapUI Preíerences
· Save Preferences - Sa·es the current global settings
· Import Preferences - Prompts to import global settings írom another location íor example an old
1 . 1 O V E R V I E W
4
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
soapUI installation,. Aíter loading. soapUI mav need to be restarted íor all settings to be acti·ated
· Recent - (ontains submenus íor recent editors. projects. or workspaces íor easv switching
· Lxit - Prompts to exit soapUI
· Lxit without saving - prompts to exit soapUI without sa·ing anvthing
· Online Help - displavs this page in an external browser
1ools Menu
· (ontains actions íor in·oking integrated tools as described in the 1ool Integrations section.
Desktop Menu - Shows actions related to the currentlv selected Desktop.
· Switch Windows - opens a ´ritcb !ivaor dialog íor switching to another open editor
· Maximize Desktop - hides or shows the Na·igator and Log-Inspectors
· Close Current - closes the currentlv acti·e desktop pane
· Close All - closes all desktop panes
· Closes Others - closes all desktop panes except the currentlv acti·e one
· Open 1estCase Layout (soapUI Pro 1abbed Desktop only) - enabled ií a 1est(ase is selected in
the Na·igator: will create a desktop with the 1est(ase to the leít and all 1estStep windows in a 1ab
Group to the right.
Help Menu - general iníormation and soapUI Pro speciíic actions
· Starter Page - Opens the Starter Page which is bv deíault shown when soapUI starts
· User Guide - Opens the soapUI User Guide
· Getting Started - Opens the soapUI Getting Started documents
· System Properties - Opens a list oí all currentlv deíined svstem properties see below,
· Update License soapUI Pro onlv, - see License Management
· Show License Details soapUI Pro onlv, - see License Management
· soapUI.org/eviware.com - Opens http:´´www.soapui.org or http:´´www.e·iware.com
· About soapUI - Shows a ·ersion iníormation dialog
System Properties
1he Svstem Properties option írom the help menu opens a simple dialog showing all current deíined
svstem properties. which can be useíul íor debugging svstem or securitv settings. etc.
1 . 1 O V E R V I E W
5
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Log Tabs
1he bottom right oí the soapUI workspace contains a number oí log windows. each displaving
corresponding output:
Right clicking on a log will show a popup menu with options to clear and enable or disable the log and to
copv selected rows to the clipboard. Also. log-entries can be selected or copied to the clipboard íor
transíer to external tools. An option to set the maximum number oí rows is a·ailable deíault is 1000,.
when exceeding this limit. old rows are remo·ed írom the log i.e. íiío,.
1he íollowing tabs are currentlv displaved when needed,:
· soapUI log - general notiíications and messages
· http Log - http wire log íor sent http requests íor ·iewing the actual data sent and recei·ed on the
socket disabled during Load1esting,
· jetty log - mock-ser·ice related status notiíications írom
· groovy log - log messages írom groo·v scripts using the a·ailable log object disabled during loadtest
1 . 1 O V E R V I E W
6
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
but can be enabled írom lile´Preíerences´UI Settings,
· error log - log with diagnostic iníormation íor errors that arise during execution. this log should be
included in anv bug-reports ií it contains related error iníormation. Please note that not all errors
logged ha·e to be actual errors in soapUI. íor example ií a target ser·er or ser·ice is not a·ailable. a
socket connection error will be shown here. which mav well be due to "natural" causes.
· memory log - shows an scrolling monitor o·er how much oí the memorv allocated to soapUI that is
being used. Right-clicking open a menu with a "G(" option to trigger the Garbage (ollector.
soapUI uses log4j íor logging. vou can customize the log4j coníiguration bv putting a log4j xml
coníiguration íile named "soapui-log4j.xml" in the soapUI bin directorv or the current working directorv
when not running írom there,.
Next: soapUI Pro 1abbed Desktop
1 . 1 O V E R V I E W
7
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.1 OVERVIEW
8
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.1.1
Tabbed Desktop
......................................................................................................................................
soapUI Pro Tabbed Desktop
soapUI Pro adds a tabbed desktop as commonlv a·ailable in other tools and IDL's. 1he lavout is
acti·ated írom the UI Settings 1ab in the soapUI global preíerences dialog: select "1abbed" írom the
Desktop 1vpe combo box.
Opened windows are displaved in tabs that can easilv be
· dragged and arranged into multiple tab groups. Lach tab-group has a top-right menu íor tab-group
related actions.
· docked and undocked írom the desktop into separate windows handv with multiple monitors, -
írom the tabs right-click menu. 1ab-Groups can likewise be docked´undocked írom the 1ab-Groups
top-right menu.
· "glued" or minimized to anv side oí the desktop. which can come in handv íor windows that need to
be open but are not alwavs in íocus. íor example MockSer·ice windows. 1est(ase runners. etc.
1he tab right-click menu has a number oí options íor períorming some oí the abo·e tasks and íor
changing tab orientation´directions.
lor example the íollowing screenshot shows a lavout where the 1est(ase window has been dragged to
the leít and an associated Load1est to the right. 1he 2 load-test diagrams ha·e been dragged to the
bottom.
1 . 1 . 1 T A B B E D D E S K T O P
1
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: soapUI Pro License Management
1 . 1 . 1 T A B B E D D E S K T O P
2
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.1.2
License Management
......................................................................................................................................
soapUI Pro License Management
soapUI Pro license management is straightíorward: when starting soapUI the íirst time. or when the
license has expired. the íollowing dialog will prompt íor a new License:
Selecting either the "Applv íor 1rial" or "Buv License" buttons will open \eb Pages the will let vou get
the right licenses in an external browser.
(hoosing to cancel the dialog without alreadv ha·ing a ·alid license installed will prompt to run soapUI
in "Guest" mode. which has all Pro related íeatures disabled but can still be íullv used as a soapUI
standalone installation.
Aíter speciíving a ·alid íile. vou will be prompted to accept the soapUI license agreement and a
coníirmation dialog will be shown:
1 . 1 . 2 L I C E N S E M A N A G E M E N T
3
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1his dialog can alwavs be opened írom the "lelp´Show License Details" main menu option. A license
can also be updated manuallv with the "lelp´Update License" option which will restart the abo·e
process.
Command Line, Plugins and Licenses
None oí the command line runners will require a license to run. 1he associated 1ool or IDL plug-ins will
be released in pro enabled ·ersions shortlv aíter the stand alone soapUI Pro release.
Next: soapUI Preíerences
1 . 1 . 2 L I C E N S E M A N A G E M E N T
4
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.1.3
Preferences
......................................................................................................................................
soapUI Preferences
1he preíerences dialog opened when selecting the "Preíerences" option írom the íile menu contains the
íollowing tabs:
Tab Description
HTTP Settings Sets various HTTP-related options
...........................................................................................................................................................................................
Proxy Settings Sets HTTP Proxy address and authentication
...........................................................................................................................................................................................
SSL Settings Sets SSL-related options
...........................................................................................................................................................................................
WSDL Settings Sets WSDL-related options
...........................................................................................................................................................................................
UI Settings Sets UI-related options
...........................................................................................................................................................................................
Editor Settings Sets editor-related options
...........................................................................................................................................................................................
Tools Sets paths to integrated tools
...........................................................................................................................................................................................
WSI Settings Sets WS-I Basic Profile validation options
...........................................................................................................................................................................................
Global Properties Manages Global Properties
...........................................................................................................................................................................................
Global Security Settings Manages Global Security Settings
...........................................................................................................................................................................................
WS-A Settings Manages WS-A Settings
...........................................................................................................................................................................................
soapUI Pro Settings Sets soapUI-Pro specific settings
...........................................................................................................................................................................................
Coverage Settings Coverate related settings
...........................................................................................................................................................................................
Code Templates Code Templates settings
Import Preferences
1he global lile menu contains a menu action íor importing global preíerences írom an existing
installation. In soapUI this will prompt íor an existing soapui-settings íile. in soapUI Pro the íollowing
dialog will be shown:
1 . 1 . 3 P R E F E R E N C E S
5
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he options are:
· Iolder - en existing soapUI installation íolder
· Import Preferences, Libraries, Scripts, and Lxtensions - ií the corresponding artiíacts should be
imported
· Overwrite - o·erwrites existing íiles..
Ií importing more than the preíerences. it is recommended to restart soapUI to a·oid script or extension
inconsistencies with the pre·ious installation.
HTTP Settings
Setting Description
HTTP Version Selects the HTTP version
...........................................................................................................................................................................................
User-Agent Header Sets the HTTP User-Agent Header. If none is specified the default
HttpClient header is used
...........................................................................................................................................................................................
Request Compression Selects the request compression type
...........................................................................................................................................................................................
Response Compression Indicates if compressed responses from hosts are accepted
...........................................................................................................................................................................................
Disable Response Decompression Disables decompression of compressed responses
...........................................................................................................................................................................................
Close connections after request Disables HTTP Keep-Alives by requesting to close the HTTP
connection after each request. This will have a negative impact on
performance but may give more realistic values during load testing
...........................................................................................................................................................................................
Disable Chunking Disables content-chunking
...........................................................................................................................................................................................
1 . 1 . 3 P R E F E R E N C E S
6
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Setting Description
Authenticate Preemptively Send Authentication headers with each request without first receiving
an authentication challenge. This is a potential security hazard but will
improve performance since only one request will be required for
authenticated endpoints instead of two
...........................................................................................................................................................................................
Preencoded Endpoints Do not URL-encode endpoints, set this if your endpoint URLs are
already URL-encoded (containing for example %20 or %3A)
...........................................................................................................................................................................................
Bind Address The local address to bind to when sending requests, can be
overridden on a request level (with the corresponding request
property) and on a system level by setting the soapui.bind.address
system variable.
...........................................................................................................................................................................................
Include request in time taken Includes the time it took to write the request in time-taken
...........................................................................................................................................................................................
Include response in time taken Includes the time it took to read the response body in time-taken
...........................................................................................................................................................................................
Socket Timeout The socket timeout for HTTP requests in milliseconds
...........................................................................................................................................................................................
Max Response Size The maximum number of bytes to read from a response (0 =
unlimited)
...........................................................................................................................................................................................
Max Connections Per Host The maximum number of simultaneous connections to a specific host.
Increase this value if you are running LoadTests with more than 500
threads on a particular host.
...........................................................................................................................................................................................
Max Total Connections The total maximum number of connections. Increase this value if you
are running LoadTests with more than 2000 threads.
...........................................................................................................................................................................................
Leave MockEngine Will leave the MockEngine running even when all MockServices have
stopped resulting in much faster startup-times for new MockServices
and 404 errors when trying to call a stopped MockService (instead of
connection failure)
...........................................................................................................................................................................................
Enable Mock HTTP Log Logs wire content of all mock requests. Selecting this option will
degrade Mock Engine performance marginally and may require restart
to enable or disable.
1 . 1 . 3 P R E F E R E N C E S
7
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Proxy Settings
Setting Description
Proxy Host The HTTP Proxy host to use
...........................................................................................................................................................................................
Proxy Port The HTTP Proxy port to use
...........................................................................................................................................................................................
Proxy Username The username sent for proxy authentications
...........................................................................................................................................................................................
Proxy Password The password sent for proxy authentications
...........................................................................................................................................................................................
Excludes A comma-separated list of hosts to exclude, for example
"127.0.0.1:8080,myserver.com" will not use a proxy for 127.0.0.1 on
port 8080 and myserver.com on any port.
Ií a ` is part oí the username. the credentials are interpreted as N1LM credentials: the string up to the `
will be used as the domain and the string aíter will be used as username.
1 . 1 . 3 P R E F E R E N C E S
8
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
SSL Settings
Setting Description
keyStore Path to the keyStore to use when locating client certificates
...........................................................................................................................................................................................
keyStore password the keyStore password
...........................................................................................................................................................................................
Enable Mock SSL Enables SSL support for MockServices
...........................................................................................................................................................................................
Mock Port The port for SSL connections
...........................................................................................................................................................................................
Mock KeyStore The keystore to use for SSL certificates
...........................................................................................................................................................................................
Mock Password The keystore password
...........................................................................................................................................................................................
Mock Key Password The default keys password
...........................................................................................................................................................................................
Mock TrustStore The truststore to use (optional)
...........................................................................................................................................................................................
Mock TrustStore Password The truststore password
...........................................................................................................................................................................................
Client Authentication Indicates if client authentication is required
(hanging either oí íirst two settings should not require a restart oí soapUI to get acti·ated. 1he
MockSer·ice related settings will get applied the next time the MockLngine is started.
1 . 1 . 3 P R E F E R E N C E S
9
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
WSDL Settings
Setting Description
Cache WSDLs Turns on and off caching of WSDL's as described under Caching
Definitions .
...........................................................................................................................................................................................
Sample Values Generates example values in requests when creating from schema
...........................................................................................................................................................................................
Type Comment Generates comments with type information in new requests
...........................................................................................................................................................................................
Include Optional Always includes optional elements in generated requests
...........................................................................................................................................................................................
Pretty Print Pretty prints response messages in response editor
...........................................................................................................................................................................................
Attachment Parts Generates part-elements in request messages for mime-attachments
in RPC messages (required by some ws-stacks)
...........................................................................................................................................................................................
No Content-Type Validation Does not validate the content-type of a mime-attachment against the
type(s) specified in the SOAP-Binding
...........................................................................................................................................................................................
Schema Directory Specifies a directory containing schema (.xsd) files that should be
automatically added when parsing or validating wsdl or requests.
Changing the contents of this directory requires a restart.
...........................................................................................................................................................................................
Name with Binding Tells soapUI to name imported interfaces with the name of their
corresponding soap/http binding, and not with their portType (as
described in Interfaces ). This ensures that WSDL containing bindings
for both SOAP 1.1 and SOAP 1.2 will get unique names during import.
This setting defaults to true.
...........................................................................................................................................................................................
1 . 1 . 3 P R E F E R E N C E S
10
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Setting Description
Excluded Types A list of XML-Schema types and global elements in the form of
name@namespace which will be used when generating sample
requests and responses and input forms in the soapUI Pro Form
editor. By default the XML-Schema root element is added since it is
quite common in .NET services and generates a sample xml fragment
of about 300 kb!.
...........................................................................................................................................................................................
Strict Schema Types Check this to not allow schema type redefinitions in included/imported
xsd:s for a specific WSDL (default behavior in versions prior to 1.7.5)
...........................................................................................................................................................................................
Compression Limit The minimum message size to compress in the soapUI project file for
preserving space. Compression is performed with gzip and the result
is base64 encoded into the project file. For large requests, this can
save up to 90% file-space, but be aware that the requests are no
longer readable or diffable.
...........................................................................................................................................................................................
Pretty Print Project Files Pretty prints project files when they are saved, which makes it easier
to work with a source-control system (diffing, etc...). Be aware that
when selecting this option the size of the project files will increase
substantially and also cached WSDLs and XSDs will be pretty-printed.
UI Settings
1 . 1 . 3 P R E F E R E N C E S
11
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Setting Description
Close Projects Closes all projects at startup for improved startup-time and less
memory consumption.
...........................................................................................................................................................................................
Order Projects Sorts Projects in alphabetical order in the navigator.
...........................................................................................................................................................................................
Order Requests Sorts Requests in alphabetical order in the navigator.
...........................................................................................................................................................................................
Order TestSuites Sorts TestSuites in alphabetical order in the navigator.
...........................................................................................................................................................................................
Show Descriptions Show description content when available
...........................................................................................................................................................................................
Save Projects On Exit Automatically save all projects on exit.
...........................................................................................................................................................................................
Create Backup Creates a backup copy of a projects project-file before saving.
...........................................................................................................................................................................................
Backup Folder The folder where to save backups, if relative or empty the folder is
relative to the project files folder
...........................................................................................................................................................................................
Auto Save Interval Sets a project auto save interval (in minutes). If set over 0, soapUI will
automatically save all projects that have no running tests (both
Functional and Load) at the specified interval
...........................................................................................................................................................................................
Desktop Type Selects which desktop layout to use. soapUI Pro adds a Tabbed
Desktop as an alternative to the default layout. Changing this setting
will be applied when closing the preferences dialog.
...........................................................................................................................................................................................
Native L&F Turns off the use of the default Look & Feel and uses the JRE default
instead. Requires a restart.
...........................................................................................................................................................................................
Do not disable Groovy Log Keeps the groovy log active during LoadTests, which can be useful for
debugging, etc.
...........................................................................................................................................................................................
Show Log Tabs Expands the log tabs when starting soapUI.
...........................................................................................................................................................................................
Show Startup Page Opens startup web page when starting soapUI.
1 . 1 . 3 P R E F E R E N C E S
12
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Editor Settings
Setting Description
Editor Font The font to be used by all XML Editors. The "Select Font" button
opens a dialog for selecting the desired font and size.
...........................................................................................................................................................................................
XML Line Numbers Shows line-numbers by default in all XML-Editors (use Alt-L in editors
to toggle).
...........................................................................................................................................................................................
Groovy Line Numbers Shows line-numbers by default in all Groovy-Editors (use Alt-L in
editors to toggle).
...........................................................................................................................................................................................
Disable auto-resize Disables automatic resizing of request/response editors.
...........................................................................................................................................................................................
Tabbed Request view Sets the tab-layout as the default layout for request/response editors
(see Requests ).
...........................................................................................................................................................................................
Validate Requests Turns on automatic validation of requests before they are submitted
from a request editor. The validation performed is the same as when
pressing Alt-V in the editor.
...........................................................................................................................................................................................
Abort on Invalid Enabled in conjunction with "Validate Requests", if selected any
requests that fail validation will not be submitted.
...........................................................................................................................................................................................
Validate Responses Turns on automatic validation of response messages when they are
received in a response editor. The validation performed is the same
as when pressing Alt-V in the editor.
1 . 1 . 3 P R E F E R E N C E S
13
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Integrated Tools
Paths to integrated 1ools as described under 1ool Integrations
WSI Settings
1hese settings are related to \S-I Validation íunctionalitv as described under \S-I Integrations .
Setting Description
Verbose Sets verbose output of WS-I tools
...........................................................................................................................................................................................
Results Type Sets which results to show in the generated report
...........................................................................................................................................................................................
Message Entry Shows message entries in report
...........................................................................................................................................................................................
Failure Message Includes defined failure messages in report
...........................................................................................................................................................................................
Assertion Description Includes description of each test assertion in report
...........................................................................................................................................................................................
Location Local path to installed WS-I test tools
...........................................................................................................................................................................................
Show Log Shows Log window when running WS-I tools
...........................................................................................................................................................................................
Output Folder If specified, generated HTML reports will automatically be exported to
this folder, which is required when running ws-i validation from the
command-line or one of the Maven plug-ins
Global Properties
Manages global properties. ií a soapui.properties íile has been speciíied. that íiles contents will be
a·ailable in the table. 1he "Lnable O·erride" option will make global properties to alwavs o·erride anv
1 . 1 . 3 P R E F E R E N C E S
14
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
other propertv reíerences see Properties íor more iníormation,.
Global Security Settings
Manages global SoapUI password. Ií password set it is used íor encrvpting soapui-settings íile. \hen
opening soapUI with wrong password speciíied encrvpted íile backup will be created and new
soapui-settings íile will be used. with deíault ·alues.
1 . 1 . 3 P R E F E R E N C E S
15
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
WS-A Settings
Manages \S Addressing settings
Setting Description
Soap Action Overrides WS-S Action If present in the WSDL soap action overrides wsa:Action
...........................................................................................................................................................................................
Use default RelationshipType Indicates using default 'reply' for RelationshipType as specified in
Message Addressing Properties
...........................................................................................................................................................................................
Use default RelatesTo Indicates using default 'unspecified' for RelatesTo as specified in
Message Addressing Properties
...........................................................................................................................................................................................
Override existing headers Indicates replacing/skipping(if unchecked) already existing headers
...........................................................................................................................................................................................
Enable for optional Addressing policy Enables WS Addressing for Policy Addressing Assertion attribute
Optional="true" (see the WS-Policy Assertions specification )
1 . 1 . 3 P R E F E R E N C E S
16
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
soapUI Pro Settings
1hese settings are related to soapUI Pro speciíic íunctionalitv.
Setting Description
Default Request Editor Sets the default Message Editor to use when a Request is opened
...........................................................................................................................................................................................
Default Response Editor Sets the default Message Editor to use when a Response is received
...........................................................................................................................................................................................
Outline Editor Limit Defines the maximum size of messages to handle in the outline editor;
since the outline editor consumes a large amount of memory, setting
a limit related to one’s own memory settings is encouraged
...........................................................................................................................................................................................
Form Editor Limit Defines the maximum size of messages to handle in the form editor;
since the form editor consumes a large amount of memory, setting a
limit related to one’s own memory settings is encouraged
...........................................................................................................................................................................................
Table Inspector Columns Sets the maximum number of columns displayed by the Table
Inspector (due to performance reasons).
...........................................................................................................................................................................................
Script Library Sets the location for the local Script Library .
1 . 1 . 3 P R E F E R E N C E S
17
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Coverage Settings
1hese settings are related to soapUI Pro speciíic \SDL (o·erage íunctionalitv.
Setting Description
Auto Prepare Automatically prepares for Coverage calculation when opening a
window containing Coverage content.
Code Templates
1 . 1 . 3 P R E F E R E N C E S
18
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
soapUI Pro pro·ides initial íunctionalitv to deíine (ode 1emplates which will be replaced with their
corresponding content when tvping them and pressing (trl-Space in anv oí the groo·v editors. 1his
preíerences page allows vou to add´remo·e´modiív (ode 1emplates as desired. Use the '|' character to
speciív the caret position aíter the template has been inserted otherwise the caret will be positioned aíter
the inserted template text,.
soapUI Pro comes with two initial templates:
· grut - deí groo·vUtils ~ new com.e·iware.soapui.support.Groo·vUtils context ,
· xhre - deí holder ~ groo·vUtils.getXmllolder "|4Response" ,
Next: soapUI Pro XPath Selection
1 . 1 . 3 P R E F E R E N C E S
19
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.1.4
XPath Selection
......................................................................................................................................
soapUI Pro XPath Selection Dialog
soapUI Pro includes a XPath \izard or Selection dialog that is a·ailable where·er an XPath expression is
required:
· 1he XPath Assertion editor
· 1he Propertv-1ransíer editor
· 1he MockOperation editor
· 1he (onditionalGoto editor
· etc..
1he selector displavs general instructions and a tree-·iew oí the message or XML to be selected írom.
Na·igating the tree displavs the corresponding XPath expression íor the current node below. Selecting
the desired node and pressing OK will close the dialog and return the selected XPath expression to the
calling íunctionalitv.
1 . 1 . 4 X P A T H S E L E C T I O N
20
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: soapUI Pro \SDL (o·erage
1 . 1 . 4 X P A T H S E L E C T I O N
21
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.1.5
WSDL Coverage
......................................................................................................................................
soapUI Pro WSDL Coverage
soapUI Pro introduces the unique concept oí \SDL (o·erage. which dvnamicallv allows vou to analvze
how much oí a gi·en Interíace or \SDL is being co·ered bv vour lunctional 1ests. MockSer·ices. Mock
(lients and SOAP Monitor clients and targets. 1his document aims at gi·ing a brieí o·er·iew oí the
concepts oí \SDL (o·erage. with links to the corresponding documentation íor each (o·erage point in
soapUI. 1he best wav to learn is to plav around with it!
Web Services Coverage
1raditionallv in en·ironments such as Ja·a or .Net . co·erage is used to measure how much oí the actual
code base that is being used during a gi·en execution scenario usuallv during Unit 1ests,. 1he returned
·alue tries to gi·e an estimate oí how much oí the code base that is actualitv being used or tested.
\eb Ser·ices in soapUI are deíined bv a \SDL contract. which speciíies the operations. message. íaults.
etc... that make up the web ser·ices íunctionalitv. lor each message there is generallv a íinite amount oí
deíined elements attributes that can be used to con·ev the message content. di·ided among message
bodies. headers and íaults.
1he \SDL (o·erage íunctionalitv analvzes each messages contract deíinition and then compares all
corresponding messages during íor example a 1estRun to calculate how manv oí the deíined elements or
attributes that were actuallv used during the tests. 1he result is in soapUI presented as both a percentage
and a ·isualization oí the actual message: "Message (o·erage"
lurther. when running íunctional tests. soapUI analvzes the períormed XPath assertions. and will trv to
calculate a corresponding ·alue oí how manv oí the deíined elements or attributes that ha·e actuallv been
asserted. 1his result is added to the Message (o·erage presentation and called "Assertion (o·erage".
Coverage Visualization
In all situations where (o·erage can be calculated in soapUI. a (o·erage Panel is a·ailable with the
íollowing basic lavout:
· A toolbar at the top íor enabling´clearing (o·erage. setting (o·erage Options and exporting a
(o·erage Report
· A (o·erage 1ree1able to the leít containing the same items as the containing project together with
calculated co·erage percentage´color bar íor the item.
· 1wo inspectors to the right containing either a (o·erage Visualization íor the selected operations
request or response "Message (o·erage", or the actual Message (ontent íor the selected request or
1 . 1 . 5 W S D L C O V E R A G E
22
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
response in the tree.
· Optional Inspectors at the bottom. depending on measurement point:
· Run Log - Shows a log oí the
· Assertion Results : a·ailable when running 1est (o·erage: contains a table oí the períormed
XPath Assertions during the tests. Select a 1estSuite. 1est(ase or 1estStep to narrow down the
assertions. or select an assertion in the table to na·igate to that 1estStep assertion in the tree.
The Coverage Tree
1he (o·erage 1ree displaved to the leít is di·ided into 2 parts:
1. 1he Interíace Part displavs the current projects Interíaces and their Operations. lor each operation
the deíined Request and Response header´bodv´íaults´attachments messages are shown. 1he
displaved (o·erage ·alues are aggregated "upwards" in the tree. íor example in the image abo·e. the
search Operations' (o·erage is 8´9. which is the aggregate oí the corresponding Request and
Response message (o·erage ·alues. 1he ·alues show that the Response laults was not co·ered
during the 1est Run 0´1,
2. 1he 1estSuite part displavs the current projects' 1estSuites. 1est(ases and rele·ant 1estSteps. Under
each 1estStep that was the source oí a Message Lxchange during the 1est Run. there will be Message
nodes corresponding to the sent messages. Selecting a messages request or response node and then
selecting the right Message (ontent inspector will show the actual content oí the message see image
below,. Selecting the Message (o·erage inspector will instead show that messages' co·erage ·alue.
1 . 1 . 5 W S D L C O V E R A G E
23
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Double click an item in the tree will trv to open that items corresponding editor´·iewer
Assertion Coverage
As mentioned abo·e. when running íunctional 1ests. all períormed XPath assertions are analvzed and a
co·erage ·alue measuring how large part oí the \SDL contract that was actuallv asserted. Assertion
(o·erage is displaved in dark-green in both the (o·erage 1ree and the Message Inspector. In the image
below. the Message (o·erage Inspector shows that the item and contained ·alues ha·e been asserted bv
an XPath expression. the assertion can also been seen in the Assertion Results Inspector at the bottom.
1 . 1 . 5 W S D L C O V E R A G E
24
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Coverage Options
1he (o·erage Options dialog a·ailable írom the toolbar allows vou to set the íollowing options:
· Count Lmpty Values - select ií emptv elements and attributes should be regarded as co·ered
· ? Values - select ií elements and attributes containing '·' should be regarded as co·ered
· Lxcluded Llements - a list oí element names in the íormat "{" + Namespace URI + "}" +
local part which should be excluded írom co·erage calculations.
· Multi Values - a list oí element names in the íormat "{" + Namespace URI + "}" + local
part=comma-seperated list of values which will count co·erage íor the speciíied ·alues.
lor example ií vou ha·e a weekdav element vou could enter
{http://my.namespace}weekday=mon,tue,wed,thu,fri,sat,sun and co·erage will be
calculated íor the complete set oí ·alues.
1 . 1 . 5 W S D L C O V E R A G E
25
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Coverage Measurement Points
soapUI allows vou to measure co·erage in 3 distinct scenarios:
1. Ior Iunctional 1ests - íor measuring how much oí vour \SDL contract is actuallv co·ered bv vour
tests. 1he corresponding (o·erage Panel is a·ailable at the Project . 1estSuite and 1est(ase le·el.
2. Ior MockServices - íor measuring both how much oí vour \SDL is being mocked and how much
oí vour \SDL is being utilized´sent bv the Mocks clients.
3. Ior SOAP Monitors - íor measuring how much oí vour \SDL is being used in a real liíe scenario.
Next: \orkspaces
1 . 1 . 5 W S D L C O V E R A G E
26
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.2
Workspaces
......................................................................................................................................
Workspaces
In soapUI a \orkspace is a collection oí Projects. just like in. íor example. eclipse:
· Deíault workspace iníormation is maintained in the
${user.home}/default-soapui-workspace.xml íile. Switch workspaces using the New or
Switch \orkspace actions described below. ií switching to another workspace. soapUI will remember
this until the next session and use that workspace instead.
· Anv number oí projects can be added to the workspace
· Anv number oí workspaces can be created
At startup soapUI loads all project íiles contained in the last used workspace and opens them ií thev were
not pre·iouslv closed see below,. Ií a project íile is íor some reason not a·ailable it will be graved out
and displaved as disabled. with right-click options to either remo·e it írom the workspace or reload it
optionallv írom a new location,.
Projects can be imported and created and remo·ed írom the workspace using the Menu (hoices on the
\orkspace or in the Project popup menus.
\hen exiting. soapUI will automaticallv sa·e all project íiles in the workspace. except íor those that still
ha·e running tests. A prompt will ask to ignore these or abort the exit. Ií soapUI detects that a project
íile has been modiíied externallv since it was last loaded. based on modiíication date. it will íirst prompt ií
to o·erwrite the íile or lea·e it as it is.
Open or Close Projects
Projects can be closed´opened as desired using corresponding popup-menu actions: closed projects are
displaved with a grev icon and can easilv be opened bv either double-clicking them or using the
corresponding right-button menu option. (losed projects are not read into memorv which will greatlv
impro·e startup time and memorv consumption and A projects open or close state is remembered in the
workspace when restarting or switching workspaces and a global UI Setting is a·ailable see Preíerences ,
íor alwavs closing all projects when loading a new workspace.
soapUI Workspace Actions
1he íollowing actions are a·ailable írom the workspace nodes right-button menu and írom the main
"lile" menu,:
· New SoapUI Project : Prompts to create a new SoapUI Project .
· Import Project : Prompts íor a íilename íor an existing soapUI project. 1he project will be added to
the current workspace. Ií the project-íile is read onlv it can still be added but no changes will be sa·ed
and a warning will be shown in the soapUI log.
1 . 2 W O R K S P A C E S
27
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Import Remote Project : Prompts íor a URL to an existing remote soapUI project. 1he project will
be added to the current workspace in read onlv mode read more on Remote Projects ,.
· Save All Projects - Sa·es all projects
· Open All Closed Projects - Opens all closed projects.
· Close All Open Projects - Prompts to close all opened projects.
· Rename - Renames the \orkspace. the name is shown as the label íor the root node in the
Na·igator
· New Workspace - Prompts to create a new emptv workspace.
· Switch Workspace - Prompts íor an existing workspace íile to switch to all current projects will be
sa·ed beíore making the actual switch,.
· Online Help - Displavs this page in an external browser
soapUI Workspace Details Tab
1he "Details" tab shown in the bottom leít shows the íollowing ·alues when the workspace node is
selected in the na·igation tree
· Name : the name oí the current workspace
· Description : an arbitrarv description oí the current workspace. displaved as a tooltip o·er the
workspace node in the Na·igator.
· Iile read-onlv,: the current workspace íile used
· Project Root : the root íolder to user íor projects
Next: \eb Ser·ice 1est Projects
1 . 2 W O R K S P A C E S
28
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3
Projects
......................................................................................................................................
Web Service Testing Projects
Anv number oí projects can be created in the current soapUI \orkspace. either bv creating new ones
see below, or importing existing ones... A soapUI Project contains the íollowing items in the Na·igator:
· A number oí \SDL Interíaces corresponding to a SOAP´l11P Binding íor a deíined Port1vpe
· A number oí RLS1 Ser·ices optionallv corresponding to a deíined \ADL
· A number oí 1estSuites containing 1est(ases íor these Interíaces' Operations
· A number oí MockSer·ices containing Mock implementations oí these Interíaces' Operations
soapUI projects are sa·ed in a selí contained xml íile upon creation as described abo·e,. 1his íile can be
saíelv mo·ed around. checked into (VS. sent bv email. etc. 1here are a number oí íile-svstem reíerences
possible in a project which will be resol·ed relati·elv to the current working directorv or the Resource
Root see below, unless thev are speciíied as absolute paths. \hen obtaining an existing soapUI project
íile. this can be added to the current workspace with the "Import Project" action on the \orkspace
popup menu.
soapUI 2.5 introduces a "Resource Root" project le·el propertv that can be used to speciív the root
íolder íor reíerenced íiles attachments. properties. DataSink´DataSources. etc..,. \hen speciíied. all
paths will be relati·ized to this íolder and displaved as such.
Internallv. soapUI abstracts the actual nature oí projects and their contained interíaces. tests. etc...
opening the possiblitv oí support íor other ser·ice deíinitions or protocols than \SDL ´ SOAP check
out the com.eviware.soapui.model package,. (urrentlv though. the onlv implementation íor these
interíaces is íor \SDL 1.1 and the SOAP´l11P binding as required bv Basic Proíile 1.0,. 1hereíore. all
actions and íunctionalitv described will be in regard to this implementation.
Creating a SoapUI Projects
Selecting the New SoapUI Project option írom the \orkspace Menu opens this dialog which prompts
íor:
· A name íor the project is required
· An optional initial \SDL´\ADL to import into the project either íile or URL,
· An option to create deíault requests when speciíving an initial \SDL
· An option to generate a skeleton 1estSuite íor the speciíied \SDL or \ADL
· An option to create \eb Ser·ice Simulation oí the imported \SDL
· An option to open a dialog to deíine a RLS1 ser·ice without a \ADL
· An option to store all íile paths in project relati·elv to project íile will prompt to sa·e project aíter
closing dialog,
1 . 3 P R O J E C T S
29
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Remote Test Projects
soapUI 1.¯.6 and íollowing can handle remote project íiles o·er https, in read onlv mode basic
authentication is supported,. \hen importing. the URL to the project íile is sa·ed in the workspace and
can be closed. opened. or reloaded as usual.
Remote projects are alwavs closed at startup and marked with a light blue icon in the na·igator.
1his opens íor a number oí possibilities:
· Projects can easilv be distributed to clients without the requirement to download updates. íor
example íor testing or demonstration purposes.
· 1he command line 1estRunners also accept http url project íiles. allowing íor centralized storage oí
project íiles e·en ií thev are run in a distributed testing en·ironment
Remote projects can be modiíied as normal projects. but soapUI will not prompt to sa·e them on exit or
close. Ií changes to a remote project need to be sa·ed. use the "Sa·e as" Project Menu action which
prompts to sa·e the project locallv. transíorming it to a regular íile based project.
Test Project Actions
1he íollowing actions are a·ailable írom the project nodes' right-button menu:
1 . 3 P R O J E C T S
30
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Show Project View - Opens the Project View \indow
· Add WSDL - Prompts íor a \SDL either URL or íile path, that will be parsed and imported
accordinglv
· Add WADL - Prompts íor a \ADL either URL or íile path, that will be parsed and imported
accordinglv
· New RLS1 Service - Opens a dialog íor adding a new RLS1 Ser·ice to this project
· Launch 1estRunner - Opens the dialog íor launching the (ommand Line 1estRunner
· Launch Load1estRunner - Opens the dialog íor launching the (ommand Line Load1estRunner
· Launch SOAP Monitor - Opens the dialog íor launching the SOAP Monitor
· New 1estSuite - Prompts to create a new 1estSuite in the selected project
· New MockService - Prompts to create a new MockSer·ice in the selected project
· Rename - Prompts to rename the selected project. 1he new name will be shown in the na·igation
tree. 1he íilename oí the project will be unaííected
· Remove - Prompts to remo·e the selected project írom the workspace. 1he project íile will not be
deleted and can be imported back into the workspace subsequentlv
· Reload Project - Prompts to reload the project írom its external source. discarding anv changes
· Resolve Project - Resol·es missing links between project elements
· Close Project - Prompts to close the current project. disabling it in the workspace
· Save Project - Sa·es the state oí the project and all its contained items to the underlving project íile
· Save Project As - Sa·es the state oí the project and all its contained items to a new project íile
· Import 1est Suite - Imports a pre·iouslv exported 1estSuite
· Online Help - Displavs this page in an external browser
Project Details Tab
1he "Details" tab shown in the bottom-leít shows the íollowing ·alues when the workspace node is
selected in the na·igation tree
· Name : the name oí the project
· Description : an arbitrarv description oí the project. displaved as a tooltip o·er the projects' node in
the Na·igator.
· Iile read-onlv,: the selected projects project-íile
· Resource Root : sets ií íolder to use as base íor all reíerenced íiles
· Cache Definitions : sets ií deíinitions should be cached íor this project see (aching Deíinitions ,.
1his o·errides the global "(ache \SDLs" setting under the \SDL Preíerences settings tab
· Project Password - Sets the password to use íor encrvpting the project íile when sa·ing. see
Lncrvption íor details.
· Composite Project - Sets this project to be sa·ed as a composite project Read More ,.
Project View
1 . 3 P R O J E C T S
31
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
\hen double clicking a project vou will get the Project View. 1he purpose oí the project ·iew is gi·ing
vou a work area íor project related íunctionalitv.
1he Project ·iew consist oí a number oí tabs a·ailable at the top and a number oí inspectors a·ailable at
the bottom oí the project ·iew. 1he inspectors are context sensiti·e and will change based on which tab
vou choose.
1he 1abs are as íollows:
· Overview 1ab 1he o·er·iew tab gi·es vou an quick o·er·iew oí vour project as well as general
project metrics such as the number oí 1estSteps the project contains. Read More
· Project Coverage 1ab (Pro Only) Project (o·erage allows vou to see how much oí the interíaces
contained in the project that is being co·ered bv tests. 1his íunctionalitv will make vou de·elopment
process more eííicient and will increase 1est Oualitv considerablv. Read More
· Project Requirements 1ab (Pro Only) 1he Project Requirements tab is an easv wav oí managing
test requirements in soapUI. Read More
· WS-Security Configuration 1ab 1he \S-Securitv (oníiguration 1ab is the working area íor
creating \S-Securitv coníigurations to be used in 1ests. SOAP Monitor or MockSer·ices. Read More
Next: Project O·er·iew
1 . 3 P R O J E C T S
32
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3 PROJECTS
33
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3.1
Project View
......................................................................................................................................
Project View Tab: Main View
1he project ·iew contains useíul iníormation and metrics about vour project. such as where íiles are
stored. 1est Metrics and MockSer·ice Metrics. 1his is intended as a ·erv quick wav oí getting iníormation
and o·er·iew oí the project.
\e also ha·e a number oí project related inspectors at the bottom oí the screen
Description Inspector
1he Description Inspector is a wav to write and maintain general iníormation about the Project.
1 . 3 . 1 P R O J E C T V I E W
34
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Description Inspector
1he Properties Inspector handles Project le·el Properties. 1hese properties can be used in le·els below
the Project.
Load Script Inspector
1he Load Script Inspector enable vou to create Groo·v Scripts that runs whene·er vou open a project.
1his might be setting Project Properties. svnching Project Requirements with external sources and more.
Save Script Inspector
1he Sa·e Script Inspector is the opposite oí the Load Script Inspector. it enables vou to create Groo·v
Scripts that runs whene·er vou close a project. 1his might be writing data to íile. svnching Project
Requirements with external sources and more.
1 . 3 . 1 P R O J E C T V I E W
35
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: Project (o·erage
1 . 3 . 1 P R O J E C T V I E W
36
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3.2
Coverage
......................................................................................................................................
Project Coverage
Project (o·erage is the main (o·erage analvsis point íor 1est (o·erage. allowing vou to run all tests in
vour project and see the resulting (o·erage analvsis. Apart írom the standard (o·erage panel. the toolbar
includes a Run´(ancel´Progress bar that will run all 1estSuites in the current project. continuouslv
updating co·erage as thev execute.
1he bottom oí the panel has been extended with a "Run Log" inspector which shows ongoing output
írom the running 1estSuites´1est(ases
Next: \eb Ser·ice Project Requirements
1 . 3 . 2 C O V E R A G E
37
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3.3
Requirements
......................................................................................................................................
Web Service Project Requirements
Project Requirements soapUI Pro onlv, is an editor handling the requirements oí the project. A short
explanation oí the íunctionalitv is that in general vou can add. remo·e. edit. import and export
requirements.
1he requirement can then be connected to the 1est(ases íulíilling the requirements. linked to important
iníormation or documented.
Project Requirements Menu Bar
1he Project Requirements contains the íollowing menu bar items:
1 . 3 . 3 R E Q U I R E M E N T S
38
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Add Requirement. Add a Requirement
· Remove Requirement Remo·e a Requirement
· Import Requirements Import Requirements írom a text íile. See íormat below.
· Lxport Requirements Lxport Requirements to a text íile. See íormat below.
Import File Format
1he íile íormat íor importing and exporting is quite simple. the íields are comma separated and in quotes.
Onlv the main íields: ID. Name. Short Description and Status are supported. Lxample:
"TST-049","User Name Length","User Name must exceed 6 chars and be case
sensitive","In Scope"
"EVI-020","Cu No SQL Injection Test","Test SQL Injection","Out of Scope"
"EVI-021","Loadtest Purchase","We must make sure that Purchase withstand a buying
storm","Out of Scope"
Web Service Requirements List
1he data in the requirements list is the íollowing:
· ID 1his is the ID íor the Requirement. Generallv the idea is that ID should be imported írom a 1est
Management svstem or Project Management svstem. but it works períectlv well as a stand alone ID.
ID does not need to be unique.
· Name Name ií the Requirement.
· Short DescriptionShort Description íor the Requirement. Long description should be entered in the
description the description Inspector.
· Status Status oí the Requirement. 1here are two in built ·alues signiíving whether the Requirement
should be tested or not. but vou can manuallv enter anv Status.
· 1estCases 1his shows the number oí 1est(ases added in the 1est(ases Inspector.
Requirements Inspectors
1here are three Requirements Inspectors:
· 1estCases 1his is the íunctionalitv íor connecting a Requirement to a 1est(ase in soapUI. \ou can
double click anv 1est(ase and run it.
1 . 3 . 3 R E Q U I R E M E N T S
39
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Links Link to useíul reíerences or actual Requirements in a Project management svstem.
· DescriptionLong description oí the 1est(ase.
Next: \S-Securitv
1 . 3 . 3 R E Q U I R E M E N T S
40
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3.4
WS-Security
......................................................................................................................................
WS-Security
1his document will gi·e an o·er·iew on how to coníigure \eb Ser·ices Securitv. \S-Securitv. related
settings in soapUI. It does vot stri·e to explain \S-Securitv and related standards themsel·es. please seek
this iníormation elsewhere!
soapUI manages \S-Securitv related coníigurations at the project le·el. allowing these coníigurations to
be used at se·eral places within a project:
· lor outgoing requests and their responses. see \eb Ser·ice Requests
· lor incoming requests to MockSer·ices and their MockResponses. see MockSer·ices
· lor monitored requests and their monitored responses. see SOAP Monitors
soapUI deíines three tvpes oí objects that need to be coníigured to enable \S-Securitv:
· KevStores ´ (ertiíicates - hold kevs ´ certiíicated to be used íor encrvption.decrvption.signing. or
·eriíication.
· Outgoing \SS - coníigurations to be applied to outgoing messages. either requests or
MockResponses
· Incoming \SS - coníigurations to be used íor decrvpting or ·eriíving incoming messages containing
\S-Securitv tokens: responses. MockRequests or monitored requests and responses
All these are managed írom the \S-Securitv tab in the Project View and then applied to their desired
targets at corresponding locations
Usage
1he basic ílow to enable \S-Securitv is the íollowing:
1. Add vour Kevstores´(ertiíicates to the Kevstores tab.
2. (reate rele·ant Outgoing \SS and Incoming \SS coníigurations
3. Associate the created coníigurations with vour desired endpoints. requests. mockresponses etc..
Once a coníiguration has been associated with íor example, a request. it will be automaticallv applied
when sending the request and recei·ing its response. \ou can see the actual message with all the applied
\SS-tokens in the http log or the "Raw" editor tab in the request and MockResponse editors.
1 . 3 . 4 W S - S E C U R I T Y
41
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Keystores
1he Kevstores ´ (ertiíicates tab allows vou to add an arbitrarv number oí kevstores and certiíicate-íiles
to vour \S-Securitv coníiguration. 1hese should contain the corresponding Kev Material to be used íor
securitv-related processing.
Add add new Kevstore or (ertiíicate bv selecting the Add button in the toolbar. browse to the
corresponding íile and press ok. \ou will be prompted íor the password to the íile and it will be added to
the list. the Status column will displav ií loading went ok.
1he íollowing columns are a·ailable in the Kevstores table:
1 . 3 . 4 W S - S E C U R I T Y
42
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Source : the source íile oí the kevstore´certiíicate Read Onlv,
· Status : the load-status oí the kevstore´certiíicate Read Onlv
· Password : the kevstore password ií required
· Deíault Alias : the deíault alias in a kevstore to use íor ·alidation or decrvption
· Deíault Password : the password íor deíault alias
· Securitv Pro·ider : the JSSL Securitv Pro·ider to use íor handling certiíicates -· Remo·ed in 2.5. ií
vou need it back let us know!
Outgoing WSS
Outgoing \SS coníigurations are used íor processing outgoing messages: encrvpting. signing. etc. Lach
coníigurations contains a coníigurable number oí "\SS Lntries". each corresponding to some
\SS-related action to be taken on the outgoing message.
1he table on the top contains the currentlv coníigured coníigurations. add new ones with the "Add"
button in the tables toolbar. which will prompt íor a unique name íor the coníiguration. In the table it is
also possible to set deíault username´password ·alues íor the coníiguration. which will be used be the
coníigurations \SS Lntries where applicable.
\hen selecting a coníiguration in the table. the lower halí oí the window will show the currentlv
coníigured entries íor that coníiguration as tabs:
Add new entries to the selected coníiguration with the Add Lntrv toolbar button on top oí the tab panel.
Anv number oí entries can be added: entries are applied in the order thev are shown in the tabpanel. 1he
íollowing tvpes oí entries are currentlv a·ailable:
Incoming WSS
Incoming \SS coníigurations are used to process incoming messages responses. MockRequest and
monitor requests´response, and decrvpt´·alidate their encrvpted´signed content. Since the \S-Securitv
headers oí an incoming message contain most oí the iníormation required to decrvpt or ·alidate a
message. the onlv coníiguration needed bv soapUI is which kevstores that contain reíerenced kevs and
1 . 3 . 4 W S - S E C U R I T Y
43
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
certiíicates íor decrvption and signature ·alidation.
Add new Incoming \SS coníigurations using the "Add" toolbar button on top oí the table. vou will be
prompted íor a unique name íor the coníiguration and can then íurther associate the kevstores to use íor
decrvption or ·alidation in the table. Optionallv speciív the password required íor ·alidating signatures ií
not speciíied and required. a popup will be shown during the ·alidation process,.
\hen recei·ing a message with an associated Incoming \SS coníiguration in one oí the
request´MockResponses editors. the results oí the processing will be shown in the "\SS" Inspector íor
the corresponding message. 1he inspector shows a list oí processing results and anv errors that mav ha·e
occurred:
lor testing. there is also a \S-Securitv Status Assertion that can be added to a 1estRequest step íor
·alidating that the \S-Securitv headers were ·alid in the recei·ed response.
Next: Project Lncrvption
1 . 3 . 4 W S - S E C U R I T Y
44
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3.5
Encryption
......................................................................................................................................
Project Encryption
1o protect sensiti·e data in project íiles passwords. request data. etc, a Project Password propertv has
been added in the bottom leít properties table. Setting this propertv bv speciíving a password will result
in that project íile being encrvpted when sa·ed. 1he project will be marked in Navigator as shown
below:
1 . 3 . 5 E N C R Y P T I O N
45
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3.5 ENCRYPTION
46
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
A project can not be composite and encrvpted at same time. Ií vou set password íor composite projects.
the composite propertv will be set to íalse and and error message will be displaved. Same goes ií vou trv
to set composite propertv to true on encrvpted project.
Working with encrypted project
\hen starting soapUI encrvpted projects will not be opened automaticallv: vou need to open them
manuallv bv double-clicking which will íirst prompt vou íor the password required to decrvpt the project
íile:
Ií password is correct the project will be opened. ií password is wrong it stavs closed. Please remember
vour passwords. there is no wav to decrvpt a project without a password!
Encryption in global settings
Ií vou need to protect data that is stored in the global settings Proxv. SSL. etc, there is also a global
password setting:
1 . 3 . 5 E N C R Y P T I O N
47
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Setting this password will encrvpt soapui-settings.xml where soapUI stores all global settigns. \hen
starting soapUI with encrvpted soapui-settings.xml vou will be asked íor password íirst:
Ií correct soapUI will restore all vour settings with workspace and projects. Ií not vou will get:
1 . 3 . 5 E N C R Y P T I O N
48
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he encrvpted soapui-settings will be sa·ed in a backup íile and a new deíault settings will replace vour
old settings.
Next: (omposite Projects
1 . 3 . 5 E N C R Y P T I O N
49
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3.6
Composite Projects
......................................................................................................................................
soapUI Pro Composite Projects
\hat is a (omposite Project·
Behind the somewhat bewildering terminologv lies a ·erv simple concept: (omposite Projects are soapUI
projects sa·ed to enable 1eam (ollaboration.
Let's explain more in detail. Normallv a soapUI Project is sa·ed as one xml íile. 1his has its ad·antages:
vou ha·e onlv one íile to consider and that íile contains all iníormation about that project. It also has
some disad·antages: collaboration and joint team test de·elopment is ·erv hard because svnchronization
is ·erv hard to do.
\hen working in a 1eam in a project vou oíten come to the situation where vou ha·e one person
updating one test and another person a second test. Ií vou onlv ha·e one project íile this is impossible to
do simultaneouslv and hard to do bv svnching the test manuallv.
In comes (omposite Projects: composite SoapUI projects are sa·ed as a íile svstem. which means
updating. changing. or committing parts oí projects. like a 1est(ase. are much easier to do.
Composite File System
A (omposite SoapUI project is sa·ed in directorv with the project name. It contains separate directories
íor each Interíace. 1estSuite. MockSer·ice and lile Settings.xml. lile Settings is used íor storing where
settings and data íor the project itselí. \ou can see it as the meta íile. Lach interíace directorv contains
one íile named interíace settings.xml íile and íor each operation one xml íile named bv it. 1he 1estSuite
directorv contains one settings.xml íile and one xml íile íor each 1est(ase named bv it. Mock ser·ice
directorv contains one settings.xml and one xml íile íor each MockOperation named bv it.
1 . 3 . 6 C O M P O S I T E P R O J E C T S
50
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Creating a Project Composite
(reating a soapUI composite project is easv. In project properties vou can íind a propertv to set
:Composite Project that can be true or íalse. Setting it to true will make vour soapUI Project sa·e in
composite íorm projects that ha·e set Project Password can not be composite,.
1 . 3 . 6 C O M P O S I T E P R O J E C T S
51
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Composite behavior and actions
\hen renaming elements in a project. ie Interíaces. Operations´Resources. 1estSuite. 1est(ase. and
more. corresponding elements in the composite íile svstem will be renamed ií there is no íile or directorv
with the same name. otherwise soapUI will show a warning message. Deleting element means remo·ing
them írom the íile svstem. 1hrough the Projet-popup sub-menu Composite Actions. it is possible to
sa·e or reload elements.
Import/Export of TestSuites and TestCases
lor both 1estSuites and 1est(ases it is possible to export and import them írom their containing items
popup menus: speciív a target´source íolder as desired. Please note that these are not "compatible" or the
same as 1estSuites and 1est(ases in a composite project: this is merelv an alternati·e wav íor non-Pro
users to share 1est items between projects´people.
Next: Resol·ing Project Items
1 . 3 . 6 C O M P O S I T E P R O J E C T S
52
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.3.7
Project Resolving
......................................................................................................................................
Resolving Project Items
\hen importing an existing Project. 1estSuite or 1est(ase. soapUI will automaticallv check the imported
items íor consistancv regarding íile-reíerences. etc. 1his can also be triggered manuallv írom the Project
popup menu,. Ií there are resol·e errors íor example ií a reíerenced íile is missing,. a Resol·e dialog is
shown as íollows:
1he dialog contains a table with the íollowing columns:
· Item - the Model Item that has an unresol·ed propertv´settings´·alue
· Description- a description oí the resol·e error
· Value - the ·alue that íailed to resol·e
· Action - a drop-down containing actions that can be taken to resol·e the item: períorm the desired
action to resol·e the error
Ií a resol·e action potentiallv resol·ed se·eral other items use the Update button to re-resol·e the project.
(losing the Resol·e dialog ií there are still unresol·ed item will prompt to lea·e them as thev are.
Next: Interíaces
1 . 3 . 7 P R O J E C T R E S O L V I N G
53
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4
WSDL Interfaces
......................................................................................................................................
WSDL Interfaces
In the current implementation oí the internal soapUI object model. \SDL Interíaces correspond to
SOAP´l11P Bindings íor a Port1vpe. Once imported using the "Add \SDL.." action. the interíaces'
operations and deíault requests will be ·isible in the na·igator tree. 1he actual import process is below
described in more detail .
Interface Actions
1he íollowing actions are a·ailable írom the interíace nodes' right-button menu:
· Show Interface Viewer : Opens the Interíace Viewer window
· Generate Code : In·okes one oí the integrated tools as described under 1ool Integrations
· Check WSI Compliance : In·okes the \S-I Basic Proíile ·alidation tools íor this interíace
· Launch 1cpMon : launches 1cpMon íor this interíace as described in 1cpMon Integration .
· Generate 1estSuite : Generates a complete 1estSuite íor this interíace see more here,
· Generate MockService : Generates a complete MockSer·ice íor this interíace see more here,
· Generate Documentation : Generates a simple l1ML documentation íor the entire \SDL
deíining the Interíace
· Update Definition : see below
· Refactor Definition (Pro Only) : Starts the \SDL reíactor deíinition \izard. Read More lere
· Lxport Definition : prompts íor a local íolder and sa·es the entire deíinition including
imported´included documents, to that íolder. Import´Include statements in the exported íiles will be
modiíied accordinglv to maintain the deíinitions integritv
· Remove : prompts to remo·e the interíace írom its containing project. \hen remo·ing an Interíace.
all test-requests associated with operations in that Interíace will also be remo·ed írom their respecti·e
1est(ases.
· Online Help - Displavs this page in an external browser
Updating the Interface Definition
1he "Update Deíinition" action prompts írom where to reload the deíinition íor this interíace. Updating
will svnchronize anv changes in the underlving Binding´Port1vpe as best as possible:
· New operations are added as new Operations in the na·igator
· Operations not a·ailable anv more can either be mapped to new ones ií thev were renamed, or
remo·ed. \hen remo·ing operations. all test-requests associated with them will also be remo·ed
írom their respecti·e 1est(ases.
1 . 4 W S D L I N T E R F A C E S
54
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1his action is useíul in the íollowing situations:
· \hen the deíinition URL íor a ser·ice´interíace has changed íor example mo·ed to another ser·er,
· \hen the deíinition itselí has changed íor example new operations ha·e been added or the
associated XML Schema has been modiíied
1he dialog íor updating a deíinition is as íollows:
1he options are:
· Definition URL - 1he URL to the deíinition i.e. \SDL, to update írom
· Create New Requests - Ií there are new operations in the updated \SDL. selecting this option will
create new deíault requests íor them
· Recreate Requests - \ill recreate all requests in the project that use this deíinition. including
1estRequest steps in associated 1est(ases.
· Recreate Optional - Set creation oí optional elements´attributes when updating requests
· Keep Lxisting - Keeps existing ·alues in requests that are recreated this is limited to
elements´attributes that ha·e the same namespace´name beíore and aíter the update,
· Create Backups - Since recreating requests can potentiallv in·alidate´modiív the request in a wav
not desired. selecting this option will create a backup request or disabled 1estRequest Step containing
the original request.
· Update 1estRequests - All 1estRequests in the containing project íor the updated interíace will be
updated as coníigured abo·e.
1 . 4 W S D L I N T E R F A C E S
55
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Open Request List - Opens a separate window aíter the update containing a list oí all
Requests´1estRequests that ha·e been modiíied during the update-procedure useíul íor manual
post-processing,.
Ií there is no binding in the speciíied deíinition matching the pre·ious binding íor the selected interíace
íor example ií the binding has been renamed, an error will be displaved.
Caching Definitions
Bv deíault soapUI caches the entire \SDL´XSD deíinition in the project íile. mainlv íor the íollowing
reasons:
· Change Independence - ·alidations. etc are not aííected bv external changes to the deíinition. 1his
mav be both good or bad
· Work Offline - one can work oííline with request generation. ·alidations. tests. etc.
· Iast Access - the soapUI attachments íeature alwavs requires access to the interíace deíinition
1he major drawback is that the soapUI project-íile will grow accordinglv: ií the deíinition is a complex
one this mav take considerable processing power. Ií vou íor this or some other reason would like to
disable deíinition caching this can be done either globallv in the soapUI Preíerences dialog. or on a
per-project basis in the Projects Details 1ab .
1urning this option oíí will clear currentlv cached deíinitions íirst when soapUI restarts. Ií vou want to
íorce the reloading oí a \SDL deíinition whether it is cached or not, use the Update Deíinition action
described abo·e.
Interface Details Tab
1he "Details" tab shown in the bottom-leít shows the íollowing ·alues when an Interíace node is
selected in the na·igation tree
· Port1ype read-onlv,: 1he name oí the \SDL Port1vpe that the Binding exposes
· Description : an arbitrarv description íor the interíace
· Definition URL read-onlv,: the URL where the Interíace is deíined i.e. írom where it was
imported,
· Binding read-onlv,: 1he name oí the \SDL Binding íor the interíace in {namespace}name
íormat
· SOAP Version : 1he SOAP Version to use íor this interíace: SOAP 1.1 or SOAP 1.2. 1his will aííect
both generated requests namespaces and content, and according l11P leaders
· Cached read-onlv,: Shows ií this deíinition is currentlv cached in memorv
· Style read-onlv,: Shows ií this is a Document or RP( deíinition
· WS-A version : Shows wsa namespace ·ersion
· WS-A anonymous : indicates the ·alue oí \S Addressing anonvmous as speciíied in \eb Ser·ices
Addressing 1.0 Metadata speciíication . Allowed ·alues are:
1. optional - deíault
2. required - ií AnonvmousResponses element deíined
1 . 4 W S D L I N T E R F A C E S
56
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
3. prohibited - ií NonAnonvmousResponses element deíined
WSDL Importing Details
\hen importing a \SDL using one oí the "Import \SDL .." project actions. the import proceeds as
íollows:
· 1he speciíied \SDL is loaded and searched íor deíined \SDL Ser·ices. Ií the \SDL is secured
soapUI will displav an authentication dialog asking íor rele·ant credentials. Once the \SDL has been
loaded. each oí the included ser·ices' ports' binding is imported as a separate Interíace into the
soapUI project pro·ided that it is a SOAP 1.1´1.2 binding,. Ií no ser·ices are íound. the importer
searches íor standalone SOAP Bindings that are not bound to anv ser·ice. these are imported as
separate interíaces
· lor each imported Binding. its Port1vpes Operations are added as Operations and a deíault request
is created ií speciíied, írom the operations request schema.
· Lither the name oí the Binding or its Port1vpe is used as the Interíace name in soapUI. as controlled
bv the corresponding "Name with Binding" \SDL Setting .
1he reasons íor mapping Interíaces to \SDL Bindings and not \SDL ser·ices directlv are:
· A \SDL Ser·ice can "implement" multiple bindings through \SDL ports,. each is imported as a
separate Interíace into soapUI
· A Binding can be "implemented" bv se·eral \SDL Ser·ices íor example on diííerent ser·ers or as a
part oí a more complex ser·ice interíace,. soapUI allows association oí multiple ser·ice endpoints
see below, íor a binding so it is easv to work with the same binding i.e. Interíace, without ha·ing to
import each separatelv.
· Bindings can be deíined without anv reíerencing ser·ice. it should still be possible to work with these
írom soapUI
\hen importing the íollowing XML-Schemas are added bv deíault and need not be imported explicitlv
bv the \SDL and´or its contained´imported´included tvpes:
· http:´´www.w3.org´2004´08´xop´include : XOP includes used bv M1OM
· http:´´www.w3.org´2004´11´xmlmime : xmime tvpes used bv M1OM
· http:´´www.w3.org´2005´05´xmlmime : xmime tvpes used bv M1OM
· http:´´www.w3.org´XML´1998´namespace : XML Namespaces
· http:´´ws-i.org´proíiles´basic´1.1´xsd : swareí tvpes used bv SOAP with Attachments support
· http:´´www.w3.org´2001´XMLSchema : XML Schema itselí
It is possible to speciív a custom directorv containing additional deíault schemas in the \SDL Settings
preíerences tab: "Schema Directorv". Note that content-changes to an alreadv speciíied directorv will not
be detected bv soapUI and thus currentlv require a restart.
Next: Interíaces O·er·iew
1 . 4 W S D L I N T E R F A C E S
57
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.1
Interface View
......................................................................................................................................
Interface View Tab: Main View
1he interíace ·iew contains useíul iníormation and metrics about vour project. such as where íiles are
stored. \SDL Stvle Binding and more. 1his is intended as a ·erv quick wav oí getting iníormation and
o·er·iew oí the Interíace.
Please note that the Use oí the Operations is listed per operation and not with the stvle. \e usuallv reíer
to them together Document´Literal,. but since it can change per operation. that where it has to be
shown.
Service Endpoints
Selecting the Ser·ice Lndpoints action írom the interíace context menu opens a dialog showing the
a·ailable ser·ice endpoints íor this interíace and each endpoints deíault authentication settings. Ií the
interíace was imported írom a \SDL deíinition. that ser·ices ports URL will be a·ailable in this list. and
vou are íree to add. edit. or remo·e as manv ser·ice endpoints as vou want.
1 . 4 . 1 I N T E R F A C E V I E W
58
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Ií vour endpoints are alreadv URL-encoded. vou should select the "Preencoded Lndpoints" option in the
lttp Settings dialog to a·oid that thev get reencoded during requests. \hen deleting an endpoint. all
requests that had that endpoint will ha·e their endpoint set to null.
Speciíied authentication ·alues will be used íor all Requests´1estRequest that use the endpoint. unless
anv oí the ·alues ha·e been o·erridden at the request le·el.
1he Assign options prompts to assign the selected endpoint to requests. the íollowing options are
displaved:
· - all requests - : will assign the selected endpoint to all requests íor operations in the current
interíace.
· - all requests with no endpoint - : will assign the selected endpoint to all requests íor
operations in the current interíace that ha·e no endpoint.
· <endpoint> : will assign the selected endpoint to all requests íor operations in the current interíace
that ha·e this endpoint.
Assigning endpoints with this option will not assign to 1estRequests. use the "Set 1est(ase Lndpoint"
action in the 1est(ase Lditor íor this instead.
\hen closing the dialog with the "Ok" button. the a·ailable endpoints will be selectable in associated
operations request or test requests editor panes.
WSDL Content Viewer
1he Interíace ·iewer allows relati·elv easv na·igation and inspection oí the entire contract íor an
imported \SDL. including all imported and included \SDL and XSD íiles and their contained tvpes.
deíinitions. etc.
1 . 4 . 1 I N T E R F A C E V I E W
59
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he na·igation tree to the leít shows contained elements in the contract. selecting a node will highlight
that element in its containing íile to the right. automaticallv switching tabs ií necessarv. Llements
reíerring to other elements in the contract are also double clickable and will íocus to the reíerenced
element in the tree as íollows:
Double-click on will focus on (if available)
Global Element its Complex Type
...........................................................................................................................................................................................
Message Part its Complex Type or Global Element
...........................................................................................................................................................................................
Operation input/output its Message
...........................................................................................................................................................................................
Binding Operation input/output its corresponding Operation input/output
...........................................................................................................................................................................................
Port its Binding Operation
1he ·iewer toolbar has the íollowing actions leít to right,
· Back - na·igates to the pre·iouslv selected node
· Iorward - na·igates to the next selected node aíter na·igating back..,
· Update Definition - updates the \SDL contract as described under Updating the Interíace
Deíinition
· Generate Documentation - Prompts to generate l1ML documentation íor this \SDL uses
\SDL Viewer bv 1omi Vanek, which will be opened in an external browser.
· Lxport WSDL - prompts to export the entire sadlv and all importe and included íiles to a local
íolder. Import or Includes are replaced with ·alid relati·e ones.
1he íollowing screenshot shows the ·iewer íor the PavPal API:
1 . 4 . 1 I N T E R F A C E V I E W
60
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: \S-I (ompliance
1 . 4 . 1 I N T E R F A C E V I E W
61
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.2
WS-I Compliance
......................................................................................................................................
WS-I Compliance
soapUI includes integrated support íor the \S-I organizations Basic Proíile ·alidation tools íor 2
situations:
1. Validating WSDL definitions - írom the Interíace Menu with the "(heck \SI (ompliance"
option. 1his will run the \S-I 1est 1ools and ·alidate the \SDL deíinition accordinglv.
2. Validating SOAP request/response messages - írom within the Request Lditors response popup
with the "(heck \SI (ompliance" option as described under Message Validation ,
In either case. vou íirst need to download either the ja·a or (4 ·ersion soapUI will use whiche·er is
a·ailable, oí the \S-I Interoperabilitv 1esting 1ools 1.1 írom the \S-I deli·erables page. Once
downloaded. unzip the íile into a local directorv and speciív the contained "wsi test tools" directorv in the
soapUI together with the desired settings:
Creating WS-I Reports
\hen running one oí the integrated ·alidations described abo·e. the corresponding \S-I Analvzer
coníiguration íile will be generated and the \S-I Analvzer will be in·oked in a separate process: a
progress dialog will be shown while the tool is running. Ií all goes well. vou will be presented with a \S-I
(ompliance Report in a separate desktop window. otherwise an error will be displaved.
1 . 4 . 2 W S - I C O M P L I A N C E
62
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
A generated report looks as íollows:
1he top toolbar contains a button íor exporting the report to an l1ML íile.
Also. a "(oníig" tab is a·ailable íor displaving the coníiguration íile used to in·oke the \S-I tools. íor
example:
Displaying the WS-I Tool Output
Selecting the "Show Log" option in the \SI Settings 1ab will displav ongoing output írom the
1 . 4 . 2 W S - I C O M P L I A N C E
63
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
command-line tools which can be useíul íor debugging purposes:
Next: Reíactoring \eb Ser·ice tests with \SDL Reíactoring
1 . 4 . 2 W S - I C O M P L I A N C E
64
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.3
WSDL Refactoring
......................................................................................................................................
WSDL Refactoring
\hen updating a \SDL. the underlving contract changes mav require changes to all messages related to
a certain modiíication. íor example ií an element has been renamed or mo·ed. Also. XPath expressions
in assertions. propertv transíers and expansions. etc. mav need to be updated to correctlv reíerence
updated elements.
1he \SDL Reíactoring íeature in soapUI Pro aims at greatlv easing this update process bv pro·iding a
wizard allowing vou to map old message elements to new ones. resulting in automaticallv updated
message content and xpath expressions. \ou alwavs ha·e the possibilitv to manuallv o·erride or discard
those changes created bv soapUI during the process. ensuring that the correct result comes out in the
end.
Getting Started with WSDL Refactoring
\hen vou ha·e a situation where the \SDL has updated. select the "Reíactor Interíace" option írom the
Interíace Popup menu. which will open the íollowing dialog:
Speciív the Deíinition URL íor the updated \SDL and ií vou want to create new requests and backup
copies íor all modiíied requests.
Refactor Operations
Selecting Next will load and analvze the new \SDL and start the reíactoring process bv prompting íor
how to map old operations to new ones ií required,
1 . 4 . 3 W S D L R E F A C T O R I N G
65
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Operations that are not automaticallv matched based on their names, are displaved as red: associate these
with their new counterparts ií a·ailable, bv either dragging them onto the new operation or bv selecting
both and pressing the "(onnect" button. Ií two operations ha·e been incorrectlv associated. select them
both and press the "Disconnect" button instead.
Message Refactoring
Press Next to mo·e on the message reíactoring:
1 . 4 . 3 W S D L R E F A C T O R I N G
66
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1his is the main reíactoring step. the window is laid out as íollows:
· 1he panel to the leít contains a íamiliar tree ·iew oí the updated interíace. each operation containing
nodes íor all corresponding requests and mockresponse in the project.
· 1he top right section contains two trees displaving the message structure oí the old schema deíinition
and the new one íor the currentlv selected operation in the tree to the leít. lere vou can map old
elements´attributes to new ones bv either dragging or selecting and connecting them manuallv with
the connect option.
· 1he bottom right section contains the old request to the leít, and the request as it would be updated
to the right, bv the current mappings in the top right section. Ií the updates are not in line with vour
requirements. select the "Ldit Manuallv" button and manuallv adjust the message Please note that
unselecting the Ldit Manuallv checkbox will lea·e the message in its last edited state without
attempting to make anv automatic updates,.
(hanging namespace. reordering elements and changing an element to an attribute or ·ice ·ersa are
reíactored automaticallv and can be re·iewed in the top section. Renaming elements and attributes can be
mapped manuallv in the top section. More complex structural changes are currentlv not handled. but each
request and response needs to be edited manuallv in the bottom section.
Red nodes in the left-hand tree indicates messages that could not be reíactored automaticallv. either
because the old schema could not be mapped directlv to the new schema. or because old messages did
not match their old schema. 1hese messages need to be edited manuallv.
Red nodes in the Old Schema tree indicate elements or attributes in the old schema that are missing in
the new schema. Please re·iew the requests or mockresponses and re·iew those ·alues.
1 . 4 . 3 W S D L R E F A C T O R I N G
67
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Blue nodes in the New Schema tree indicate elements or attributes in the new schema that did not exist
in the old schema. 1his is a help to íind schema changes.
1he Iilter checkbox can be selected to hide the nodes that were not changed and íocus on the changes.
Updating Test XPath
\hen all operations and their messages ha·e been resol·ed. mo·e íorward to the next step with the Next
button
1his step prompts vou to re·iew all XPath expressions in vour project to see ií thev ha·e been updated
correctlv. 1he tree to the leít shows all items in the project containing XPath-expressions assertions.
propertv transíers. etc.,. Selecting an XPath in the tree will show its old and new ·alues in the two panels
to the right. 1he New XPath expression can be modiíied manuallv ií desired
Ií the XPath could not be reíactored automaticallv because it was in·alid or because the schema changes
were too complex,. it will be red in the leít hand tree. and the New XPath text will be emptv. Please edit
the New XPath manuallv. Ií this íield is leít emptv. the XPath will be leít unmodiíied.
Select linish when readv and soapUI will process vour project as coníigured and update all messages and
XPath expressions accordinglv.
Next: \SDL Operations
1 . 4 . 3 W S D L R E F A C T O R I N G
68
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.4
WSDL Operations
......................................................................................................................................
WSDL Operations
\hen adding an interíace as described abo·e. each oí that interíaces operations is added as a node in the
na·igation tree. \e take the name íor these írom operation in the underlving Port1vpe. that is ií thev are
called CetCv.tover in the \SDL. that's what we call them.
1he íollowing actions are a·ailable írom the operation nodes' right-button menu:
· Add to MockService - prompts to create a soapUI MockOperation íor this operation in an existing
or new MockSer·ice.
· Add as MockResponse Step soapUI Pro onlv, - prompts to create a MockResponse Step this
operation in an existing or new 1est(ase.
· New Request - creates a new Request íor this operation írom its wsdl ´schema deíinition. soapUI
will prompt íor a name and ask ií optional schema elements should be created.
· Relabel - changes the label oí the operation in the na·igator. which can be helpíul ií there are se·eral
o·erloaded ·ersions oí the same operation in the Interíace.
· Online Help - Displavs this page in an external browser
Operation Details Tab
1he "Details" tab shown in the bottom-leít shows the íollowing ·alues when a Operation node is
selected in the na·igation tree
· Description : an arbitrarv description oí the operation. displaved as a tooltip o·er the operations
node in the Na·igator.
· SOAPAction read-onlv,: the SOAP Action speciíied íor the operation in its SOAP´l11P binding
· Operation read-onlv,: 1he name oí the operation in the underlving Port1vpe
· Style read-onlv,: Shows ií this is a Document or RP( operation
· 1ype read-onlv,: Shows \SDL operation tvpe
· Input read-onlv,: 1he explicit name oí the operations' input message mav be emptv,
· Output read-onlv,: 1he explicit name oí the operations' output message mav be emptv,
· Sends Attachments read-onlv,: Signals that the operation is deíined to send Mime Attachments
· Receives Attachments read-onlv,: Signals that the operation is deíined to recei·e Mime
Attachments
· WS-A Anonymous : indicates the ·alue oí \S Addressing Anonvmous element as speciíied in
\SDL Binding speciíication
Next: \orking with Requests
1 . 4 . 4 W S D L O P E R A T I O N S
69
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.5
Working with SOAP Requests
......................................................................................................................................
Working with Requests
An unlimited number oí requests can be added to an operation in soapUI. Lach request can ha·e its own
message content. endpoint. encoding. etc. Requests are mainlv managed through the request-editor
displaved when double clicking a request node in the na·igator described below,
Request Actions
1he íollowing actions are a·ailable írom the request nodes' right-button menu:
· Show Request Lditor - opens the Request Lditor described below
· Add to 1estCase - prompts to add the request to a 1est(ase. Ií no 1est(ase is a·ailable. soapUI will
prompt to create both a 1estSuite or 1est(ase ií required
· Add to MockService - prompts to add the requests' operation to a MockSer·ice. Ií a response is
a·ailable íor the request. it will be used as the deíault MockResponse.
· Add as MockResponse Step - prompts to create a MockResponse Step this request in an existing or
new 1est(ase. Ií a response is a·ailable íor the request. it will be used as the response content.
· Copy to 1estRequests (soapUI Pro only) - opens dialog íor copving´merging this request to
existing 1estRequests see below,
· Clone Request - prompts to clone this request. the cloned request will be added to the operation
and its request-editor will be opened
· Rename - prompts to rename the request in the na·igator
· Delete - prompts to remo·e the request írom its operation
· Online Help - Displavs this page in an external browser
Request Details Tab
1he "Details" tab shown in the bottom-leít shows the íollowing ·alues when a Request node is selected
in the na·igation tree General Properties
· Name : the name oí the request
· Description : an arbitrarv description oí the request. displaved as a tooltip o·er the requests node in
the Na·igator.
· Message Size : 1he number oí characters in the current request message including whitespace,.
· Lncoding : 1he encoding used bv the request
· Lndpoint : 1he endpoint íor the request
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
70
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Bind Address : 1he local IP Address to bind to when sending the request.
· WS-Addressing : enables´disables ws-addressing.
· Iollow Redirects : íollows l11P Redirect response messages
· Skip SOAP Action : : does not add SOAPAction header to request
Securitv´Authentication Properties o·erride anv deíaults set íor the endpoint,
· Username : 1he username to use ií the request requires authentication
· Password : 1he password to use ií the request requires authentication
· Domain : 1he domain to use ií the request requires N1LM authentication,
· WSS-Password 1ype : Selects the tvpe oí \S-Securitv username´password token to dvnamicallv
add to each outgoing request. 1he abo·e speciíied Username and Password ·alues will be used íor
the corresponding header ·alues
· WSS-1ime1oLive : Ií set. automaticallv inserts a \SS 1ime1oLi·e token in anv outgoing requests
using the speciíied 1ime1oLi·e in milliseconds,
· SSL Keystore : sets path to SSL kevstore íor request
Attachment-Related Properties
· Lnable M1OM/Inline : Lnable M1OM-based transíer and inlining oí binarv data in the request
see Attachments ,.
· Iorce M1OM : Alwavs use M1OM packaging íor requests. e·en ií there are no M1OM
attachments.
· Inline Response Attachments : the entire l11P response íor a request including MIML´XOP
attachments. etc.., will be shown in the response editor instead oí attachments being parsed and
·isible in the Response Attachments tab.
· Lxpand M1OM Attachments : recei·ed M1OM attachments will be inlined into the response
message editor. allowing correct ·iewing and ·alidation oí the actual message.
· Disable Multipart : 1ells soapUI not to pack attachments with the same tvpe into a multipart
attachment. see Multipart Attachments íor more details.
· Lncode Attachments : 1ells soapUI to automaticallv encode attachments that ha·e a corresponding
\SDL part with the xsd-tvpe set to either base6Binarv or hexBinarv.
· Lnable Inline Iiles : enables´disables inline íiles . see \orking with \S Attachments and Inline
liles
· Lntitize Properties : entitize propertv-expansion ·alues
Post-Processing Properties
· Strip Whitespaces : Strips outgoing requests oí anv unnecessarv whitespaces and XML comments.
required bv some ser·ers.
· Remove Lmpty Content : Remo·es emptv elements´attributes írom outgoing requests. 1his can be
useíul in Data Dri·e 1estRequests which contain elements´attributes that not alwavs contain data
and should be remo·ed in those cases.
· Prity Print : enables more readable text íormat
· Dump Iile : íile where response will be stored
· Max Size : maximum numbers oí bvtes to recei·e
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
71
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
The Request Editor
1he request editor is opened bv either double-clicking a request in the na·igator or bv selecting its Open
Request Lditor popup menu item. and displavs the current request and response messages together with
a toolbar and a number oí detail tabs as shown below in a coníigurable Lditor Lavout .
Verticallv on the leít side oí each editor are tabs íor each editor ·iew. 1he 'XML' source ·iew is alwavs
a·ailable. as is the 'Raw' source ·iew. soapUI Pro also adds the íollowing addition ·iews:
· An Outline Lditor íor both request and response messages.
· A lorm Lditor íor easier editing oí request messages.
· An O·er·iew View íor easier inspection oí response messages.
1he íollowing inspectors are a·ailable at the bottom oí each message editor:
· l11P leaders : shows the request´response l11P leader editor´·iewer
· Attachments : show the associated request´response Attachments editor
· SSL Inío Response onlv, : shows detailed response SSL Details íor the current response
· \S-A : shows \S-Addressing header properties
In soapUI Pro. the bottom right corner under the scrollbar, contains a button to show a panorama ·iew
oí the current editor ·iew. allowing easier na·igation around large´complex messages´·iews a·ailable in
all editor ·iews. see screenshot to the right,
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
72
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Editor Toolbar
1he request-editor toolbar has the íollowing actions írom leít to right,
· Submit - submits the request to the speciíied endpoint
· Add to 1estCase - prompts to add the request to a 1est(ase. same as the request-menu action
described abo·e
· Add as MockResponse Step soapUI Pro onlv, - prompts to create a MockResponse Step this
request in an existing or new 1est(ase as described abo·e.
· Add to MockService - prompts to add the requests operation to a MockSer·ice. same as the
request-menu action described abo·e
· Recreate Request - prompts to recreate the request xml írom the operations input message
deíinition. Also prompts ií anv ·alues in the current request should be kept in the recreated request
· Create Lmpty - prompts to create an emptv soap-request with no soap-bodv
· Clone Request - prompts to clone the request. same as the request-action described abo·e. \ou will
be prompted íor a name íor the new request and the new request will be placed aíter the cloned
request.
· Cancel Request - cancels an ongoing request disabled ií no request is running,
· Lndpoint Combo - a combo-box listing the endpoints a·ailable íor this requests operations'
interíace. 1he combo box also contains the íollowing options as shown in the image,:
· [edit current...] option íor changing the current new endpoint directlv
· [add new endpoint...] option íor adding a new endpoint directlv
· [delete current...] option íor deleting the current endpoint directlv
· 1ab Layout - toggles between the tab and split request editor lavouts as described below
· Lditor Orientation - changes the orientation oí the request´response editors between leít´right and
top´bottom
· Online Help - Displavs this page in an external browser
Editor Layouts
1he editor is a·ailable in 2 lavout modes which can be toggled with the "1ab Lavout" toolbar button top
right,:
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
73
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Aut
One important part oí the Request editor is the Aut Inspector at the bottom oí each message editor.
1his will let us use the \S-Securitv setting set in the \S-Securitv 1ab in the Project ·iewer.
HTTP Headers
1he l11P leaders Inspector at the bottom oí each message editor displavs the coníigured´recei·ed
l11P headers íor the corresponding request´response message. lor request message headers. buttons
íor adding´remo·ing l11P headers to be sent with the request are a·ailable írom a toolbar below the
table.
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
74
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
SSL Details
1he SSL Details inspector at the bottom oí the response editor displavs a list oí certiíicates that were
in·ol·ed in negotiating the current message exchange. the íollowing screenshot shows this iníormation
íor a deíault request to the PavPal API.
WS-A Properties
1he \S-A Inspector displavs properties used íor adding \S-A headers to a Request´MockResponse
according to \S Addressing speciíication
· Lnable \S-A Addressing
· Must understand indicates whether a header entrv is mandatorv or optional íor the recipient to
process.
· \S-A Version indicates ws addressing ·ersion to be used.
· Add deíault \S-A:Action indicates ií bv deíault generated action is to be added to request´mock
response.
· Action - speciíies the ·alue oí the Action propertv. Ií not speciíied. and 'Add deíault \S-A:Action is
checked' . deíault action írom \SDL will be generated and added. Although Action propertv is
mandatorv bv \S-A core speciíication bv checking pre·ious check box and lea·ing this emptv it is
possible íor action propertv to be leít unspeciíied íor testing purposes.
· Add deíault \S-A:1o indicates ií deíault 1o is to be added to request´mock response.
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
75
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· 1o - OP1IONAL element speciíies the ·alue oí the 1o propertv
· Replv1o - OP1IONAL element speciíies the ·alue oí the Replv1o propertv. Ií not speciíied. and
Anonvmous propertv is set to 'required'. either on Interíace or Operation le·el . deíault ·alue oí
'http:´´www.w3.org´2005´08´addressing´anonvmous' will be used Operation le·el deíinition has
prioritv ií not 'optional',.
· Replv1o Reíerence Parameters - expected to be added in XML not text íorm and will be included in
request exactlv as speciíied
· Generate MessageID - indicates ií messageId should be randomlv generated
· MessageID - OP1IONAL element speciíies the ·alue oí the MessageID propertv. Ií not speciíied.
and pre·ious check box is checked . random MessageID will be generated íor RequestResponse
operation.
· lrom - OP1IONAL element speciíies the ·alue oí the lrom propertv
· lault1o - OP1IONAL element speciíies the ·alue oí the lault1o propertv
· lault1o Reíerence Parameters - expected to be added in XML not text íorm and will be included in
request exactlv as speciíied
· Relates1o- OP1IONAL element speciíies the ·alue oí the Relates1o propertv
· Relationship1vpe- OP1IONAL element speciíies the ·alue oí the Relationship1vpe propertv
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
76
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
note that all settings support propertv-expansion,
XML Source Editor
1he request and response XML editors support svntax highlighting. undo or redo. copv and paste. etc.
soapUI Pro also adds a number oí additional editor ·iews to the deíault "XML": "Outline" and "lorm" .
together with a number oí Message Inspectors shown below the request and response message 1he
íollowing actions are a·ailable írom the request and response editor right-button menus:
· Validate - ·alidates the editors' content against its message deíinition as described below
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
77
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Iormat XML - prettv-prints the xml in the editor
· Add WSS-Username 1oken - prompts to add a \SS-Username SOAP-leader to the request
message using the username´password speciíied in the Request Details 1ab
· Add WS-1imestamp - prompts to add a \S-1imestamp SOAP-leader to the request message
· Outgoing WSS - enabled onlv when there are Outgoing \SS (oníigurations added and applies or
remo·es outgoing wss írom request.
· WS-A Headers - enabled onlv when \S Addressing is enabled íor the request and remo·es or adds
\S-A leaders írom the request as coníigured in the inspector
· Undo/Redo/Copy/Cut/Paste/Iind/Replace - standard editing íunctions
· Go 1o Line - prompts íor a line to mo·e to
· Show Line Numbers - toggles line-number ·isibilitv
· Save as - prompts to sa·e the editors content to a local íile
· Load from - prompts to load the editors content to a local íile
· Get data.. - a soapUI Pro speciíic popup that allows vou to select a propertv accessible írom the
request íor generating the corresponding propertv-expansion at the current caret-position.
Also. a number oí custom kevboard actions are a·ailable to make vour "e·ervdav-soapui-editing" easier:
· Alt-Lnter : submits the request to the speciíied endpoint
· Alt-X : cancels a running submit
· Alt-leít´right arrow : mo·es between element ·alues
· Shiít-1ab : mo·es íocus between request´response areas
Submitting requests
\hen submitting a request using either the submit toolbar button or the Alt-Lnter editor action. the
request message is sent to the selected endpoint using the speciíied encoding and local Bind Address.
Submittal is done in a background thread so anv number oí requests can be running simultaneouslv an
animated icon in the na·igator shows that thev are running,.
During submittal. the request´response editors are made read-onlv and all actions except the cancel
button in the toolbar are disabled. One can cancel an ongoing request either bv the "(ancel" toolbar
button or bv pressing Alt-X in one oí the editors. Ií vou choose to close the editor window while a
request is running. vou will be prompted ií vou íirst want to cancel the ongoing request. Depending on
the state oí the request. its thread mav actuallv continue in the background e·en though soapUI shows it
as canceled. but írom a usabilitv point-oí-·iew. vou should ne·er notice.
Once a response has been recei·ed. it will be displaved in the response area and a log message will be
displaved in the soapUI log ·iew and the request editors status bar showing the time taken and size oí the
recei·ed response. Ií vou choose to close the request editor without canceling an ongoing request. the
response will be shown in the response area when the request editor is made ·isible again.
A l11P Proxv can either be set bv using the http.proxyHost and http.proxyPort svstem
properties or through the soapUI Proxv Preíerences dialog. Ií both are a·ailable. the svstem properties
take precedence.
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
78
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Authentication
Ií the ser·ice requires authentication. soapUI will attempt to authenticate using the speciíied username.
password. or domain ·alues speciíied either at the endpoint le·el ·ia the Ser·ice Lndpoints or those
speciíied in the Request Details 1ab or a combination oí both,. (urrentlv supported authentication tvpes
are those supported bv lttp(lient. i.e. Basic. Digest and N1LM authentication. SSL should work ~not
tested!, ií vou use https urls and install JSSL accordinglv.
Ií one oí the \SS-Password 1vpe options or the \SS-1ime1oLi·e has been set in the Request Details
1ab. soapUI will automaticallv add the corresponding \S-Securitv headers to the outgoing message. as
can be seen in the l11P log:
Message Validation
\hen pressing Alt-V in the request or the response area. the contained message is ·alidated against the
operations message deíinition:
1. 1he message bodv is ·alidated against its schema deíinition
2. 1he SOAP en·elope and structure is ·alidated in accordance with the \SDL and SOAP schemas
3. Ií the message sends MIML attachments. their presence is ·alidated in the Attachments 1ab
Validation errors are shown in a list-box displaved under the editor. Double clicking an error will mo·e
the corresponding editor caret to the line oí the error ií possible,.
Ií the message is ·alid the error list is hidden and an Ok-message is displaved.
Validation is currentlv onlv supported íor literal-encoded messages both rpc and document,.
SOAP-encoded messages are vot supported.
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
79
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he response message editor has a
similar popup menu to the request-editor containing a "(heck \S-I (ompliance" option. Selecting this
option ií the \S-I ·alidation tools ha·e been coníigured correctlv, will ·alidate the current request or
response message as coníigured and displav a \S-I (ompliance report in a separate window as described
under \S-I Integrations .
Copy Requests
soapUI Pro includes this action to simpliív bulk updates oí 1estRequests with new content. 1he
displaved dialog is as íollows:
1he options are:
· Mode - the copv mode. see below
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
80
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· 1estRequests - the 1estRequests to copv or merge to
· Create Backups - creates disabled backup 1estRequest steps with existing request content
· Open Requests - opens a list oí modiíied 1estRequests íor manual post processing
\hen selecting ok. the existing request will be copied or merged as coníigured:
· Copy : O·erwrites the target 1estRequests,
· Update : Merges ·alues írom the source Request into the target 1estRequest without o·erwriting
· Keep Lxisting : O·erwrites the target 1estRequest aíter merging existing 1estRequest ·alues into
the source Request
Please note that the merging currentlv requires emptv elements to merge into. it will not merge at the
element le·el. onlv at the ·alue le·el
Next: lorm Lditor
1 . 4 . 5 W O R K I N G W I T H S O A P R E Q U E S T S
81
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.5.1
Form Editor
......................................................................................................................................
Auto Generated Form Editor in soapUI Pro
1he íorm editor attempts to dvnamicallv build a user íriendlv input íorm írom the underlving XML
Schema deíinition íor the current request message. 1he íollowing screenshot shows the íorm created íor
one oí the PavPal API calls:
1he toolbar contains buttons to Validate and (lear the current íorm. (lear will recreate an emptv
underlving request contain onlv required elements. Validating will show a clickable list oí errors below the
editor that can be used to mo·e íocus to the corresponding íield that caused the error:
1 . 4 . 5 . 1 F O R M E D I T O R
82
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Bv deíault. the editor creates íields íor all elements and attributes in the underlving schema íor those
structures that are a·ailable in the underlving message. which can both be useíul íor inspection purposes
but also annoving íor testing purposes. 1hereíore. the toolbar contains a "View 1vpe" combo which
oííers the íollowing options:
· All - will displav all íields deíault,
· Mandatory - will displav onlv mandatorv íields
· Data - will displav onlv íields that contain anv data. 1his can come in handv during testing when
preparing a request and wanting to hide remaining íields
· Mandatory and Data - will displav all íields containing data and those that are mandatorv
lor example the íollowing shows the abo·e request with the "Data" ·alue selected
1 . 4 . 5 . 1 F O R M E D I T O R
83
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1his setting will be remembered between editing sessions.
Data type Support
1he lorm Lditor uses ·alidating editors íor all nati·e XML Schema data tvpes and pro·ides popup
dialogs íor easv entrv oí dates. durations. etc.
1 . 4 . 5 . 1 F O R M E D I T O R
84
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he editors will discard ·alues not allowed bv the schema. ií it is still required to enter "in·alid" ·alues the
right-button menu íor these íields contains a "Set Value" action íor entering anv text into the íield:
Schema Support
1he soapUI Pro lorm Lditor supports most commons XML Schema constructs but mav ha·e trouble
displaving. editing. or ·alidating more complex schemas. 1hereíore. it is ad·isable to initiallv double
check the XML generated bv the editor in one oí the other editors. Since it is our ambition to íullv
support XML Schema. please let us know ií vou ha·e schema constructs that are gi·ing vou or the editor
trouble...
1he íollowing constructs should currentlv work íine:
· Standard elements: ií maxOccurs is more than 1 a listbox with add.edit. or remo·e buttons will be
shown
· Lnumerations or Booleans will be displaved as combo-boxes
· Binarv íields are linked to the attachment support. a "Browse..." button will be displaved next to the
input íield allowing browsing and automatic associated oí a íile with a binarv íield
· Attributes are displaved with a ( beíore the íield name
· Standard Sequence. (hoice and All complex tvpes - (hoice will be displaved with a combo-box in the
1 . 4 . 5 . 1 F O R M E D I T O R
85
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
section header írom which the desired choice should be selected.
· Multiple occurrences oí an complex element will be displaved as a list with add or remo·e buttons in
the top right. Lach entrv in the list will be displaved with a list index next to the section name. íor
example in the last screenshot abo·e. the MassPavItem section can contain 1-250 MassPavItems.
currentlv it contains onlv one seen with an index oí |0|,.
· Abstract1vpes will displav a drop-down oí global deri·ed tvpes írom the schema. allowing selection
oí which deri·ed tvpe to use
A '' aíter a íield name denotes that it is required. All íields can show a small green question-mark which
will show documentation iníormation írom the associated tvpe in a tooltip.
Next: O·er·iew View íor Understandable SOAP Viewing
1 . 4 . 5 . 1 F O R M E D I T O R
86
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.5.2
Overview View
......................................................................................................................................
Overview View
soapUI Pro includes an O·er·iew View íor ·isualizing response or mock-request messages in a
íorm-editor íashion.
Lach section contains links íar right, to the corresponding nodes in the XML or Outline editor. 1ext
·alues ha·e a right-button menu íor copving the ·alue to the clipboard and opening URLs in an external
browser: URL's are displaved in blue and are directlv clickable íor opening in an external browser.
Next: Structured Outline Lditor íor \eb Ser·ices
1 . 4 . 5 . 2 O V E R V I E W V I E W
87
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.5.3
Outline Editor
......................................................................................................................................
soapUI Pro Outline Editor
1he soapUI Pro Outline Lditor is a·ailable íor all request and response messages and shows a tree ·iew
oí the current message content. 1he leít column oí the editor shows the tree structure and the center
column shows editable node ·alues. Graved node-·alues are not editable due to una·ailabilitv or schema
restrictions. Node ·alues in the center column are editable bv selecting or editing as usual. 1he right
column shows the schema tvpe íor the corresponding node ií a·ailable. 1his column can be hidden with
the toggle button in the toolbar.
Ií the underlving schema deíinition íor a speciíic node has documentation annotations. these will be
displaved in the tooltip as shown in the screen-shot below.
1he toolbar has the íollowing actions leít to right,:
· (ollapses all child nodes ií possible AL1-SlIl1-(,
· Lxpands all child nodes ií possible AL1-SlIl1-L,
· (ollapses all sibling nodes ií possible AL1-(1RL-(,
1 . 4 . 5 . 3 O U T L I N E E D I T O R
88
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Lxpands all sibling nodes ií possible AL1-(1RL-L,
· Mo·es down to the next sibling node. skipping anv child nodes AL1-DO\N,
· Mo·es up one sibling. skipping anv intermediate child nodes AL1-UP,
· Mo·es to the current nodes parent node AL1-LLl1,
· Mo·es to and expands the current nodes íirst child node ií a·ailable AL1-RIGl1,
· 1oggle 1vpe-(olumn
· lelp - displavs this page
1he íollowing additional kevboard commands are a·ailable when the Outline-1able has íocus:
· DO\N - mo·es down one row and expands new row ií possible
· UP - mo·es up one row
· AL1-( - collapses current node ií possible i.e. hides all child nodes,
· AL1-L - expands current node ií possible i.e. shows all child nodes,
A number oí right-button actions are a·ailable íor creation oí XPath assertions and
Propertv-1ransíers´Lxpansion when editing Mock Response and 1est Request steps.
Next: Message Inspectors
1 . 4 . 5 . 3 O U T L I N E E D I T O R
89
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.5.4
Pro Inspectors
......................................................................................................................................
soapUI Pro Message Inspectors
soapUI Pro adds a number oí \SDL (ontext sensiti·e message inspectors that are a·ailable íor both the
standard XML Source editor and the Outline Lditor displaving context sensiti·e details íor the currentlv
selected content element.
1he íollowing inspectors are currentlv a·ailable:
· XSD - displavs XML Schema iníormation íor the selected node
· 1able - displavs a tabular ·iew oí the current nodes' siblings and children
· XML - displavs XML íragment and XPath iníormation íor the current node
· Doc - displavs schema documentation annotations ií a·ailable
· Coverage - displavs Message (o·erage iníormation íor the selected node
Lach tab is enabled or disabled ií corresponding content is a·ailable.
Coverage Inspector
\hen enabled ·ia its toolbar. the co·erage inspector continuouslv displavs Message (o·erage
iníormation íor the current request or response message.
1 . 4 . 5 . 4 P R O I N S P E C T O R S
90
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
In the image abo·e. the inspector shows red íor the search string element since it contains a deíault ·alue
'·',. checking the "Deíault Values" checkbox in the toolbar would allow this and show the entire message
as co·ered.
XSD/XML Schema Inspector
1he XML Schema Inspector displavs the current nodes corresponding XML Schema deíinition ií
possible. lor simple tvpes íor example in a sequence,. the containing complex tvpe is displaved instead.
1he tab title will contain the name oí the current tvpe ií a·ailable. 1he íollowing screenshot shows
schema iníormation íor the selected Requester(redentials SOAP leader in a request to the PavPal API
Note that the inspector requires the message to complv with the currentlv imported \SDL íile. íor
example ií a recei·ed response has an updated namespace. the inspector will not be able to displav
schema iníormation.
1 . 4 . 5 . 4 P R O I N S P E C T O R S
91
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Table Layout Inspector
1he 1able Inspector builds a tabular ·iew oí the current selected node and its siblings and children:
· siblings correspond to rows in the table
· children correspond to columns. lor each sibling the same children that are a·ailable íor the selected
node are displaved
Once selected. it is possible to na·igate "both wavs". i.e. clicking in a new row in the table mo·es íocus in
the current editor to the corresponding node. 1he tab title displavs the currentlv number oí a·ailable
rows.
1he íollowing screenshot shows a tabular ·iew oí the items íound in a Amazon search result:
XML - XML Fragment/XPath Inspector
1he XML lragment´XPath inspector shows the XML íragment íor the currentlv selected node. which
can be useíul when using the Outline Lditor to na·igate a message. It also displavs the currentlv selected
nodes XPath expression which can be selected and copied to the clipboard with (trl-(. 1he íollowing
screenshot shows an XML íragment íor a node in íound in a Amazon search result:
1 . 4 . 5 . 4 P R O I N S P E C T O R S
92
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Doc - XML Schema Documentation Inspector
1he Doc inspector displavs anv schema annotations íor the currentlv selected tvpe. 1hese are also
a·ailable as tooltips in the Outline Lditor but can be useíul in the Source Lditor as shown in the
íollowing screenshot íor a PavPal API request:
Next: \orking with \eb Ser·ice Attachments and Inline liles
1 . 4 . 5 . 4 P R O I N S P E C T O R S
93
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.4.5.5
Attachments/Inline Files
......................................................................................................................................
Working with WS Attachments and Inline Files
soapUI supports the íollowing technologies íor working with íiles and attachments:
· M1OM - a technologv íor optimized transíer oí binarv data in SOAP Messages
· SOAP with Attachments in accordance with Attachments Proíile - a MIML-based attachment
mechanism íor the SOAP´l11P binding
· Inline íiles íor binarv content - soapUI speciíic íunctionalitv íor simpliíving handling oí binarv
message content
Since the industrv. íor now. seems to be mo·ing towards M1OM. we currentlv ha·e no plans íor
supporting anv other attachment technologv. íor example DIML.
Both M1OM and Inlining oí íiles require internal processing and can be disabled íor better períormance
in the \eb Ser·ice Request Details 1ab . Also. when disabling this íeature. soapUI will no longer be
required to load the \SDL Deíinition either cached or remote, beíore sending a request.
The Attachments Tab
1he request and response editors contain tabs íor adding or accessing attachments íor the current request
or response messages. lor request messages. this tab contains a table oí íiles that ha·e been attached to
the current request. lor the response. the table contains attachments in the response. 1he tabs are alwavs
a·ailable since thev can alwavs be used íor both M1OM attachments and lile Inlining as described below
1 . 4 . 5 . 5 A T T A C H M E N T S / I N L I N E F I L E S
94
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he attachment-table contains the íollowing columns:
· Name - 1he íilename oí the attachment. support propertv-expansion and is relati·e to ResourceRoot
· Content-1ype - 1he MIML content-tvpe oí the attachment
· Size read-onlv, - 1he size oí the attached íile
· Part - 1he part this attachment should be associated with see below,
· 1ype read-onlv, - 1he tvpe oí attachment depends on the attachments Part. see below,
· ContentID - Allows o·erriding oí the content ID taken írom the MIML part deíinition in the
corresponding \SDL
· Cached - Shows ií the attachment is cached in the project íile
Double-clicking an attachment in either message will attempt to sa·e the attachment to a temporarv íile
unless it is relati·e as described below, and open that íile in the svstems \eb Browser.
Attaching files to a Web Service Test
A íile can be attached to a request message either bv dragging it írom the íile-svstem into the request
attachments table or bv selecting the "Add lile" button which will open a íile-selection dialog. \hen
adding a íile. soapUI will prompt ií the íile should be cached bv soapUI or added as a íile reíerence:
· (aching the attachment will result in soapUI creating a local copv oí the attachment in the
attachment íolder coníigured in the soapUI Preíerences dialog see more below,
· Not caching the attachment will result in soapUI storing onlv the absolute íile path to the selected íile
in the project
Once attached. a íile must be assigned to a corresponding message part in the tables Part column:
· Ií the operation is deíined to use MIML attachments in its \SDL. the dropdown displaved in the
Part column will contain all deíined MIML parts. Just select which part the attachment should be
assigned to.
· Ií the request message contains SOAP with Attachments swaReí elements containing a "cid:XXX"
·alue. that XXX ·alue will be a·ailable in the part dropdown allowing association oí swaReís with
attached íiles.
· Ií the request message contains binarv base64 or hex, elements which contain a "cid:XXX" ·alue.
that XXX ·alue will be a·ailable in the part dropdown allowing association oí binarv elements with
attached íiles.
all´anv oí these mav be possible depending on message deíinition and content,
Selecting an attachments part will also update the attachments tvpe column. which will displav one oí
MIML íor a MIML attachment,. XOP íor a M1OM attachment,. (ON1LN1 íor an inline íile
attachment,. S\ARLl íor a swaReí attachment,. UNKNO\N íor unassigned attachments,.
MIME Attachments for Web Servie Testing
MIML attachments ha·e been deíined in the operations \SDL-deíined as described in the SOAP with
Attachments speciíication. \hen adding a íile it must be associated with its corresponding MIML Part as
described abo·e. lor example. ií the request operations' binding deíines the íollowing:
1 . 4 . 5 . 5 A T T A C H M E N T S / I N L I N E F I L E S
95
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
<wsdl:definitions xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"
...
<wsdl:operation name="SendClaim">
<soapbind:operation soapAction="http://example.com/soapaction"/>
<wsdl:input>
<mime:multipartRelated>
<mime:part>
<soapbind:body use="literal"
parts="ClaimDetail"
namespace="http://example.com/mimetypes"/>
</mime:part>
<mime:part>
<mime:content part="ClaimPhoto"
type="image/jpeg"/>
</mime:part>
</mime:multipartRelated>
</wsdl:input>
<wsdl:output>
<soapbind:body use="literal"
namespace="http://example.com/mimetypes"/>
</wsdl:output>
</wsdl:operation>
1his would result in the íollowing option in the Part combo-box:
swaRef Attachments
1he \S-I Attachments Proíile deíines a special swaRef data tvpe which can be used in a schema íor
designating attached binarv content. In soapUI. elements oí the swaReí tvpe should contain a ·alue in the
íorm oí cid:somename. which will result in "somename" being a·ailable in the attachment part
dropdown. lor example. ií the request operations' schema deíines the íollowing:
<wsdl:definitions xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"
...
<wsdl:types>
...
<xsd:element name="ClaimForm" type="ref:swaRef"/>
and the corresponding message would contain íor example:
<ClaimForm>cid:claimForm</ClaimForm>
1 . 4 . 5 . 5 A T T A C H M E N T S / I N L I N E F I L E S
96
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
this would result in the íollowing option in the Part combo box:
MTOM Attachments for Web Service Testing
1he M1OM speciíication describes optimized transport oí binarv data in SOAP-messages. 1he
corresponding data-tvpe used íor the binarv data message element should be one oí the XMIML data
tvpes soapUI 2.5 remo·es this requirement all together: all element content will checked íor and M1OM
encoded ií M1OM is enabled and there is an attachment reíerence as described below,. lor example ií
the request operations' schema deíines the íollowing:
<wsdl:definitions xmlns:xmime="http://www.w3.org/2005/05/xmlmime
...
<wsdl:types>
...
<xsd:element name="ClaimImage" type="xmime:base64Binary"/>
and the corresponding message would contain íor example:
<ClaimImage xm:contentType="image/gif">cid:claimImage</ClaimImage>
this would result in the íollowing option in the Part combo-box:
Since not all ser·ers support M1OM. vou can disable this íeature in the Request Details 1ab which will
result in the íile-data being inlined in the outgoing message in the same wav as described íor Inline liles
below. \ou can also íorce the use oí M1OM e·en ií there are is no binarv content in the request using
the "lorce M1OM" request propertv.
Anonymous Attachments
Sometimes vou mav want´need to attach íiles although this is not speciíied in the \SDL. íor this soapUI
allows "anonvmous" attachments bv selecting the "·anvonvmous·" part írom the part dropdown. lor
these vou will also need to set a content id in the (ontentID column ií required.
1 . 4 . 5 . 5 A T T A C H M E N T S / I N L I N E F I L E S
97
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Inline files
soapUI also has the option oí "inlining" binarv íiles into request messages when thev are sent: ií a
message contains base64Binarv or hexBinarv data elements. these can be "íilled" using an attached íile in
2 wavs:
1. Bv speciíving a ·alue oí cid:somename and associating an attached íile with the "somename" part
in the same wav as in the swaReí´M1OM examples abo·e
2. Bv speciíving the ·alue file:filepath where íile path points to a local íile
In both cases. the associated íile will be inlined into the message with either base64 or hex encoding. lor
example ií the request operations' schema deíines the íollowing:
<wsdl:definitions xmlns:xmime="http://www.w3.org/2005/05/xmlmime
...
<wsdl:types>
...
<xsd:element name="ClaimData" type="xsd:hexBinary"/>
and the corresponding message would contain íor example:
<ClaimData>file:c:\data\mydata.zip</ClaimData>
1he c:`data`mvdata.zip íile would be inlined into the outgoing message using hex encoding.
Attachment Caching
\hen adding an attachment as described abo·e. soapUI gi·es an option to cache the attachment locallv.
Ií selected. the íile will be sa·ed in the soapUI project íile compressed,. otherwise the project íile will
keep an absolute path reíerence to the selected íile.
Multipart Attachments
lor anonvmous. MIML. swaReí and M1OM attachments it is possible to associate multiple íiles with the
same attachment part. 1his will result in soapUI íirst building a MIML Multipart message containing the
associated íiles and then attaching that multipart-message to the corresponding part deíinition using the
"multipart´mixed" content-tvpe. a íeature that can be turned oíí in the Requests Details tab "Lnable
Multiparts",. Ií vou need to set the (ontentID íor both the multipart attachment and the contained
attachments. set the íirst attachments (ontentID to "·attachment contentid· ·multipart contentid·".
i.e. a space-separated string where the íirst token is the id oí the attachment inside the multipart and the
second token is the id oí the multipart attachment itselí.
Response Attachments
1he response attachments table lists all attachment a·ailable in the response with their corresponding
name. content-tvpe. size. etc. Double-click an attachment to ·iew it with the local web-browser.
1 . 4 . 5 . 5 A T T A C H M E N T S / I N L I N E F I L E S
98
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: RLS1 Ser·ices
1 . 4 . 5 . 5 A T T A C H M E N T S / I N L I N E F I L E S
99
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.5
REST Services
......................................................................................................................................
REST Services in soapUI
soapUI 2.5 introduces extensi·e possibilities to in·oke and test RLS1´l11P ser·ices. either starting
írom a \ADL deíinition or just plain URLs. 1he RLS1´l11P support is di·ided into two parts:
· A new RLS1 Ser·ice ´ Resource ´ Request model in the Na·igator with corresponding editor
windows´popups´etc
· RLS1-speciíic 1estSteps íor integrating RLS1 testing with existing test-íunctionalitv
Mocking oí RLS1 ser·ices is currentlv onlv supported ·ia the possibilitv to speciív a document root íor
ser·ing static content. an upcoming release will ha·e íull RLS1 Ser·ice mocking íunctionalitv.
The REST Model
1he model íor RLS1 Ser·ices in soapUI is closelv modeled aíter the \ADL model but does not
explicitelv require a \ADL deíinition. Ií a RLS1 Ser·ices is deíined "manuallv" without a \ADL,. the
corresponding \ADL will be automaticallv generated and can be used íor ·alidation. code-generation.
etc.
RLS1 Ser·ices in soapUI consist oí the íollowing kev items:
· Services - corresponds to Interíaces íor \SDL. in a \ADL this corresponds to the root application
element. A Ser·ice contains an arbitrarv number oí heirarchicallv organized resources.
· Resources - deíines an addressable URI, item that can be parameterized using a number oí
parameter mechanisms. Resources are created´modiíied´deleted using standard l11P methods
PU1.POS1.GL1.etc, and can be made a·ailable in anv number oí representations ie states,. íor
example XML. JSON. PDl. etc. Also. resource can contain child resources which will inherit
parameter and path iníormation írom their parents,.
· Requests - A resource in \ADL´RLS1 is accessed through a number oí Methods. which in soapUI
are modelled as requests. A request is deíined bv it's l11P method. leaders and parameters. 1he
response is usuallv a representation oí the in·oked resource.
· Parameters - can be deíined on both the Resource and Request le·el. see more below.
· Representations - are used to deíine the content oí a request or response. see more below.
A soapUI project can contain anv number oí both RLS1 and \SDL ser·ices. allowing íor integrated
testing oí corresponding ser·ices.
WADL Support
soapUI supports \ADL in two wavs:
1 . 5 R E S T S E R V I C E S
100
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1. \hen deíining a new RLS1 Ser·ice one can do so írom a \ADL íile´URL. which will import all
deíined resources and methods as requests,. Associated XML Schemas are also imported and used
íor ·alidations and íorm-generation in soapUI Pro
2. \hen deíining a new RLS1 Ser·ice without a \ADL bv "manuallv" speciíving endpoints. paths.
parameters. etc soapUI automaticallv generates a \ADL írom these coníigured items.
In either case. the \ADL can be used íor code and documentation generation írom the \ADL (ontent
tab in the \ADL Ser·ice window see below,. Also. deíined representations will be used to ·alidate
response messages when adding SchemaAssertions to RLS1 1estRequest steps.
Creating REST Services
RLS1 Ser·ices can be created in se·eral wavs.
· lrom a \ADL:
· Bv speciíving a \ADL íile or URL in the New Project wizard
· Bv selecting the "Add \ADL" popup menu option írom the Project popup
· Manuallv:
· Bv selecting the "Add RLS1 Ser·ice" option in the New Project \izard
· Via the "Add RLS1 Ser·ice" option írom Project Popup
\hen speciíving a \ADL. soapUI will read the \ADL and create the corresponding model items in the
project. \hen creating the ser·ice manuallv. the íollowing dialog will be shown:
1he íollowing options are a·ailable:
· Service Name required, : an arbitrarv name íor the ser·ice
1 . 5 R E S T S E R V I C E S
101
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Service Lndpoint : an initial endpoint íor the ser·ice.
· Lxtract Resource/Params : will open a dialog íor deíining an initial Resource and its parameters
írom the speciíied endpoint.
· Create Resource : ií no endpoint has been speciíied or "Lxtract..." has not been selected. this option
will open a dialog to create an initial Resource.
1he resource-related options are co·ered in more detail in Resources .
Service Properties and Action
Once created. the RLS1 Ser·ice has the íollowing properties in the bottom leít:
Right-click a RLS1 Ser·ice in the na·igator opens a popup with the íollowing actions:
· Show Service Viewer - Opens the Ser·ice Viewer described below
· Generate 1estSuite - Opens a dialog íor generating a 1estSuite íor the ser·ice see below ,
· Create Documentation - Prompts to generate l1ML documentation íor the RLS1 Ser·ice which
will be opened in an external browser
· WADL2Java - Prompts to run the \adl2Ja·a tool íor generating ja·a classes íor the ser·ices \ADL
see below,
· Lxport WADL - Prompts to export the \ADL and included schemas to the íile svstem
· New Resource - Prompts to create a new Resource in this ser·ice
· Delete - Prompts to delete this ser·ice
· Online Help - Opens this page in an external browser
REST Service Viewer
Double-clicking a RLS1 Ser·ice opens the RLS1 Ser·ice Viewer which is basicallv laved out as the
corresponding \SDL Interíace ·iewer:
· An "O·er·iew" tab showing basic iníormation about the \ADL
· A "Ser·ice Lndpoints" tab allowing íor management oí ser·ice endpoints and deíault authentication
settings.
· A "\ADL (ontent" tab displaving the \ADL and its reíerences XML-Schemas.
1 . 5 R E S T S E R V I C E S
102
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he toolbar íor this tab contains the íollowing actions leít to right,:
· Back - na·igates back in the content tree
· Iorward - na·igates íorward in the content tree
· Generate Documentation - prompts to generate l1ML documentation íor this \ADL
· Lxport WADL - prompts to export the \ADL and reíerenced schemas to a local íolder
· Recreate WADL not shown in screenshot, - íor generated \ADLs. regenerates the \ADL írom
the deíined RLS1 artiíacts.
Generate TestSuite
1he "Generate 1estSuite" option on the RLS1 Ser·ice popup opens the íollowing dialog:
1 . 5 R E S T S E R V I C E S
103
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he options a·ailable are:
· 1estSuite : target 1estSuite or option to create a new one
· Style : how to generate 1est(ases
· Resources : a "ílattened" list oí all resources in the Ser·ice
· Generate Load1est : ií a deíault Load1est is to be created íor each generated 1est(ase
Pressing OK will generate one RLS1 RequestStep íor each selected Resource. either all in one 1est(ase
or in one 1est(ase íor each.
WADL2Java Integration
soapUI integrates with the wadl2Ja·a tool included in the \ADL toolkit allowing one to generate ja·a
code írom both imported and generated \ADLs. Selecting the \ADL2Ja·a option on the RLS1 Ser·ice
popup opens the íollowing dialog:
1 . 5 R E S T S E R V I C E S
104
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he options in the dialog correspond to those íor the tool. once the path to wadl2ja·a has been set in the
global tool integration settings and the dialog has been coníigured as desired. pressing OK will launch the
tool to generate the corresponding Ja·a classes:
1 . 5 R E S T S E R V I C E S
105
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: RLS1 Parameters and Representations
1 . 5 R E S T S E R V I C E S
106
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.5.1
Parameters/Representations
......................................................................................................................................
REST Parameters and Representations
Parameters and Representations a kev concepts in a RLS1-stvle ser·ice: Parameters íor parameterizing a
resource and its access methods. Representations íor deíining how a Resource can be retrei·ed and
updated.
REST Parameters
Parameters can be deíined on both resource´child-resource and request le·el and are managed ·ia a
parameters table in the corresponding Resource´Request editors:
1he toolbar at the top oí the table has the íollowing actions: leít to right,
· Add - adds a new parameter
· Delete - prompts to delete the selected parameter
· Clear - clears all current parameter ·alues
· Move Down - mo·es the selected parameter down one row in the table
· Move Up - mo·es the selected parameter up one row in the table
· Update from URL - prompts íor an endpoint and adds´extracts corresponding parameters
Depending on a parameters Stvle in the abo·e table. its ·alue will be added to an outgoing request in
1 . 5 . 1 P A R A M E T E R S / R E P R E S E N T A T I O N S
107
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
diííerent wavs:
· QULRY : added to the querv string oí the target URL upon submitting
· HLADLR : added as an l11P leader to the outgoing request
· 1LMPLA1L : replaces the corresponding ¦·parameter name·} placeholder in the URL path upon
submitting
· MA1RIX : appends corresponding ":·parameter-name·:·parameter-·alue·" pairs to the URL path
beíore the querv string, on submitting. Ií the parameter is deíined as a Boolean. onlv the parameter
name is added when its ·alue is set to "true".
lurthermore. each parameter has a number oí detailed settings that can be accessed ·ia the "Details" tab
below the parameter table:
1he settings are as íollows:
· Required : ií the parameter is required to ha·e a ·alue
· Default : the deíault ·alue to use
· 1ype : the XML Schema 1vpe oí the parameter ·alue
· Options : a list oí possible parameter ·alues
· Description : a descripti·e text íor the parameter
· Disable Lncoding : disables URL-Lncoding oí the parameter ·alue when it is sent
1hese settings mainlv aííect two beha·iours in soapUI:
1. 1he generated \ADL which contains all but the last setting
2. 1he input íield generated in the soapUI Pro lorm Lditor íor the parameter:
1 . 5 . 1 P A R A M E T E R S / R E P R E S E N T A T I O N S
108
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
As vou can see abo·e the generated íorm contains drop-downs. tvpe-iníormation. etc as coníigured íor
each parameter.
REST Representations
A RLS1 request can both send or recei·e an arbitrarv number oí representations. In requests these
correspond to the content oí the message bodv PU1 or POS1 messages,. in responses these correspond
to the actual content oí the response. \hich actual representation returned oí course depends on the
actual resource implementation: írom a strict l11P-point-oí-·iew. the l11P Accept-Lncoding header
should be set in the request to let the resource "know" how it should return itselí. A more common
alternati·e is to ha·e parameter in the request that speciíied the desired representation as the "output"
parameter in the parameters table abo·e,.
soapUI ·isualizes request and response representations with corresponding inspectors at the bottom oí
the request´response editors:
Ií the underlving resource has been imported írom a \ADL. this table will contain the representations
deíined therein. otherwise it will be emptv. 1he columns are:
1 . 5 . 1 P A R A M E T E R S / R E P R E S E N T A T I O N S
109
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· 1ype : the tvpe oí representation: íor requests this will alwavs be RLOULS1. íor responses this can
be either RLSPONSL or lAUL1.
· Media-1ype : the media1vpe oí the representation
· Status Codes : íor response representation tvpes onlv. this is a space-separated list oí l11P Status
codes that together with the media tvpe identiív the representation.
· QName : an optional OName corresponding to a global element in one oí the XML Schemas in an
imported \ADL
Using the add´delete buttons in the toolbar allows one can add´remo·e representations as desired to be
used íor ·alidation and \ADL generation,. Selecting the Auto-(reate option will make soapUI
automaticallv create representations íor each incoming response and outgoing request.
Next: RLS1 Resources
1 . 5 . 1 P A R A M E T E R S / R E P R E S E N T A T I O N S
110
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.5.2
Resources
......................................................................................................................................
REST Resources
As described in the RLS1 Ser·ices O·er·iew . Resources are a·ailable as child items to a RLS1 Ser·ice
and contain either child resources or requests. Resources are created either when initiallv creating the
RLS1 Ser·ice or bv selecting the "New Resource" option írom the Ser·ice´Resource popup. Lither wav.
the íollowing dialog will be displaved:
1he dialog has the íollowing options:
· Resource Name : the name oí the resource
· Resource Path´Lndpoint : a path or complete endpoint íor the resource
1 . 5 . 2 R E S O U R C E S
111
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Lxtract Params : select this option to extract parameters´path iníormation írom the speciíied
endpoint´path.
· Parameters : a table containing extracted or manuallv added parameters.
· (reate Request : option to create a deíault request íor the resource
1he Lxtract Params button will parse the speciíied endpoint and trv to extract querv. matrix and template
parameters írom it. Also a hostname will be remo·ed and a path components corresponding to the RLS1
Ser·ices Base Path and containing Resources' path will be remo·ed. lor example speciíving
http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Madonna&output=xml
and pressing the Lxtract button will result in
As vou can see. the host has been remo·ed and querv parameters ha·e been extracted.
Properties and Actions
1he íollowing properties are a·ailable at the bottom leít íor a RLS1 Resource:
· Name : the name oí the resource
· Description : a short description
· Path : the path oí the resource relati·e to parent resource´ser·ice
Right-clicking a resource shows a popup with the íollowing actions:
· Show Resource Viewer - opens the Resource Viewer see below,
· New Request - prompts to create a new Request íor this Resource
· New (hild Resource - prompts to create a new child Resource to this Resource using the abo·e
described dialog
1 . 5 . 2 R E S O U R C E S
112
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· (lone Resource - prompts to clone this Resource including all Requests and children
· Rename - prompts to rename the Resource
· Delete - prompts to delete the Resource
· Online lelp - shows this page in a browser
REST Resource Viewer
1he RLS1 Resource View is as íollows:
1he toolbar at the top contains an action to create a new request íor this Resource together with a text
íield to edit the path oí the Resource. 1he "Resource Parameters" tab contains all parameters íor this
resource as described in Parameters and Representations
Next: RLS1 Requests
1 . 5 . 2 R E S O U R C E S
113
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.5.3
Requests
......................................................................................................................................
REST Requests in soapUI
A RLS1 Request in soapUI correspond roughlv to a Method in \ADL: it deíines an l11P call to the
containing Resource with settings íor l11P Method. Parameters. Message (ontent. Attachments.
Representations. etc. Requests are created either directlv when creating Resources ·ia the "(reate
Request" option in the "New Resource" dialog. or alternati·elv írom the "New Request" Resource popup
which prompts íor an initial name. l11P Method and ií to open the request editor:
soapUI has built in support íor ·isualizing both JSON and XML responses. and also internallv con·erts
l1ML and JSON responses to XML so thev can be used in íunctional tests together with other related
íeatures propertv-transíers. xpath assertions. etc,.
Properties and Actions
A RLS1 Request has the íollowing properties at the bottom leít when selected in the Na·igator:
· Name - the name oí the Request
· Description - a description íor the Request
· Method - the l11P Method to use
1 . 5 . 3 R E Q U E S T S
114
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Lncoding - the encoding íor the message bodv ií PU1 or POS1,
· Lndpoint - the target endpoint íor the request
· Bind Address - the local ip-address to bind to when sending the request
· Iollow Redirects - option to íollow l11P Redirect response returned bv the target ser·er
· Username - Username to use in l11P Authentication challenges
· Password - Password to use in l11P Authentication challenges
· Domain - Domain to use in l11P Authentication challenges
· SSL Keystore - Alternati·e client kevstore to use. must be deíined in project \SS certiíicates tab
· Strip Whitespaces - Option to strip outgoing XML message content oí whitespace
· Remove Lmpty Content- Option to remo·e emptv elements írom outgoing message content
· Lntitize Properties - Lntitize propertv ·alues expanded in outgoing message content
· Pretty Print - Prettv print response XML
· Dump Iile - Local íile to which the response should be written
1he íollowing actions are a·ailable írom the RLS1 Request popup:
· Show Request Lditor - opens request editor described below
· Add to 1estCase - prompts to add this RLS1 Request to a 1est(ase as a RLS1 RequestStep
· Clone Request - prompts to clone the Request
· Rename - prompts to rename the Request
· Delete - prompts to delete the Request
· Online Help - shows this page in a browser
REST Request Editor
1he RLS1 Request editor is opened bv double-clicking a RLS1 Request or selecting the corresponding
popup menu item:
1 . 5 . 3 R E Q U E S T S
115
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he editor shares much oí its concepts with the \SDL Request editor:
· Request´Response areas to the leít and right with corresponding editors ·ertical tabs, and inspectors
tabs at the bottom oí the editors,.
· A top toolbar íor submitting and coníiguring the request endpoint
Manv oí the inspectors are the same as íor \SDL Requests and will not be co·ered here in anv detail.
1he top toolbar has two le·els oí which the second contains the íollowing leít-to-right options:
· Method - a drop-down selecting the l11P Method to use. Ií POS1 or PU1 are selected. a
corresponding Message (ontent editor area is shown below the Parameters table in the root Request
tab see below,.
· Accept - a drop-down íor selecting the desired accept-encoding. 1his will be pre-populated with the
media1vpes deíined bv all response representations íor the request
· Iull path - a label with tooltip showing the actual endpoint URL that would be used íor the request.
1he deíault Request editor has a Parameters table as described pre·iouslv íor deíining parameters and
their ·alues. Ií POS1 or PU1 has been chosen as method. a message-bodv area is made a·ailable below
the parameters table:
1 . 5 . 3 R E Q U E S T S
116
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he toolbar íor this are contains the íollowing options leít to right,
· Media1ype - drop-down containing Media1vpes oí deíined Request Representations and also the
multipart´íorm-data tvpe which can be used to simulate a íile-submit oí an l1ML íorm: selecting
this option will add all parameters and lile Attachments oí the request as Mime Parts in a Multipart
request.
· Recreate Body - action to recreate the content oí the bodv írom the corresponding schemaLlement
reíerred to bv a Representation with the selected Media1vpe: ií selecting a media1vpe whose
representations, speciív an element in a reíerenced XML Schema. this action will be enabled and
prompt to generate a deíault message based on the schema deíinition.
· POS1 QueryString - option to put Ouerv Arguments in the message bodv instead oí aíter the path
part oí the URL: this is íor simulating the beha·iour oí a standard l1ML lorm submitted with
POS1.
res
Representations and Attachments
Request´Response Representations are deíined and a·ailable ·ia their corresponding inspectors at the
bottom oí the requet´response editors and are used as alreadv described .
Attachments are used in se·eral wavs:
· Ií the method is PU1 or POS1 and the media1vpe oí the bodv is the same as that oí a request
attachment. that attachment is inserted into the message bodv instead
· Ií the method is PU1 or POS1 and the media1vpe oí the bodv is the same as that oí se·eral request
attachments. these attachments are sent as a Multipart bodv
· Ií the method is PU1 or POS1 and the media1vpe is multipart´íorm-data. all querv parameters and
request attachments are sent as Mime Parts in a Multipart bodv.
Response Handling
Response recei·ed íor a Request are displaved to the right. JSON responses ha·e a dedicated ·iewer
1 . 5 . 3 R E Q U E S T S
117
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
which prettv-prints the result:
Internallv both JSON and l1ML results get con·erted to XML which allows them to be inspected using
the soapUI Pro inspectors. íor example the 1able Inspector:
1 . 5 . 3 R E Q U E S T S
118
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Or the soapUI Pro O·er·iew ·iew:
soapUI Pro Form Editor
soapUI Pro enhances RLS1 requests in the same wav as \SDL requests:
· Bv pro·iding lorm ´ Outline ´ O·er·iew ·iews oí requests and responses
· Bv pro·iding a number oí inspectors íor response message content
1he Pro lorm editor renders an input-íriendlv íorm íor the deíined parameters and also pro·ides a
lorm-based editor íor request XML representations that are deíined in an included XML Schema. lor
example the íollowing lorm:
1 . 5 . 3 R E Q U E S T S
119
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he parameters are rendered as coníigured in their Details tab. the lower part contains a drop-down íor
selecting írom the representations that ha·e a corresponding element. Once selected. the corresponding
íorm will be rendered as shown in the screenshot,.
Next: RLS1 Ser·ice o·er·iew
1 . 5 . 3 R E Q U E S T S
120
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.6
Scripting
......................................................................................................................................
1 . 6 S C R I P T I N G
121
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.6.1
Script Library
......................................................................................................................................
1 . 6 . 1 S C R I P T L I B R A R Y
122
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.6.2
Dynamic Properties
......................................................................................................................................
1 . 6 . 2 D Y N A M I C P R O P E R T I E S
123
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.7
Properties
......................................................................................................................................
Using Properties in soapUI
soapUI opens íor the use oí custom "properties" íor storing custom ·alues within a Project. A "propertv"
is a named string ·alue currentlv all properties are handled as strings,. that can be accessed írom a
Groo·v Script . a Propertv 1ransíer or a Propertv-Lxpansion reíerences. soapUI allows íor the deíinition
oí properties at multiple le·els within the project hierarchv:
· Projects : íor handling Project scope ·alues. íor example a subscription ID
· 1estSuite : íor handling 1estSuite scoped ·alues. can be seen as "arguments" to a 1estSuite
· 1estCases : íor handling 1est(ase scoped ·alues. can be seen as "arguments" to a 1est(ase
· Properties 1estStep : íor pro·iding local ·alues´state within a 1est(ase
· Local 1estStep properties : se·eral 1estStep tvpes maintain their own list oí properties speciíic to
their íunctionalitv : DataSource . DataSink . Run 1est(ase
· MockServices : íor handling MockSer·ice scoped ·alues´arguments
· MockResponses : íor handling MockResponse scoped ·alues
· Global Properties : íor handling Global properties. optionallv írom an external source
Apart írom these custom properties. manv soapUI objects expose their own built in properties. see íor a
list oí which are a·ailable.
Property Editors
Properties are generallv editable in three places:
1he table a·ailable in the íirst two options has buttons to Add. Remo·e. and (lear and Import properties
írom an external source. In the table both names and ·alues oí properties can be edited as desired.
\hen renaming a propertv. soapUI will attempt to reíactor all reíerences to that propertv in both
Propertv Lxpansions and Propertv 1ransíers.
Global Properties in soapUI
Global properties are handled in the Global Properties preíerences tab . which contains a standard
propertv-table as described abo·e. Is is also possible to speciív an external properties-íile bv adding a
-Dsoapui.properties argument in the soapui.bat´.sh íile.
lor example. create a properties-íile named "properties.txt" containing
test.a.property=hello!
1 . 7 P R O P E R T I E S
124
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
in the soapUI bin íolder. Modiív the ja·a arguments in the soapUI.bat íile to be
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx256m -Dsoapui.properties=properties.txt
Add the íollowing Propertv-Lxpansion to a 1estRequest. Lndpoint. etc...
${test.a.property}
\hen expanded. the speciíied properties íile will be loaded as shown in the soapUI log:
01:20:05,234 INFO [PropertyExpansionRequestFilter] Loaded 52 properties from
[C:\workspace\core\project.properties]
1his íeature can be especiallv useíul when wanting to speciív global endpoints or authentication settings.
just speciív the corresponding expansions in the endpoint or authentications properties and thev will get
expanded when used
Both global and svstem properties can be set directlv írom the command-line when running anv oí the
soapUI bat´sh íiles: -Dpropertv.name~·alue sets a svstem propertv and -Gpropertv.name~·alue sets a
Global Propertv.
Property Expansion in soapUI
soapUI pro·ides a common svntax to dvnamicallv insert "expand", propertv ·alues during processing.
1he svntax is as íollows:
${[scope]propertyName[#xpath-expression]}
where scope can be one oí the íollowing literal ·alues:
· #Project# - reíerences a Project propertv
· #TestSuite# - reíerences a 1estSuite propertv in the containing 1estSuite
· #TestCase# - reíerences a 1est(ase propertv in the containing 1est(ase
· #MockService# - reíerences a MockSer·ice propertv in the containing MockSer·ice
· #Global# - reíerences a global propertv optional,
· #System# - reíerences a svstem propertv
· #Env# - reíerences a en·ironment ·ariable
· [TestStep name]# - reíerences a 1estStep propertv within the current 1est(ase
Manv oí the scopes will oí course onlv work ií thev are a·ailable. i.e. vou can not use the 4MockSer·ice4
scope within a 1est(ase script since there is no containing MockSer·ice to access.
Ií no scope is speciíied. the propertv is resol·ed as íollows:
1 . 7 P R O P E R T I E S
125
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1. (heck the current context íor example the 1estRun(ontext, íor a propertv with the matching name
2. (heck íor a matching global propertv
3. (heck íor a matching svstem propertv
Ií the propertv expansion íurther includes an XPath expression. this will be used to select the
corresponding ·alue írom the reíerenced propertv ·alue which must contain XML,. íor example the
íollowing example could "extract" the author ·alue írom a preceding response with:
${Search Request#Response#//ns1:Item[1]/n1:Author[1]/text()}
\hich would íirst get the "Response" propertv oí the "Search Request" step and then select the ·alue oí
the íirst Items' íirst Author element. Note that the namespace preíix must match those used in the
response message. otherwise the expansion will íail.
As vou can see. there is no wav to access properties "outside" scope. i.e. vou can not access a propertv in
another 1est(ase írom within a 1estStep. 1he is a deliberate restriction aiming to reduce dependencies
between items in a project. Ií vou need to transíer ·alues between íor example, two 1est(ases vou
should use the containing common 1estSuite or Project as an intermediarv: the íirst 1est(ase transíers to
the common parent using a Propertv-1ransíer or Groo·v script. the second reads írom the same parent.
In this wav. there is no direct dependencv between the two 1est(ases and the ·alue supplied bv the íirst
1est(ase can be supplied bv anv other source 1est(ase. Script. etc..., or staticallv.
Propertv 1ransíers are a more tedious wav oí accomplishing the same íunctionalitv as with
propertv-expansion. On the other hand. propertv transíers pro·ide the possibilitv to transíer complex
content between request. response messages. Also. the result oí a Propertv 1ransíer is ·isible directlv in
the corresponding request. response editors.
Dynamic Properties
soapUI 2.5 introduces the possibilitv to write groo·v scripts directlv inside a PropertvLxpansion: preíix
the content with a '~' and the remaining content up to the closing brace will be e·aluated as a script and
its result will be inserted. lor example
${=(int)(Math.random()*1000)}
will be replaced with a random number between 0 and 999 e·erv time it is e·aluated.
Oí course this applies to all places where propertv-expansions can be used: requests. propertv ·alues. íile
names. endpoints. etc.. etc..
Depending on the context oí the expansion. rele·ant ·ariables will be a·ailable íor accessing the soapUI
object model. lor example in a request message or parameter. the containing Request object will be
a·ailable through the "request" ·ariable. allowing vou to íor example, insert its name in vour request
...
${=request.name}
...
1 . 7 P R O P E R T I E S
126
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
or ií vou want the name oí the project just na·igate up the soapUI ModelItem tree:
...
${=request.operation.interface.project.name}
...
1he íollowing ·ariables are almost, alwavs a·ailable in these scripts:
· log : a log4j Logger logging to the groo·v log window
· modelItem : the current modelItem íor example a Request. MockResponse. etc..,.
· context : the current run-context íor example when running a 1est(ase och MockSer·ice,
lor soapUI Pro users. the global script librarv is a·ailable just as in anv other script. allowing vou to call
into objects´methods deíined there íor reuse. One current limitation is that although scripts can be
multiple lines. thev can not contain nested braces vet,.. as alwavs there is room íor impro·ement!
Nested Properties
soapUI supports both nested and recursi·e propertv-expansion be careíul!,. íor example:
test = "value"
testexp = "${test}"
-> "${testexp}" evaluates to "value"
testexp = "value"
exp = "${exp}"
-> "${test${exp}}" evaluates to "value"
testxml = "<test><value id="123">hello</value></test>"
testxpath = "//value[@id=${id}]/text()"
id = "123"
-> "${#testxml#${testxpath}}" evaluates to "hello"
Property Expansion Points
Propertv Lxpansion is supported in manv places in soapUI:
· request messages
· mock response messages írom the MockRun(ontext see Response Scripts ,. testStepName is
ignored.
· XPath and XOuerv assertions and their matching ·alues
1 . 7 P R O P E R T I E S
127
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· (ontains and Not-(ontains content assertions
· Request endpoints and authentication settings
· custom request or mock response l11P leaders
· Propertv-1ransíer source and target XPath expressions
· DataSource step coníiguration ·alues soapUI Pro onlv,
· MockResponse step response messages soapUI Pro onlv,
· Propertv Values in DataSink teststeps
· Outgoing \SS-related username and password ·alues
· SAML Assertions
Ií the speciíied propertv in an expansion is not a·ailable during processing. an emptv string will be output
instead. Ií vou are missing the possibilitv to expand in a desired place. please let us know so we can add
support there as well!
Built-In Properties
1he table below lists all properties a·ailable íor propertv-expansion and propertv-transíers. 1he
corresponding properties can also be seen in the Na·igator when in "Propertv-Mode".
Request The configures request message
...........................................................................................................................................................................................
Response The last response message (read-only)
...........................................................................................................................................................................................
Endpoint The current endpoint for the request
...........................................................................................................................................................................................
Username The current username for the request
...........................................................................................................................................................................................
Password The current password for the request
...........................................................................................................................................................................................
Domain The current domain for the request
...........................................................................................................................................................................................
Properties
<any defined property> the properties' value
...........................................................................................................................................................................................
GroovyScript Step
result the value returned by the script from its last run (read-only)
...........................................................................................................................................................................................
script the script itself
...........................................................................................................................................................................................
Run TestCase Step
<any defined property in the target TestCase> the properties' value
...........................................................................................................................................................................................
DataSource Step (soapUI Pro only)
<any defined property> the properties' value (read-only)
...........................................................................................................................................................................................
DataSink Step (soapUI Pro only)
<any defined property> the properties' value
...........................................................................................................................................................................................
MockResponse Step (soapUI Pro only)
1 . 7 P R O P E R T I E S
128
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Request The last request message (read-only)
...........................................................................................................................................................................................
Response The configured response message
Next: lunctional 1esting \eb Ser·ices
1 . 7 P R O P E R T I E S
129
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.7.1
Property Expansion
......................................................................................................................................
Using Properties in soapUI
soapUI opens íor the use oí custom "properties" íor storing custom ·alues within a Project. A "propertv"
is a named string ·alue currentlv all properties are handled as strings,. that can be accessed írom a
Groo·v Script . a Propertv 1ransíer or a Propertv-Lxpansion reíerences. soapUI allows íor the deíinition
oí properties at multiple le·els within the project hierarchv:
· Projects : íor handling Project scope ·alues. íor example a subscription ID
· 1estSuite : íor handling 1estSuite scoped ·alues. can be seen as "arguments" to a 1estSuite
· 1estCases : íor handling 1est(ase scoped ·alues. can be seen as "arguments" to a 1est(ase
· Properties 1estStep : íor pro·iding local ·alues´state within a 1est(ase
· Local 1estStep properties : se·eral 1estStep tvpes maintain their own list oí properties speciíic to
their íunctionalitv : DataSource . DataSink . Run 1est(ase
· MockServices : íor handling MockSer·ice scoped ·alues´arguments
· MockResponses : íor handling MockResponse scoped ·alues
· Global Properties : íor handling Global properties. optionallv írom an external source
Apart írom these custom properties. manv soapUI objects expose their own built in properties. see íor a
list oí which are a·ailable.
Property Editors
Properties are generallv editable in three places:
1he table a·ailable in the íirst two options has buttons to Add. Remo·e. and (lear and Import properties
írom an external source. In the table both names and ·alues oí properties can be edited as desired.
\hen renaming a propertv. soapUI will attempt to reíactor all reíerences to that propertv in both
Propertv Lxpansions and Propertv 1ransíers.
Global Properties in soapUI
Global properties are handled in the Global Properties preíerences tab . which contains a standard
propertv-table as described abo·e. Is is also possible to speciív an external properties-íile bv adding a
-Dsoapui.properties argument in the soapui.bat´.sh íile.
lor example. create a properties-íile named "properties.txt" containing
test.a.property=hello!
1 . 7 . 1 P R O P E R T Y E X P A N S I O N
130
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
in the soapUI bin íolder. Modiív the ja·a arguments in the soapUI.bat íile to be
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx256m -Dsoapui.properties=properties.txt
Add the íollowing Propertv-Lxpansion to a 1estRequest. Lndpoint. etc...
${test.a.property}
\hen expanded. the speciíied properties íile will be loaded as shown in the soapUI log:
01:20:05,234 INFO [PropertyExpansionRequestFilter] Loaded 52 properties from
[C:\workspace\core\project.properties]
1his íeature can be especiallv useíul when wanting to speciív global endpoints or authentication settings.
just speciív the corresponding expansions in the endpoint or authentications properties and thev will get
expanded when used
Both global and svstem properties can be set directlv írom the command-line when running anv oí the
soapUI bat´sh íiles: -Dpropertv.name~·alue sets a svstem propertv and -Gpropertv.name~·alue sets a
Global Propertv.
Property Expansion in soapUI
soapUI pro·ides a common svntax to dvnamicallv insert "expand", propertv ·alues during processing.
1he svntax is as íollows:
${[scope]propertyName[#xpath-expression]}
where scope can be one oí the íollowing literal ·alues:
· #Project# - reíerences a Project propertv
· #TestSuite# - reíerences a 1estSuite propertv in the containing 1estSuite
· #TestCase# - reíerences a 1est(ase propertv in the containing 1est(ase
· #MockService# - reíerences a MockSer·ice propertv in the containing MockSer·ice
· #Global# - reíerences a global propertv optional,
· #System# - reíerences a svstem propertv
· #Env# - reíerences a en·ironment ·ariable
· [TestStep name]# - reíerences a 1estStep propertv within the current 1est(ase
Manv oí the scopes will oí course onlv work ií thev are a·ailable. i.e. vou can not use the 4MockSer·ice4
scope within a 1est(ase script since there is no containing MockSer·ice to access.
Ií no scope is speciíied. the propertv is resol·ed as íollows:
1 . 7 . 1 P R O P E R T Y E X P A N S I O N
131
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1. (heck the current context íor example the 1estRun(ontext, íor a propertv with the matching name
2. (heck íor a matching global propertv
3. (heck íor a matching svstem propertv
Ií the propertv expansion íurther includes an XPath expression. this will be used to select the
corresponding ·alue írom the reíerenced propertv ·alue which must contain XML,. íor example the
íollowing example could "extract" the author ·alue írom a preceding response with:
${Search Request#Response#//ns1:Item[1]/n1:Author[1]/text()}
\hich would íirst get the "Response" propertv oí the "Search Request" step and then select the ·alue oí
the íirst Items' íirst Author element. Note that the namespace preíix must match those used in the
response message. otherwise the expansion will íail.
As vou can see. there is no wav to access properties "outside" scope. i.e. vou can not access a propertv in
another 1est(ase írom within a 1estStep. 1he is a deliberate restriction aiming to reduce dependencies
between items in a project. Ií vou need to transíer ·alues between íor example, two 1est(ases vou
should use the containing common 1estSuite or Project as an intermediarv: the íirst 1est(ase transíers to
the common parent using a Propertv-1ransíer or Groo·v script. the second reads írom the same parent.
In this wav. there is no direct dependencv between the two 1est(ases and the ·alue supplied bv the íirst
1est(ase can be supplied bv anv other source 1est(ase. Script. etc..., or staticallv.
Propertv 1ransíers are a more tedious wav oí accomplishing the same íunctionalitv as with
propertv-expansion. On the other hand. propertv transíers pro·ide the possibilitv to transíer complex
content between request. response messages. Also. the result oí a Propertv 1ransíer is ·isible directlv in
the corresponding request. response editors.
Dynamic Properties
soapUI 2.5 introduces the possibilitv to write groo·v scripts directlv inside a PropertvLxpansion: preíix
the content with a '~' and the remaining content up to the closing brace will be e·aluated as a script and
its result will be inserted. lor example
${=(int)(Math.random()*1000)}
will be replaced with a random number between 0 and 999 e·erv time it is e·aluated.
Oí course this applies to all places where propertv-expansions can be used: requests. propertv ·alues. íile
names. endpoints. etc.. etc..
Depending on the context oí the expansion. rele·ant ·ariables will be a·ailable íor accessing the soapUI
object model. lor example in a request message or parameter. the containing Request object will be
a·ailable through the "request" ·ariable. allowing vou to íor example, insert its name in vour request
...
${=request.name}
...
1 . 7 . 1 P R O P E R T Y E X P A N S I O N
132
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
or ií vou want the name oí the project just na·igate up the soapUI ModelItem tree:
...
${=request.operation.interface.project.name}
...
1he íollowing ·ariables are almost, alwavs a·ailable in these scripts:
· log : a log4j Logger logging to the groo·v log window
· modelItem : the current modelItem íor example a Request. MockResponse. etc..,.
· context : the current run-context íor example when running a 1est(ase och MockSer·ice,
lor soapUI Pro users. the global script librarv is a·ailable just as in anv other script. allowing vou to call
into objects´methods deíined there íor reuse. One current limitation is that although scripts can be
multiple lines. thev can not contain nested braces vet,.. as alwavs there is room íor impro·ement!
Nested Properties
soapUI supports both nested and recursi·e propertv-expansion be careíul!,. íor example:
test = "value"
testexp = "${test}"
-> "${testexp}" evaluates to "value"
testexp = "value"
exp = "${exp}"
-> "${test${exp}}" evaluates to "value"
testxml = "<test><value id="123">hello</value></test>"
testxpath = "//value[@id=${id}]/text()"
id = "123"
-> "${#testxml#${testxpath}}" evaluates to "hello"
Property Expansion Points
Propertv Lxpansion is supported in manv places in soapUI:
· request messages
· mock response messages írom the MockRun(ontext see Response Scripts ,. testStepName is
ignored.
· XPath and XOuerv assertions and their matching ·alues
1 . 7 . 1 P R O P E R T Y E X P A N S I O N
133
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· (ontains and Not-(ontains content assertions
· Request endpoints and authentication settings
· custom request or mock response l11P leaders
· Propertv-1ransíer source and target XPath expressions
· DataSource step coníiguration ·alues soapUI Pro onlv,
· MockResponse step response messages soapUI Pro onlv,
· Propertv Values in DataSink teststeps
· Outgoing \SS-related username and password ·alues
· SAML Assertions
Ií the speciíied propertv in an expansion is not a·ailable during processing. an emptv string will be output
instead. Ií vou are missing the possibilitv to expand in a desired place. please let us know so we can add
support there as well!
Built-In Properties
1he table below lists all properties a·ailable íor propertv-expansion and propertv-transíers. 1he
corresponding properties can also be seen in the Na·igator when in "Propertv-Mode".
Request The configures request message
...........................................................................................................................................................................................
Response The last response message (read-only)
...........................................................................................................................................................................................
Endpoint The current endpoint for the request
...........................................................................................................................................................................................
Username The current username for the request
...........................................................................................................................................................................................
Password The current password for the request
...........................................................................................................................................................................................
Domain The current domain for the request
...........................................................................................................................................................................................
Properties
<any defined property> the properties' value
...........................................................................................................................................................................................
GroovyScript Step
result the value returned by the script from its last run (read-only)
...........................................................................................................................................................................................
script the script itself
...........................................................................................................................................................................................
Run TestCase Step
<any defined property in the target TestCase> the properties' value
...........................................................................................................................................................................................
DataSource Step (soapUI Pro only)
<any defined property> the properties' value (read-only)
...........................................................................................................................................................................................
DataSink Step (soapUI Pro only)
<any defined property> the properties' value
...........................................................................................................................................................................................
MockResponse Step (soapUI Pro only)
1 . 7 . 1 P R O P E R T Y E X P A N S I O N
134
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Request The last request message (read-only)
...........................................................................................................................................................................................
Response The configured response message
Next: lunctional 1esting \eb Ser·ices
1 . 7 . 1 P R O P E R T Y E X P A N S I O N
135
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8
Functional Testing
......................................................................................................................................
Functional Testing of Web Services
\ou create a test írom a \SDL bv right-clicking the request and choosing "Add to 1est(ase". Once vou
vou ha·e this in a 1est(ase the next natural step is doing íunctional test oí it.
soapUI supports íunctional testing oí \eb Ser·ices bv pro·iding a 1est(ase metaphor where a number
oí 1estSteps can be executed in sequence. 1here are currentlv ele·en tvpes oí 1estSteps a·ailable
pro·iding íor rich testing possibilities. 1est(ases are íurther organized into 1estSuites oí which an
arbitrarv number can be created within each project.
lunctional \eb Ser·ice testing in soapUI can be used íor a ·arietv oí purposes:
· Unit testing : ·alidate that each \eb Ser·ice operation íunctions as stated
· (ompliance testing : ·alidate that the \eb Ser·ice returns results compliant with its deíinition
· Process testing : ·alidate that a sequence oí web ser·ice in·ocations íulíill a required business process
· Data Dri·en testing : ·alidate that anv oí the abo·e works as required with data input írom external
sources íor example a database or another web ser·ice,.
Next: Getting Started with lunctional 1esting
1 . 8 F U N C T I O N A L T E S T I N G
136
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.1
Getting Started
......................................................................................................................................
Getting Started with Functional Testing
Now that vou ha·e imported some \SDL's and tries some requests its time to create vour íirst 1est(ase.
In soapUI. íunctional testing can be used to ·alidate required íunctionalitv both íor each web ser·ice
in·ocation on its own ~"unit testing", or íor a number oí requests sequence ~"integration testing",.
lurther. vou can add scripts using the Groo·v Language , that can enhance vour tests in anv wav vou
want. íor example interact with a database or períorm complex test-ílow logic.
\e will continue where we leít oíí in the íirst "Getting Started" document where we just had created a
project and imported the Amazon \eb Ser·ice. 1he next step is to create a 1estSuite´1est(ase and add
some 1estSteps:
Create a Web Service Test from SOAP request
Once vou ha·e some requests working as vou want. vou can create a 1est(ase that ·eriíies their beha·ior
· Select the second toolbar button in the request editor window "Add this request to a test-case",.
· Ií there are no 1estSuites or 1est(ases in vour project. soapUI will prompt vou íor names oí these.
start out bv speciíving something like "Amazon 1estSuite" and "Amazon 1est(ase"
· soapUI will prompt vou íor the name oí vour test request. call it "Step 1"
· (orresponding 1estSuite´1est(ase will be created and the request will be added as a 1est-Request
which is a copv oí the original request so vou can keep plaving with that without changing the test
request,
· A test-request-editor almost identical to the pre·ious request-editor will be opened with vour new test
request: it diííers bv adding assertions íunctionalitv
Read more about 1estSuites ´ 1est(ases
Add an Assertions to a test
Now that vou ha·e vour íirst test request vou should add some assertions to ·eriív that it works correctlv
· Select the second toolbar button in the request editor window "Add an assertion to this test
request",.
· Start bv adding a "Schema (ompliance" assertion. this will check that the response is compliant with
the associated \SDL´Schema deíinition. 1he assertion will be shown in the assertion list under the
request´response editors see image below,
· Post the request with the green submit-button. soapUI will run the request and ·alidate the response.
Ií all goes well the test-request should be shown with a green background in the na·igation tree
1 . 8 . 1 G E T T I N G S T A R T E D
137
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Read more about Assertions
Now run your web service test!
Once vou ha·e all the test request and their assertions vou want vou can run the entire 1est(ase
· Double click on the test case node in the leít na·igation pane. this will open the test-case runner.
· Run all tests bv selecting the green arrow button labeled "Run this 1est(ase". soapUI will submit
each test request and ·alidate accordinglv. the results will be displaved during the execution.
Run vour tests írom the command line using one oí the soapUI command line tools a·ailable.
Next: \eb Ser·ice 1estSuites
1 . 8 . 1 G E T T I N G S T A R T E D
138
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.2
TestSuites
......................................................................................................................................
Web Service TestSuites
A 1estSuite ser·es as container íor an arbitrarv number oí 1est(ases. \hen running a 1estSuite the
contained 1est(ases can be executed either in sequence or in parallel as described below.
Generating TestSuites
Selecting the "Generate 1estSuite" option írom the Interíace menu prompts to generate a complete
1estSuite íor the selected interíace. 1he dialog contains the íollowing options:
· 1estSuite - select ií to generate into an existing 1estSuite or create a new one
· Style - there are 2 diííerent stvles:
1. One 1est(ase íor each Operation - creates a 1estSuite with one 1est(ase íor each operation
2. Single 1est(ase with one Request íor each Operation - create just that!
· Request Content - there are 2 alternati·es:
1. Use existing Requests in Interíace - uses the existing requests as 1estRequests
2. (reate new Lmptv Requests - creates new emptv requests with optional content in the created
1estRequests
· Operations - Select those operations vou want to generate íor
· Generate Load1est - (reates a deíault Load1est íor each generated 1est(ase
TestSuite Actions
1 . 8 . 2 T E S T S U I T E S
139
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he íollowing actions are a·ailable írom the 1estSuite nodes' right-button menu:
· Open 1estSuite Lditor - Opens the 1estSuite Runner described below
· Disable/Lnable 1estSuite - Disables´Lnables the 1estSuite
· New 1estCase - prompts to create a new 1est(ase in the 1estSuite
· Clone 1estSuite - prompts to clone the entire 1estSuite. including all 1est(ases´1estSteps
· Launch 1estRunner - opens the dialog íor launching the command-line 1estRunner
· Rename - prompts to rename the 1estSuite
· Remove - prompts to remo·e the 1estSuite írom its project. All contained 1est(ases will be
remo·ed also.
· Lxport - export this 1estSuite
· Import 1est Case - prompts íor 1est (ase to import to this 1estSuite
· Online Help - Displavs this page in an external browser
TestSuite Details Tab
1he "Details" tab shown in the bottom-leít shows the íollowing ·alues when the 1estSuite node is
selected in the na·igation tree
· Name : the name oí the current 1estSuite
TestSuite Runner
Double (licking a 1estSuite in the na·igator opens the 1estSuite Runner containing a list oí the
contained 1est(ases and a toolbar. A Progress Bar is displaved íor each 1est(ase. double-clicking a
1est(ase opens the associated 1est(ase editor. Ií a 1est(ase is currentlv being load tested its Progress
Bar displavs this and the 1est(ase will not be run during 1estSuite execution.
1he a·ailable toolbar buttons leít to right are:
· Run : Runs selected 1est(ases
· Cancel : (ancels ongoing runs
· New 1estCase : Prompts to create a new 1est(ase in this 1estSuite
· Run in Sequence : 1oggles ií the 1est(ases should be run in sequence
· Run in Parallel : 1oggles ií the 1est(ases should be run in parallel
· Create Report (soapUI Pro only) : Lxports a l1ML Report íor the last 1estSuite run see below,
1he run in sequence´parallel state is preser·ed and also applied when running a 1estSuite using one oí
the command line tools or the ma·en plugin.
Aíter the progress bar the comes a List oí the contained 1est(ases íollows bv a number oí Inspectors íor
the 1est(ase leít to right,:
· Description : an arbitrarv description íor the 1estSuite
· Properties : 1est(ase properties
· Setup Script : A Groo·v script to run when the 1estSuite is run
· 1earDown Script : A Groo·v script to run when the 1estSuite íinishes
1 . 8 . 2 T E S T S U I T E S
140
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he 1estSuite log window at the bottom shows all step´run results íor the last 1estSuite run
Generating Reports
1 . 8 . 2 T E S T S U I T E S
141
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
soapUI Pro supports the generation oí reports írom within the 1estSuite editor. 1he reports show a
summarv oí all executed 1est(ases and diagnostic iníormation íor íailed assertions.
Selecting the "(reate Report" button in toolbar opens the íollowing dialog íor exporting the last results
to an l1ML report:
Aíter speciíving the output íolder and íormat. the report will be created and opened in an external
browser:
TestSuite Coverage
1estSuit (o·erage is an Unique lunctionalitv íor soapUI soapUI Pro onlv, that allows vou to see how
1 . 8 . 2 T E S T S U I T E S
142
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
much oí the \eb Ser·ices are being co·ered bv vou tests. In e·ervdav work this let's vou impro·e vour
test bv adding assertions íor unco·ered elements as well as shows which elements are unused in vour test
suites.
1he 1estSuite (o·erage tab contains the same (o·erage iníormation as a·ailable in the Project (o·erage
Panel. Lnabling (o·erage and running the 1estSuite will dvnamicallv calculate´update the messages
exchanged during the tests and add their (o·erage iníormation to the (o·erage Panel. See the Project
(o·erage document íor details.
Next: lunctional \eb Ser·ice 1esting - 1est(ases
1 . 8 . 2 T E S T S U I T E S
143
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.3
TestCases
......................................................................................................................................
soapUI TestCases
soapUI supports íunctional testing oí web ser·ices bv pro·iding a 1est(ase metaphor where a number oí
1estSteps can be executed in sequence. Also. an arbitrarv number oí Load1ests can be associated with a
1est(ase íor running the 1est(ase under diííerent load scenarios.
TestCase Actions
1he íollowing actions are a·ailable írom the 1est(ase nodes' right-button menu:
· Show 1estCase Lditor - opens the 1est(ase Lditor described below
· Disable/Lnable 1estCase - disables or enables the 1est(ase
· Options - show the 1est(ase Options dialog described below
· Add Step -> - adds a new 1estStep to the 1est(ase
· New Load1est - prompts to create a new Load1est íor the 1est(ase
· Clone 1estCase (see below) - prompts to clone the entire 1est(ase. optionallv into another
1estSuite
· Clone 1estSteps (soapUI Pro only, see below) - prompts to clone a number oí 1estSteps.
optionallv into another 1estSuite
· Clear - prompts to remo·e all 1estSteps írom the 1est(ase
· Rename - prompts to rename the 1est(ase
· Remove - prompts to remo·e the 1est(ase írom its 1estSuite
· Launch Runner - open the Launch dialog íor the soapUI 1est(aseRunner
· Move 1estCase Up - mo·es the current 1est(ase up in the list oí 1est(ases
· Move 1estCase Down - mo·es the current 1est(ase down in the list oí 1est(ases
· Lxport - prompts íor íile where to export 1est (ase
· Online Help - Displavs this page in an external browser
TestCase Details Tab
1he "Details" tab shown in the bottom-leít shows the íollowing ·alues when the 1est(ase node is
selected in the na·igation tree
· Name : the name oí the current 1est(ase
Clone TestCase
Selecting to clone a 1est(ase írom the 1est(ase menu displavs the íollowing dialog:
1 . 8 . 3 T E S T C A S E S
144
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Ií selecting to clone to another project. soapUI will prompt to clone required interíaces to that project as
well.
Clone TestSteps
Selecting to clone 1estSteps írom the 1est(ase menu displavs the íollowing dialog:
1he selected steps will maintain reíerences to each-other íor example ·ia propertv-transíers, aíter the
clone. but be sure that the target 1est(ases, contains no 1estSteps that ha·e names same as those being
cloned in which case the cloned steps will be prompted to be renamed,.
Ií selecting to clone to another project. soapUI will prompt to clone required interíaces to that project as
well.
1 . 8 . 3 T E S T C A S E S
145
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Use the "Applv" option to execute the current Dialog settings without closing it.
The TestCase Editor
Doubleclicking a 1est(ase node in the na·igator or selecting its Open 1estCase Lditor menu option
opens the 1est(ase editor. which let's vou edit and run 1est(ases. Ií the 1est(ase is currentlv being load
tested the editor will be mostlv disabled.
1he editor is di·ided into the íollowing 4 parts írom top to bottom,:
· A toolbar íor running or cancelling and setting options
· A progress bar showing 1est(ase status and progress
· A number oí tabs íor the 1est(ase:
· 1estSteps - the list oí 1estSteps in the 1est(ase
· 1est(ase (o·erage - (o·erage Panel íor this 1est(ase
· 1est(ase Requirements - Requirements íor this 1est(ase
· A number oí Inspectors íor the 1est(ase leít to right,:
· Description : an arbitrarv description íor the 1est(ase
· Properties : 1est(ase properties
· Setup Script : A Groo·v script to run when the 1est(ase is run
1 . 8 . 3 T E S T C A S E S
146
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· 1earDown Script : A Groo·v script to run when the 1est(ase íinishes
· 1he 1est(ase Log íor ·iewing´exporting results: the íollowing entries are displaved:
· \hen the 1est(ase started
· An entrv íor each executed 1estStep speciíving how long it took
· Optional errors and´or messages reported bv each 1estStep
· low long the 1est(ase took
1 . 8 . 3 T E S T C A S E S
147
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
The TestCase Editor Toolbar
1he main toolbar contains the íollowing actions leít to right,
· Run 1estCase - runs the 1est(ase see below,
· Cancel 1estCase - cancels a running 1est(ase
· Run Continuously - toggles ií the 1est(ase is to be run continuouslv \hen selected. the 1est(ase
will run repeatedlv until cancelled with the (ancel 1est(ase button
· 1estCase Credentials - prompts to set the credentials to be used bv all requests in the 1est(ase.
1his is useíul ií vou want to run vour tests with diííerent credentials
· 1estCase Lndpoint - prompts to set the endpoint to be used bv all requests in the 1est(ase. 1his is
useíul ií vou want to run vour tests against diííerent ser·ers. etc. 1he a·ailable URL's are collected
írom the test requests' operations' interíaces. 1he selected endpoint is assigned to each request in the
1est(ase
· New Load1est - creates a new Load1est íor this 1est(ase
· 1estCase Options - opens the 1est(ase Options dialog described below
· Create Report (soapUI Pro only) : Lxports a l1ML Report íor the last 1estSuite run see below,
· Online Help - Displavs this page in an external browser
The TestStep List
1he 1estSteps tab contains a list oí the currentlv coníigured 1estSteps íor this 1est(ase. Double-clicking
a 1estStep in the list opens that items editor ·iew. Right-clicking a 1estStep shows a popup-menu with
the íollowing actions:
· Open Lditor - opens the associated 1estStep editor ií a·ailable,
· Disable/Lnable 1estStep - disables or enables the 1estStep íor execution
· Insert Step -> - shows a list oí insertable test-steps at the current position
· Rename - prompts to rename the selected step
· Delete - prompts to delete the selected step
· Clone 1estStep - prompts to clone the selected step see below,
· Move Step Up - mo·es the selected step up one position in the list this can also be períormed with
(trl-Up,
· Move Step Down - mo·es the selected step down one position in the list this can also be períormed
with (trl-Down,
· Step specific actions - depends on which tvpe oí 1estStep that is selected
· Online Help - displavs this page in a browser
Double clicking a 1estSteps' entrv in the log opens a 1estStep result ·iewer íor that step ií a·ailable and
as described on each 1estStep documentation page íor example the Request Result Viewer ,.
TestCase Options
1 . 8 . 3 T E S T C A S E S
148
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Selecting 1est(ase Options írom either a 1est(ase nodes popup menu in the na·igator or írom the
1est(ase Lditors toolbar opens a dialog with the íollowing options.
· Search Properties : \hen looking íor propertv ·alues without step speciíications see Propertv
Lxpansion ,. check all steps beíore the current one íor the named propertv.
· Session : (ontrols ií a l11P Session is to maintained íor all requests in the 1est(ase. Selecting this
will reuse cookies. authentication headers. etc
· Abort on error : (ontrols ií the 1est(ase is to be canceled when a 1estStep íails with an error. íor
example ií a contained RequestStep has íailed assertions,
· Iail 1estCase on Lrror : (ontrols ií the 1est(ase is to íail ií it the "lail on error" option is not
selected and the 1est(ase ends with one or more 1estStep.
· Discard OK Results : Long Running 1est(ases will e·entuallv consume substantial amount oí
memorv since all 1estStep results are internallv cached íor later ·iewing´reporting. (hecking this
option will make soapUI onlv sa·e non successíul 1estStep results which will sa·e substantial
amounts oí memorv.
· Socket timeout : 1he timeout in milliseconds, to be used íor all requests in the 1est(ase
· 1estCase timeout : 1he timeout in milliseconds, to wait beíore canceling or íailing a running
1est(ase
· Max results : 1he maximum number oí 1estStep Results to keep in memorv during the execution oí
a 1est(ase
Clone TestStep
1 . 8 . 3 T E S T C A S E S
149
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Selecting to clone a 1estStep írom a 1estSteps menu displavs the íollowing dialog:
Ií selecting to clone to another project. soapUI will prompt to clone the required interíace to that project
as well ií not a·ailable.
Generating Test Reports
soapUI Pro supports the generation oí reports írom within the 1est(ase editor. 1he reports show a
summarv oí all the executed 1est(ase and diagnostic iníormation íor íailed assertions.
Selecting the "(reate Report" button in toolbar opens the íollowing dialog íor exporting the last results
to an l1ML report:
Aíter speciíving the output íolder and íormat. the report will be created and opened in an external
browser:
1 . 8 . 3 T E S T C A S E S
150
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
TestCase Coverage
1est(ase (o·erage is an Unique lunctionalitv íor soapUI soapUI Pro onlv, that allows vou to see how
much oí the \eb Ser·ices are being co·ered bv vou tests. In e·ervdav work this let's vou impro·e vour
test bv adding assertions íor unco·ered elements as well as shows which elements are unused in vour test
cases.
1he 1est(ase (o·erage tab contains the same (o·erage iníormation as a·ailable in the 1estSuite and
Project (o·erage Panels. Lnabling (o·erage and running the 1est(ase will dvnamicallv calculate´update
the messages exchanged during the tests and add their (o·erage iníormation to the (o·erage Panel. See
the Project (o·erage document íor details.
1 . 8 . 3 T E S T C A S E S
151
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
TestCase Requirements
1he 1est(ase Requirements tab contains the same Requirements Panel as seen on the Project Viewer.
but onlv those Requirements that are dependant on this 1est(ase.
1 . 8 . 3 T E S T C A S E S
152
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Adding a new Requirement will automaticallv add the current 1est(ase to that requirements 1est(ase
List. Also. a specialized "Link 1est(ase" option is a·ailable írom the Requirements 1oolbar íor linking
the 1est(ase to existing Requirements:
Next: \eb Ser·ice íunctional 1esting- \orking with 1est Steps
1 . 8 . 3 T E S T C A S E S
153
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.3 TESTCASES
154
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4
TestSteps
......................................................................................................................................
soapUI TestSteps
A soapUI 1est(ase consists oí an arbitrarv number oí 1estSteps that are executed aíter eachother. 1he
íollowing tvpes oí steps are a·ailable:
Step Type Short Description
Request Sends a SOAP request and allows the response to be validated using
a variety of assertions.
...........................................................................................................................................................................................
REST Request Step Executes a REST Request to a Resource defined in the project
...........................................................................................................................................................................................
HTTP Request Step Executes and arbitrary HTTP request
...........................................................................................................................................................................................
Property Transfer Used for transferring property values between two test steps.
...........................................................................................................................................................................................
Groovy Script Runs a Groovy script that can do more or less "anything".
...........................................................................................................................................................................................
Properties Used for defining global properties that can be read from an external
source.
...........................................................................................................................................................................................
Conditional Goto Allows any number of conditional jumps in the TestCase execution
path. Conditions are specified as XPath expression and applied to the
previous request steps response.
...........................................................................................................................................................................................
Delay Step Pauses a TestCase run for the specified number of milliseconds
...........................................................................................................................................................................................
Run TestCase Step Runs another TestCase from within an existing one
...........................................................................................................................................................................................
MockResponse Step Waits/Listens for an incoming SOAP Request that can be validated
and return a mock response
...........................................................................................................................................................................................
DataSource Step Reads external data to be used as input to requests, etc - soapUI pro
only
...........................................................................................................................................................................................
DataSourceLoop Step Used together with a DataSource to specify looping for external data
rows - soapUI pro only
...........................................................................................................................................................................................
DataSink Step Writes properties to an external storage - soapUI pro only
...........................................................................................................................................................................................
DataGen Step Generates property values - soapUI Pro only
Lach 1estStep in a 1est(ase exposes a number oí properties which can be read. written. or modiíied bv
other 1estSteps. íor example a Groo·v Script step can read the "response" propertv oí a Request Step
and take some action depending on its ·alue. see Propertv Lxpansion íor details and examples.
Common TestStep Actions
Lach 1estStep has a popup-menu in the na·igator and 1est(ase editor containing a number oí common
1 . 8 . 4 T E S T S T E P S
155
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
and step-speciíic actions:
· Open Lditor - opens the associated 1estStep editor ií a·ailable,
· Disable/Lnable 1estStep - disables´enables the 1estStep íor execution
· Insert Step -> - shows a list oí insertable test-steps at the current position
· Rename - prompts to rename the selected step
· Delete - prompts to delete the selected step
· Clone 1estStep - prompts to clone the selected step see below,
· Move Step Up - mo·es the selected step up one position in the list this can also be períormed with
(trl-Up,
· Move Step Down - mo·es the selected step down one position in the list this can also be períormed
with (trl-Down,
· - specific actions - - 1estStep speciíic actions
· Online Help - displavs a 1estStep speciíic page in a browser
Next: \eb Ser·ice íunctional 1esting- \orking with 1estRequests
1 . 8 . 4 T E S T S T E P S
156
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.1
Test Requests
......................................................................................................................................
Test Requests
soapUI deíines three tvpes oí Request Steps:
1. SOAP 1est Requests - calls a \SDL Operation deíined in the project
2. RLS1 1est Requests - calls a RLS1 RLsource deíined in the project
3. l11P 1est Request - calls an arbitrarv l11P ser·ice
1he íirst two oí these are internallv linked to and dependant on their corresponding operations´resource
and thereíore also indirectlv dependant on their containing ser·ices. which thev need íor ·alidation.
request generation. etc. Remo·ing the ser·ice will also remo·e the corresponding 1est Requests a íuture
íeature will be to con·ert them to l11P 1est Requests,.
(ommon íor all these is that thev add an Assertion possibilitv íor ·alidating the response recei·ed írom
the target ser·ice.
The Assertions Tab
1he Assertions tab lists the assertions that ha·e been coníigured íor the 1estRequest. Double clicking an
assertion in the list opens that assertions' coníiguration dialog ií a·ailable,. Anv number oí assertions can
be added. oíten it mav be rele·ant to add the same tvpe oí assertion multiple times with diííerent
coníigurations.
A colored circle next to the assertion indicates the status oí the assertion in regard to the last recei·ed
response: red ~ assertion íailed together with error messages. green ~ assertion ok. grev ~ assertion has
not been períormed.
1 . 8 . 4 . 1 T E S T R E Q U E S T S
157
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he toolbar contains corresponding actions and a "(lone Assertions" action íor cloning a number oí
assertions to other 1estRequests see below,
1he íollowing actions are a·ailable írom the assertion lists right-button menu:
· Add Assertion - prompts to add a new assertion to the list.
· Configure ií possible, - opens the selected assertions' coníiguration dialog.
· Clone ií possible, - prompts to clone the select assertion.
· Rename - prompts to rename the selected assertion.
· Remove - prompts to remo·e the selected assertion.
The Request Log Tab
1he Request Log tab simplv shows a historv oí submit´response times and response-sizes íor the
1estRequest. 1his can come in handv ií vou want to manuallv compare response times or sizes o·er time.
Request Result Viewer
\hen executing a Request Step írom within a 1est(ase or associated Load1est, the actual request´result
and associated properties íor that request can be ·iewed bv opening a "Request Result Viewer" either
írom the 1est(ase editors log list or írom a Load1est editors log bv double-clicking the associated log
entrv. Sent or Recei·ed attachments are currentlv not sa·ed to preser·e memorv.
1he ·iewer shows 3 tabs:
· Request Properties - shows request and reponse properties íor the request
· Request Message - shows the actual request message sent. including expanded properties. inline
íiles and M1OM´XOP Includes..
· Response Message - shows the response message recei·ed
1 . 8 . 4 . 1 T E S T R E Q U E S T S
158
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Clone Assertions
lor SOAP Requests. soapUI Pro contains a right-button or assertion toolbar action íor cloning an
arbitrarv number oí assertions to other 1estRequests. 1he dialog shown is as íollows:
1 . 8 . 4 . 1 T E S T R E Q U E S T S
159
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he options top-to-bottom are:
· Assertions - select the assertions to be cloned
· 1arget 1estSteps - select the 1estRequests to clone to
· 1arget 1estCase - the target 1est(ase
· 1arget 1estSuite - the target 1estSuite
· 1arget Project - the target Project
· Overwrite - o·erwrites existing singular assertions ie those assertions that can onlv exist once. íor
example Soaplault. Schema(ompliance. etc,. Ií not selected and the corresponding assertions exist in
the target 1estSteps,. thev will be ignored.
· Open List - opens a separate window aíter the update containing a list oí all Requests´1estRequests
that ha·e been modiíied during the clone procedure useíul íor manual post processing,.
Setting the desired options and selecting OK will clone as coníigured. alternati·elv use the "Applv"
1 . 8 . 4 . 1 T E S T R E Q U E S T S
160
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
option to execute the current Dialog settings without closing it.
Next: SOAP Requests
1 . 8 . 4 . 1 T E S T R E Q U E S T S
161
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.2
Property Transfers
......................................................................................................................................
Property Transfers
Propertv 1ransíers are 1estSteps that transíer properties between Propertv (ontainers within the same
scope as the Propertv1ransíer 1estStep ie its containing 1est(ase. 1estSuite. Project and Goal
Properties,. 1he step can contain an arbitrarv number oí "transíers" speciíving a source and destination
propertv with optional XPath´XOuerv expressions.
Propertv 1ransíers use the same Saxon XPath´XOuerv engine as described íor the XPath´XOuerv
Assertion.
The PropertyTransfer Editor
1he Propertv 1ransíer editor is opened bv double clicking a Propertv1ransíer step either in the na·igator
or in the 1est(ase editors' 1estStep list.
1he editor contains a list oí coníigured transíers to the leít. selecting a transíer in the list will displav that
transíers source and destination XPath´XOuerv expressions to the right.
Use the top right (omboBoxes to speciív the source or propertv to be transíerred. the target or propertv
is speciíied with the combo boxes in the middle. Ií the properties contain XML an accompanving XPath
expression can be speciíied to íurther select the ·alue to transíer írom or mo·ing to. soapUI Pro adds an
XPath Selector íor GUI XPath (reaction button to the right oí these combo boxes íor easilv selecting
the source or target XPath expression írom the selected source or target propertv.
1 . 8 . 4 . 2 P R O P E R T Y T R A N S F E R S
162
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he íollowing actions are a·ailable írom the top toolbar
· Add : prompts to add a new transíer to the list
· Delete : prompts to delete the selected transíer
· Copy : prompts to create a copv oí the selected transíer
· Rename : prompts to rename the selected transíer
· Run : runs the selected transíer. i.e. transíers its ·alue as coníigured speciíied. lor this to work
properlv the source and target properties must be a·ailable íor example a 1estRequest response,.
· Run All : runs all the transíers. i.e. transíers the ·alues speciíied. lor this to work properlv the source
and target properties must be a·ailable íor example a 1estRequest response,.
· Declare : declares namespaces in both the source and destination XPath íields. Namespaces in the
source íield are extracted írom the selected 1estRequests current response message. namespaces in
the target íield are extracted írom the subsequent 1estRequests request message. Ií either oí these are
not a·ailable. soapUI will prompt to deíine all namespaces a·ailable in the associated schemas.
· Online Help - Displavs this page in an external browser
A "1ransíer Log" inspector at the bottom oí the editor displavs all transíers períormed bv this
Propertv1ransíer while the editor has been open. including both those períormed using one oí the
toolbar buttons and those períormed during a 1est(ase´1estSuite run. 1he 1ransíer Logs toolbar
contains a "(lear" button to clear its current contents.
1 . 8 . 4 . 2 P R O P E R T Y T R A N S F E R S
163
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Transfer Execution
Upon execution during a 1est(ase run. each transíer in the Propertv 1ransíer is períormed bv selecting
the propertv speciíied bv the transíers source step. propertv and optional XPath expression and copving
their ·alues, to the destination steps speciíied propertv using an optional XPath expression.
Ií XPath expressions are speciíied. soapUI will trv to replace the target node with the source node ií thev
are oí the same tvpe. Ií not íor example when assigning text, to an (attribute,. soapUI will do its best
to copv the ·alue as possible.
Source and target XPath expressions must both point to e·i.tivg voae. in their respecti·e properties. the
source propertv ob·iouslv requires the node so it can be selected. the target propertv requires the node so
it can be íound and o·erwritten.
Ií anv oí the transíers íail due to missing matches oí anv oí the XPath expression. an error is printed and
the step will either íail or go on. depending on oí the "íail on error" option has been selected íor that
transíer. 1est(ase execution is onlv aborted ií the 1est(ases' "lail on error" option has been set as
described íor under 1est(ase Options .
1he íollowing options are a·ailable íor each transíer:
· Iail transfer on error - lails the propertv-transíer ií an error occurs íor example a missing source
propertv,
· Set null on missing source - O·errides errors íor missing source ·alues and sets the target propertv
to null in these cases
· 1ransfer text content - \hen the XPath expression point at element nodes. their text content is
transíerred instead oí the elements themsel·es required íor backward compatibilitv with soapUI 1.5,
· Ignore empty/missing values - O·errides errors íor missing source ·alues and just ignores
corresponding transíers
· 1ransfer to all - Ií the target XPath expression selects multiple nodes. the source propertv ·alue will
be set in all these nodes instead oí onlv the íirst one.
· Use XQuery - interprets the speciíied source XPath expression as an XOuerv expression instead.
allowing íor transíers oí complex´transíormed data instead oí just "plain" copving
Working with Property Transfers
A Propertv 1ransíer can be created as íollows:
1. Begin bv creating the two 1estSteps that the Propertv1ransíer should transíer between.
2. (reate the Propertv1ransíer and íirst add a transíer in the coníiguration dialog using the Add button
3. Select the source and target 1estStep and propertv in their respecti·e combo-boxes
4. Ií anv oí the properties contains XML. proceed bv deíining namespaces in the XPath expressions
using the Define button. then add the actual XPath expressions that speciív what to select and where
to copv it. In the screenshot abo·e both expressions are //ns1:SessionId which will result in the
sessionID element being copied írom the preceding response to the íollowing request where it must
be a·ailable but preíerablv emptv,
1 . 8 . 4 . 2 P R O P E R T Y T R A N S F E R S
164
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
5. 1est the transíers, bv selecting the Run button and check the íollowing request message that the
·alues ha·e been copies correctlv. Anv errors will be shown either in the main soapUI log at the
bottom, or in a designated popup
6. Repeat steps 3-5 íor each transíer added to the Value1ransíer
with soapUI Pro creating propertv transíers is greatlv simpliíied using the corresponding Response
\izards which períorm most oí the abo·e steps automaticallv.
PropertyTransfer Example
1he íollowing sample is also included in the sample project included in the oííline distribution:
Set up 2 requests to the Amazon \eb Ser·ice deíined at
http:´´webser·ices.amazon.com´A\SL(ommerceSer·ice´A\SL(ommerceSer·ice.wsdl,:
<soapenv:Envelope
xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2006-02-15"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:ItemSearch>
<ns:SubscriptionId>- your subscription id here-</ns:SubscriptionId>
<ns:Request>
<ns:SearchIndex>Books</ns:SearchIndex>
<ns:Title>Oxford</ns:Title>
</ns:Request>
</ns:ItemSearch>
</soapenv:Body>
</soapenv:Envelope>
and
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2006-02-15">
<soapenv:Body>
<ns:ItemSearch>
<ns:SubscriptionId>- your subscription id here -</ns:SubscriptionId>
<ns:Request>
<ns:Author>?</ns:Author>
<ns:SearchIndex>Books</ns:SearchIndex>
</ns:Request>
</ns:ItemSearch>
</soapenv:Body>
</soapenv:Envelope>
and then create the íollowing transíer which mo·es the íirst author írom the íirst requests "response"
propertv to the author request element in the íollowing steps "request" propertv:
Source XPath:
declare namespace ns='http://webservices.amazon.com/AWSECommerceService/2006-02-15';
(//ns:Author)[1]
1 . 8 . 4 . 2 P R O P E R T Y T R A N S F E R S
165
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1arget XPath:
declare namespace ns='http://webservices.amazon.com/AWSECommerceService/2006-02-15';
(//ns:Author)[1]
Next: \eb Ser·ice 1esting - (onditional Goto Steps
1 . 8 . 4 . 2 P R O P E R T Y T R A N S F E R S
166
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.3
Conditional Gotos
......................................................................................................................................
soapUI Conditional Gotos
(onditional Goto steps e·aluate an arbitrarv number oí XPath conditions on the pre·ious requests
response message and transíer 1est(ase execution to the 1estStep associated with the íirst condition that
e·aluates to true. 1his allows íor conditional 1est(ase execution paths. where the result oí some request
controls how to mo·e on in the 1est(ase. Ií no condition matches the current response. 1est(ase
execution continues aíter the Goto Step as normal.
Sample scenarios could be:
· Branching depending on results returned bv a request
· Restarting aíter a "longer" delav minutes, íor sur·eillance testing
· Repeatedlv waiting and checking íor a status ·alue beíore mo·ing on íor example on a
batch-process,
(onditions use the same Saxon XPath engine as described íor the XPath Assertion. remember that a
condition vv.t e·aluate to a Boolean ·alue to be ·alid see Goto examples below ,
The soapUI Conditional Goto Editor
1he (onditionalGoto Lditor is opened bv double clicking a (onditionalGoto test step either in the
na·igator or in the 1est(ase Lditors' test step list.
1he editor contains a list oí coníigured conditions to the leít. selecting an existing condition in the list
will displav that condition's expression and a target 1estStep (omboBox to the right. 1he 1est
Condition button will e·aluate the current condition against the current response and displav the result
a response message must be a·ailable íor the preceding 1estRequest,.
soapUI Pro adds an XPath Selector button to the right oí the 1est (ondition button íor easilv selecting
the XPath that should be used íor e·aluation.
1 . 8 . 4 . 3 C O N D I T I O N A L G O T O S
167
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he íollowing actions are a·ailable írom the bottom toolbar
· Add : prompts to add a new condition to the list
· Copy : prompts to create a copv oí the selected condition
· Delete : prompts to delete the selected condition
· Rename : prompts to rename the selected condition
· Run : runs the conditions and displavs which condition that matched the current response a
response message must be a·ailable íor the preceding 1estRequest,
· Declare : declares namespaces in the selected conditions expression íield. Namespaces are extracted
írom the preceding 1estRequests current response message ií a·ailable,.
· Online Help - Displavs this page in an external browser
Goto Condition Examples
(onditions must e·aluate to a Boolean ·alue. íor example the íollowing expression checks that there are
hits in the search result returned írom the Amazon web ser·ice:
declare namespace SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/';
declare namespace
ns1='http://webservices.amazon.com/AWSECommerceService/2005-10-05';
declare namespace SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/';
count(//ns1:Item)>0
A generic condition that checks íor a soap bodv would be:
1 . 8 . 4 . 3 C O N D I T I O N A L G O T O S
168
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
declare namespace SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/';
count(//SOAP-ENV:Body)=1
and the corresponding check íor a soap íault would be:
declare namespace SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/';
count(//SOAP-ENV:Fault)=1
Next: \eb Ser·ice 1est Scripts - Groo·v Script Steps
1 . 8 . 4 . 3 C O N D I T I O N A L G O T O S
169
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.4
Groovy Scripts
......................................................................................................................................
Scripting your test with Groovy
1he Groo·v Script step allows vou to speciív an arbitrarv Groo·v script during the execution oí a
1est(ase. 1he script has íull access to the soapUI object model and can thus períorm a ·arietv oí tasks.
íor example:
· Read data írom an external data source and write it to another steps properties
· (ontrol 1est(ase ílow based on outcome oí some pre·ious step or external in·ocation
· 1rigger the execution oí other 1estSteps and´or 1est(ases
· Períorm ad·anced response ·alidations not possible with existing assertions
· \rite the results oí some pre·ious 1estStep to an external source reporting. etc...,
· etc...
Ií vou need to add external libraries to the soapUI classpath íor vour Groo·v scripts íor example jdbc
dri·ers,. put these in the bin`ext íolder under the soapUI installation. these will be read upon started and
added to the soapUI classloader. not currentlv possible in the Ja·a \ebStart ·ersion oí soapUI,.
The Groovy Script Editor
1he Groo·v Script editor is a straight íorward text-editor without not to manv bells-and-whistles except
undo´redo íunctionalitv:
1 . 8 . 4 . 4 G R O O V Y S C R I P T S
170
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he editor has three components írom top to bottom,:
· A toolbar : currentlv onlv containing a "Run" button
· A script editor : standard text-editor
· A log inspector : can be written to using the script contexts log object
· A status bar : displavs caret position and a progress bar during script execution
1he editor popup shown in the screenshot abo·e has standard editing´na·igation actions
Script Execution
\hen a Groo·v script is executed. the íollowing context ·ariables are set íor the script to use:
· testRunner : the soapUI 1estRunner running the current 1est(ase. this will íor now alwavs be an
instance oí soapUI \sdl1est(aseRunner
· context : the soapUI 1estRun(ontext running the current 1est(ase. this will íor now alwavs be an
instance oí soapUI \sdl1estRun(ontext
· log : a standard log4j Logger object a·ailable íor logging arbitrarv iníormation
\hen the script is run írom inside the editor using the toolbars "Run" button. the íirst 2 objects will be
set to mock implementations allowing limited access to their actual íunctionalitv. 1he log object will in
this case write to the log window in the editor. when running írom inside a 1est(ase the log will write to
a "Groo·v log" tab in the main soapUI log.
Ií vou want to íail the script due to some internal error throw an Lxception írom the script containing
the error message see example below,
Context Properties
1 . 8 . 4 . 4 G R O O V Y S C R I P T S
171
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he íollowing properties are a·ailable írom within a groo·v script:
· 1hreadIndex - the index oí the created thread when running under a Load1est. 1his ·alue will ne·er
change íor a gi·en 1est(ase during its run time. New threads will simplv get an incremented index.
the mod oí this ·alue could íor example be used as an index into a data íile to handle changes in
number oí threads,. \hen not running under a Load1est the ·alue oí this propertv will be "0".
· RunCount - tells how manv times the 1est(ase has been run bv its thread not in total, when
running under a Load1est. \hen not running under a Load1est the ·alue oí this propertv will be "0".
· Load1estRunner - the current soapUI Load1estRunner when running under a Load1est. null
otherwise.
· 4H11P_S1A1L - the lttpState maintained bv the 1est(ase ií it has been set to do so in the
1est(ase Options dialog.
Groovy Script Examples
Getting started with Groo·v is not as easv as it mav seem... here are some examples to get vou started:
Modiíication oí a Request xml:
// get request property
def request = testRunner.testCase.getTestStepByName( "Request 1" );
def property = request.getProperty( "request" );
// parse out textnodes to modify
def node = new groovy.util.XmlParser(false,false).parseText(property.value);
def textNodes = node["soapenv:Body"]["sam:getContactInfo"]["String_1"][0].children()
// modify
textNodes.clear();
textNodes.add( "test" + System.currentTimeMillis() );
// write back to string
def writer = new java.io.StringWriter();
def printer = new groovy.util.XmlNodePrinter( new PrintWriter( writer ));
printer.print( node );
// set property
property.setValue( writer.toString() )
Restarting a test aíter a certain time
// check if time is set
startTime = context.getProperty( "startTime" )
if( startTime == null )
{
startTime = System.currentTimeMillis()
context.setProperty( "startTime", startTime )
}
timePassed = System.currentTimeMillis() - startTime
if( timePassed < 60000 )
{
// countdown and set name
context.currentStep.name = "Groovy Step - " + (60000-timePassed) + "ms left"
log.info "timePassed = " + timePassed
Thread.sleep( 1000 )
1 . 8 . 4 . 4 G R O O V Y S C R I P T S
172
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
testRunner.gotoStep( 0 )
}
else
{
// reset name and pass on
context.currentStep.name = "Groovy Step"
log.info "timePassed = " + timePassed + ", exiting.."
}
Reading properties írom a íile and assigning them to a Properties Step
// read the file
def properties = new java.util.Properties();
properties.load( new java.io.FileInputStream( "testprops.txt" ));
def targetStep = testRunner.testCase.getTestStepByName( "Properties" );
// assign single property
targetStep.setPropertyValue( "myproperty", properties.getProperty( "myproperty" ));
// assign all properties
def names = properties.propertyNames();
while( names.hasMoreElements() )
{
def name = names.nextElement();
targetStep.setPropertyValue( name, properties.getProperty( name ));
}
Add a 1estStep dvnamicallv
// add a properties step
testRunner.testCase.addTestStep( "properties", "another step" );
lail the script step
// fail randomly
if( Math.random() > 0.5 )
throw new Exception( "A random error has occurred!" );
Read´set cookies
Ií vou select the "Maintain l11P Session" option in the 1est(ase Options Dialog. an internal
HttpState object will be maintained íor the entire 1est(ase. which includes anv cookies set bv the
target ser·er. 1he íollowing script reads all cookies currentlv set in the lttpState and writes them to the
Groo·v log:
def state = context.getProperty(
com.eviware.soapui.model.testsuite.TestRunContext.HTTP_STATE_PROPERTY )
assert state != null : "Missing HttpState.."
def cookies = state.cookies
assert cookies.length > 0 : "Missing cookies.."
for( c in 0..cookies.length-1 )
1 . 8 . 4 . 4 G R O O V Y S C R I P T S
173
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
log.info cookies[c].name + " = " + cookies[c].value
Ií vou on the other hand want to set some cookie beíore making a request. do as íollows:
def state = context.getProperty(
com.eviware.soapui.model.testsuite.TestRunContext.HTTP_STATE_PROPERTY )
assert state != null : "Missing HttpState.."
state.addCookie( new org.apache.commons.httpclient.Cookie(
"http://www.mydomain.com", "SessionID", "1234" ))
soapUI GroovyUtils
1he Groo·vUtils class simpliíies se·eral common scripting tasks. Instantiate Groo·vUtils írom within
anv Groo·v Script in soapUI MockResponse. Script Assertion. etc, using:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
Groo·vUtils currentlv includes the íollowing íew, methods:
· projectPath : a propertv holding the path to the containing project. useíul íor accessing data íiles
in same íolder
· setPropertyValue( String testStepName, String propertyName, String value
) : sets the speciíied propertv ·alue
· expand( string ) - expands the speciíied Propertv Lxpansion string
· getXmlHolder( String xmlPropertyOrString ) : (reates an XmlHolder object see
below, íor easilv accessing´modiíving contents oí an XML document using XPath expressions. 1he
argument must either be a 1estStep propertv in the TestStepName#PropertyName íormat or a
·alid XML string
1he abo·e mentioned Xmllolder object has the íollowing methods:
· getNodeValue( String xpath ) : returns the ·alue oí the íirst node pointed to bv the
speciíied XPath expression can be replaced bv holder|xpath| expression. see below ,
· getNodeValues( String xpath ) : returns a String arrav containing the ·alues oí all nodes
pointed to bv the speciíied XPath expression.
· getDomNode( String xpath ) : returns the DOM Node oí the íirst node pointed to bv the
speciíied XPath expression.
· getDomNodes( String xpath ) : returns a DOM Node arrav containing all nodes pointed to
bv the speciíied XPath expression.
· setNodeValue( String xpath, String value ) : sets the content oí the íirst node
pointed to bv the speciíied XPath expression to the speciíied ·alue can be replaced bv holder|xpath|
~ ·alue expression. see below ,
· declareNamespace( String prefix, String namespaceURI ) : declares a namespace
1 . 8 . 4 . 4 G R O O V Y S C R I P T S
174
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
that will be used in a íollowing get´set operation. can also be set with holder.namespaces|preíix| ~
namespaceUri see example below,
· getNamespaces() - returns a Map oí preíixes to namespace URI:s that will be used in XPath
expressions
· removeDomNodes( xpath ) - remo·es all DOM nodes matching the speciíied XPath expression
· xml : propertv containing the updated xml string
· xmlObject : propertv containing the parsed XMLBeans XmlObject íor the xml string
· prettyXml : propertv containing the prettv-printed updated xml string
· updateProperty() : ií the Xmllolder was created írom a 1estStep propertv. that propertv will be
updated with the currentlv held xml see example below,
· updateProperty( boolean prettyPrint ) : same as pre·ious. with option to prettv print
the updated xml. Deíaults to íalse when not speciíied.
Ií anv oí the speciíied XPath expressions contains no namespace declarations or none ha·e been declared
using the declareNamespace method. those present in the XML Message will be used in the same wav
as in Propertv Lxpansion .
Some examples oí both the Groo·vUtils and Xmllolder:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
log.info( groovyUtils.projectPath )
// create holder for last response and log requestId
def holder = groovyUtils.getXmlHolder( "Book Author Search#Response" )
log.info( holder.getNodeValue( "//ns1:RequestId" ))
// create holder for request and set id
holder = groovyUtils.getXmlHolder( "Book Author Search#Request" )
holder.setNodeValue( "//ns:SubscriptionId", ""+Math.random() )
// update request with updated xml
holder.updateProperty()
Also. Xmllolder implements the Map interíace íor shorter svntax when setting and getting node ·alues.
the corresponding abo·e calls can be replaced bv:
...
log.info( holder["//ns1:RequestId"] )
...
holder["//ns:SubscriptionId"] = ""+Math.random()
...
Ií the speciíied XPath expression returns multiple ·alues when getting a ·alue. a String arrav is returned
instead:
for( author in holder["//ns1:Author"] )
log.info( author )
1 . 8 . 4 . 4 G R O O V Y S C R I P T S
175
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Ií vou are not sure oí the namespace-preíix to use. vou can declare it vourselí:
def holder = groovyUtils.getXmlHolder( "Book Author Search#Response" )
holder.namespaces["abc"] =
"http://webservices.amazon.com/AWSECommerceService/2006-11-14"
log.info( holder["//abc:RequestId"] )
Next: 1esting \eb Ser·ices - Propertv Steps
1 . 8 . 4 . 4 G R O O V Y S C R I P T S
176
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.5
Properties Step
......................................................................................................................................
Properties Step
1he Properties Step allows vou to deíine an arbitrarv number oí properties that can be used írom
Propertv1ransíer and Groo·vScript steps. 1he properties can optionallv be read írom´written to a
properties-íile upon execution. íor example ií vou want to speciív some properties external passwords.
endpoints. etc, or want to write some results to a íile íor later reporting..
Properties Editor
1he Propertv Step Lditor is straightíorward:
1he toolbar at the top contains the íollowing leít to right,:
· Add Property : prompts to add a new propertv
· Remove Property : prompts to remo·e the selected propertv
· Load from : optional íield containing a íile´URL´svstem-propertv that contains the source oí the
properties. 1he speciíied íile or URL will be read as a standard properties íile and contained propertv
·alues will be assigned to the steps properties. Ií the íield is set to the name oí a svstem propertv. this
propertv must in turn speciív a íile or URL that will be subsequentlv read as described
· Select Properties Source : allows selection oí a local íile containing the properties to be read. 1he
selected íile will read and the contained properties ·alues will be assigned to matching properties in
the Properties Step vou will be prompted ií una·ailable properties are to be created,
· Save to : optional íield containing a íile or svstem propertv that contains the target name oí
properties íile. 1he speciíied íile will be created as a standard properties íile and contained propertv
·alues will be written to it. Ií the íield is set to the name oí a svstem propertv. this propertv must in
turn speciív a íile that will be subsequentlv created as described
1 . 8 . 4 . 5 P R O P E R T I E S S T E P
177
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Select Properties 1arget : allows selection oí a local íile to which the properties should be written
1he table displaved under the toolbar displavs the currentlv deíined properties and their ·alues. ·alues
and names can be changed bv standard editing.
Property Details Tab
1he Properties Step Details 1ab bottom leít, contains the íollowing:
· Name: 1he name oí the Properties step
· Description : an arbitrarv description íor the Properties step
· Create Missing on Load - creates properties írom source propertv íiles that are not currentlv
deíined
· Save before Load - speciíies to sa·e existing properties beíore loading new ones to´írom the
speciíied source and target propertv íiles
· Discard Values on Save : clears all propertv ·alues when project is sa·ed
Step Execution
\hen a Properties Step is executed during a 1est(ase. the íollowing actions are taken:
· 1he properties are read or written írom a source ií speciíied as described abo·e depending on "Sa·e
beíore Load" option,
· 1he properties are written or read to a target ií speciíied as described abo·e depending on "Sa·e
beíore Load" option,
· 1he properties are all copied to the current 1estRun(ontexts properties so thev are a·ailable íor
Propertv Lxpansion
Next: \eb Ser·ice 1est 1iming: Delav 1estStep
1 . 8 . 4 . 5 P R O P E R T I E S S T E P
178
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.6
Delay Step
......................................................................................................................................
SoapUI Delay Steps
Delav 1est Steps can be inserted at anv position in a 1est(ase to pause the execution oí the 1est(ase íor
a speciíied number oí milliseconds.
Once inserted using the Insert Step menu option described abo·e. right-click the delav step and select
the Set Delay 1ime option to set the number oí milliseconds to pause deíault is 1000ms,.
Next: Run 1est(ase Step
1 . 8 . 4 . 6 D E L A Y S T E P
179
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.7
Run TestCase
......................................................................................................................................
Run TestCase Step
1he Run 1est(ase step allows vou to run another 1est(ase írom within the current one. optionallv
setting and retrie·ing 1est(ase properties to or írom the target 1est(ase.
1his can be useíul íor breaking down complex 1est(ases into smaller parts or sharing some common test
íunctionalitv between 1est(ases.
Aíter selecting the "Run 1est(ase" tvpe when creating a new 1estStep. the íollowing dialog will be
shown:
Select the desired 1estSuite and 1est(ase in the top combo boxes. 1he "Return Properties" list contains
the 1est(ase properties deíined íor the selected target 1est(ase. select those properties whose ·alues
should be copied back to the Run 1est(ase step aíter execution.
The Run TestCase Editor
Once created. the Run 1est(ase editor will be opened. containing top to bottom,
· A toolbar with actions to run. cancel. coníigure and open the target 1est(ase
1 . 8 . 4 . 7 R U N T E S T C A S E
180
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· A table containing the same properties as the target 1est(ase. Onlv the propertv ·alues are editable
· A 1est(ase Log inspector showing the output oí the last run
Execution
\hen running the 1estStep. the íollowing happens:
1. 1he properties containing ·alues and not marked as return properties are copied to the target
1est(ase
2. 1he target 1est(ase is run
3. 1he properties marked as return properties are copied back írom the target 1est(ase to the Run
1est(ase step
4. Ií the target 1est(ase íailed. so will the Run 1est(ase step.
1he propertv handling in step 1 and 3 can be seen as input´output arguments íor the target 1est(ase.
allowing vou to run it with diííerent ·alues. 1his could be combined with a surrounding DataSource íor
executing an entire 1est(ase with a range oí input ·alues.
Aíter running. the 1est(ase log should contain the same output as would be seen in the 1est(ase log íor
the target 1est(ase:
1 . 8 . 4 . 7 R U N T E S T C A S E
181
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: \eb Ser·ice Simulation - MockResponse Step
1 . 8 . 4 . 7 R U N T E S T C A S E
182
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.8
Mock Response
......................................................................................................................................
MockResponse Step
1he MockResponse 1est step listens íor a SOAP Request and returns a pre coníigured response beíore
mo·ing on. 1he incoming request can be ·alidated just as the response oí a 1estRequest Step with the
same coníigurable assertions.
Usage scenarios íor this 1estStep are íor example:
· (lient testing - ·alidating incoming requests and returning dummv or incorrect responses to test a
client`s beha·ior
· 1esting oí asvnchronous processes - íor example starting some kind oí job with an initial RequestStep
and then waiting íor a notiíication beíore mo·ing on
Creating MockResponse Steps
MockResponse steps can be created either "írom scratch" using one oí the 1est(ase or 1estStep Insert
or Add operations:
1he dialog contains the íollowing options:
1 . 8 . 4 . 8 M O C K R E S P O N S E
183
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Name - 1he name oí the created step
· Operation - Speciíies which operation to mock
· Interíace - Speciíies which interíace to mock. changing this will also update the list oí a·ailable
operations
· (reate Response - ií a deíault MockResponse message should be created írom the schema
· Port - the port to listen on
· Path - the path to listen on
Aíter setting the desired ·alues and selecting OK. the step will be created and its editor opened.
Other wavs to create a MockResponse Step are:
· lrom an Operation Nodes' right-click menu to create a MockResponse step íor that Operation
· lrom a Request Nodes' right-click menu to create a MockResponse step íor that Request. using the
last response as the MockResponse content ií a·ailable,.
1 . 8 . 4 . 8 M O C K R E S P O N S E
184
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· lrom a MockResponse Nodes' right-click menu to add it to a 1est(ase. using the existing
MockResponse content ií a·ailable,.
MockResponse Step Properties
1he bottom-leít properties are the same as íor a standard MockResponse with the íollowing exceptions:
· 1imeout - lails the MockResponse Step ií no request has been recei·ed within the speciíied number
oí milliseconds. Speciíving 0 will wait indeíinitelv.
· Handle Iault - tells the MockResponse to accept an incoming SOAP lault
1 . 8 . 4 . 8 M O C K R E S P O N S E
185
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Handle Response - tells the MockResponse to accept an incoming Response Message ií it matches
the \SDL Operation
· Start Step - (oníigures at which step in the 1est(ase this MockResponse should start "listening" íor
a request. 1his can be useíull ií vou íirst are making a request to a ser·ice that calls back to the
MockResponse Step within the execution oí that request. in which case vou would set the Start Step
to the request otherwise the MockResponse would not be listening íor requests when the request
comes,. Lea·ing this emptv will start listening when the step is executed.
· Port - the port to listen on
· Path - the path to listen on
· Host - the hostname to use in the hosted \SDL
The MockResponse Step Editor
1he MockResponse Step is the basicallv the same as the standard soapUI Pro MockResponse editor with
the addition oí the same assertions´log tabs in the bottom as the 1estRequest editor and a number oí
context-sensiti·e wizards in the Outline Lditor íor creating assertions and Propertv 1ransíers.
At the top there is a toolbar that adds input íields íor the path and port to listen on during execution. the
rest is the same as the MockResponse editor. 1hese are graved out during execution oí the
MockResponse step. Assertions can be added´managed just as íor the 1estRequest editor . the list oí
a·ailable assertions is the same except the SOAP-lault-related assertions. which are not applicable to
request messages.
1 . 8 . 4 . 8 M O C K R E S P O N S E
186
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Query/Match Configuration
1he Ouerv´Match coníiguration tab allows one to speciív a querv that will be used to select which
incoming request to handle. 1his is useíull during Load1ests. where requests mav come in anv order and
must be identiíied using some ID in the request. lor example the Ouerv would speciív an XPath
expression that selects the ID and the Match would contain a propertv-expansion that would match the
ID
MockResponse Step Execution
\hen the execution oí a 1est(ase reaches the coníigured "Start Step". the MockResponse Step will start
1 . 8 . 4 . 8 M O C K R E S P O N S E
187
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
a local temporarv MockSer·ice and wait íor a request to the coníigured operation on the coníigured path
and port. Once a request has been recei·ed. it will be ·alidated with the coníigured assertions and
processed just like a standard MockResponse. Aíter returning the MockResponse result. the MockSer·ice
will be closed down. and execution will mo·e to the next step in the 1est(ase.
Propertv 1ransíers can be used with MockResponse Steps just as with 1estRequests. i.e. properties can
be transíerred írom incoming requests and to outgoing responses.
Although running a Load1est containing MockResponse steps will work. these steps are not designed íor
Load1esting due to the íollowing:
MockResponse Response Scripts
1he context script ·ariable a·ailable in the MockResponse Response Script. acts both as a
MockRun(ontext and a 1estRun(ontext. allowing it to access the same context ·ariables as other
Groo·v scripts in the 1est(ase
Next: soapUI Pro DataSource Step íor data dri·en testing
1 . 8 . 4 . 8 M O C K R E S P O N S E
188
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.9
DataSource
......................................................................................................................................
soapUI Pro DataSource Steps
Data Dri·en \eb Ser·ice 1esting is one on soapUIs' strengths. In soapUI this can be done bv Groo·v
scripting. but in soapUI Pro this is simpliíied. 1he basis íor this is the DataSource Step.
soapUI Pro includes a specialized DataSource 1estStep that greatlv eases the task oí creating data dri·en
tests. DataSource steps can íurther be nested in a 1est(ase allowing one DataSource to be input to
another. íor example ií directlv contains a number oí XML data íiles. the Directorv DataSource could be
used to iterate the íiles. and an XML DataSource could be used to extract data írom the íiles.
1he íollowing DataSources are currentlv supported:
· JDB( DataSource - reads data írom a JDB( data source
· Lxcel DataSource - extracts data írom an Lxcel xls, íile
· Grid DataSource - allows entries or management oí data írom within the editor
· XML DataSource - extracts data írom an XML propertv
· lile DataSource - extracts data írom a columnar data íile
· Directorv DataSource - reads íiles into properties
· Groo·v DataSource - opens íor anv kind oí DataSource
A complementarv DataSourceLoop step is required and thus a·ailable íor speciíving when and where to
loop íor each row oí data a·ailable írom the DataSource.
The DataSource Editor
1he DataSource editor is di·ided into 4 parts:
· A list oí properties to the leít íor speciíving which properties the DataSource reads and exposes
· A toolbar to the top right íor selecting a DataSource and setting properties and options
· A DataSource speciíic-coníiguration panel to the right
· A 1est Log inspector at the bottom íor displaving rows returned when either testing the datasource
or when running its containing 1est(ase
1 . 8 . 4 . 9 D A T A S O U R C E
189
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he list oí Properties must contain the properties that will be "exposed" bv the DataSource step. thev are
added or remo·ed using the Add´Remo·e toolbar buttons. Lach DataSource then has its own wav oí
reading data into the properties. as described below.
1he DataSource drop down select with DataSource to use. and the "1est" button will prompt to select a
coníigurable number oí rows írom the currentlv selected and coníigured DataSource. Returned rows will
be displaved in the 1est Log at the bottom. 1he "Preload" and "Share" options are described in the
"DataSource Lxecution" section below.
DataSource Options
1he DataSource Options dialog is as íollows:
1 . 8 . 4 . 9 D A T A S O U R C E
190
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he íollowing settings are a·ailable:
· Shared - controls whether this DataSource should be shared between threads in a Load1est see
below,
· Restart Shared - controls ií a shared DataSource can be restarted during a Load1est
· Restart On Run - controls ií the DataSource should be restarted e·erv time the 1estStep is executed
· Preload - preloads the data beíore running the 1est(ase
· Iail on Lmpty - íails the DataSource step ií no data is a·ailable. 1his option can be used to do
data-dri·en assertions. ií íor example the SOL querv oí a JDB( datasource contains a \lLRL
clause that uses propertv expansion to select data corresponding a pre·iouslv returned response
· Goto Loop on Lmpty - ií the DataSource is emptv on initial execution. this option will transíer
1est(ase execution to the íirst matching DataSourceLoop step aíter the DataSource in the 1est(ase
· Start Row - the íirst row in the coníigured DataSource to use íirst row ~ 0,
· Last Row - the last row in the coníigured DataSource to use
· 1rim - trims ·alues retrei·ed írom the DataSource
· Lntitize - entitize ·alues retrei·ed írom the DataSource
· Lxpand - expand propertv-expansions in DataSource ·alues
1 . 8 . 4 . 9 D A T A S O U R C E
191
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
DataSource Execution
Depending on the ·alue oí the "Preload" option in the toolbar. the DataSource will initialize its external
data either beíore running the 1est(ase preload ~ true, or when íirst running the DataSource preload ~
íalse,. Depending on which kind oí DataSource that has been selected and coníigured. it mav not make
much sense to set preload to true. íor example when using the XML DataSource together with the
response propertv oí a request. setting preload to true will íail since the data is íirst a·ailable when the
request has been executed.
(onsecuti·e rows are retrie·ed and read into the exposed properties either when 1est(ase execution
passes the DataSource step or when a DataSourceLoop Step checks íor the next a·ailable row.
1he "Shared" option in the toolbar control ií the DataSource should be shared between threads during a
Load1est. meaning that all running threads will read írom the same source oí data instead oí each
creating their own.
Read More in our blog about DataDri·en Load 1esting .
JDBC DataSource
1he JDB( DataSource has the íollowing coníiguration panel:
1he 4 a·ailable options are prettv straight-íorward:
· Driver - the JDB( Dri·er to load and use íor this DataSource. Must be a·ailable in the soapUI
classpath either bv placing it in a soapui´bin´ext directorv. the jre´lib´ext directorv or bv directlv
modiíving the soapui.bat´.sh íiles to include the required jar íiles
· Connection String - the connection string to use
· SQL Query - the querv to issue íor the created connection. It must return at least the same number
oí rows as speciíied in the Properties List where there must be a column with the same name as its
corresponding propertv.
· Stored Procedure - select ií the SOL statement calls a stored procedure
1 . 8 . 4 . 9 D A T A S O U R C E
192
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Excel DataSource
1he Lxcel DataSource has the íollowing coníiguration panel:
1he 3 a·ailable options are prettv straight íorward:
· Iile - the excel íile containing the data to use
· WorkSheet the worksheet in the íile containing the data to use
· Start at Cell - the top leít cell to start at when extracting data.
Grid DataSource
1he Grid DataSource has the íollowing coníiguration panel:
Grid DataSources are the easiest wav oí creating a DataSource allowing ·erv rapid data dri·en testing.
\hile it is not meant to scale to massi·e amounts oí data. it is ·erv useíul íor earlv iterations in Agile
\eb Ser·ice 1esting and can be replaced íor more the more scalable DataSources later.
1he grid displavs one column íor each deíined propertv. columns are added´remo·ed when properties
are added remo·ed. Lnter data bv either tvping into the grid or copv´pasting írom íor example Lxcel.
1he last row in the grid is not part oí the data but there íor adding new rows. 1he íollowing actions are
a·ailable írom the toolbar under the grid:
1 . 8 . 4 . 9 D A T A S O U R C E
193
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Delete Rows - prompts to delete the selected rows
· Insert Rows - prompts to insert a number oí rows at the current row
· Clear Cells - prompts to clear the selected cells
XML DataSource
1he XML DataSource has the íollowing coníiguration panel:
XML DataSources are ·erv usable since this means vou can use a pre·ious response as a DataSource
1he a·ailable options are:
· Source Step - the 1estStep containing the XML propertv to read írom could be another DataSource,
· Source Propertv - the Propertv containing the XML to use
· Row XPath - the XPath expression to use íor selecting the "Rows" íor the data
· (olumn XPaths - one XPath expression íor each DataSource propertv relati·e to the Row XPath
During execution. the Row XPath will be selected during startup and each rows propertv ·alues will be
selected relati·e to the current row node as shown in the abo·e screenshot,
File DataSource
1he lile DataSource has the íollowing coníiguration panel:
1 . 8 . 4 . 9 D A T A S O U R C E
194
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
liles are expected to be in a simple row íormat íor example comma-separated,. where each row contains
the supplied data ·alues separated bv a coníigurable separator. 1he a·ailable options are:
· lile - the íile to read
· Separator - the separator íor the columns in each row
· 1rim Values - ·alues will be trimmed aíter reading
Directory DataSource
1he Directorv DataSource has the íollowing coníiguration panel:
1he directorv DataSource has 2 options:
· Directorv : the Directorv to scan íor íiles
· lilename lilter : a standard lileName íilter used to narrow down which íiles to read
A DataSource Step with a Directorv DataSource need onlv to deíine one propertv which will contain the
entire íile as read írom disk. 1his could then be input to a request bodv or a nested DataSourceStep that
uses the XML DataSource to extract data írom the read íile.
Groovy DataSource
1he Groo·v DataSource has the íollowing coníiguration panel:
1 . 8 . 4 . 9 D A T A S O U R C E
195
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1his step allows anv kind oí DataSource to be created íor a DataSource Step. 1he Groo·v script must set
desired properties in the a·ailable "result" object a String1oStringMap,. a·ailable context ·ariables are:
· "result" - íor speciíving result ·alues
· "context" - the current 1estRun(ontext íor storing context-speciíic ·alues
· "testRunner" - the current 1estRunner object
Next: soapUI Pro DataSourceLoop Step íor data dri·en testing
1 . 8 . 4 . 9 D A T A S O U R C E
196
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.10
DataSource Loop
......................................................................................................................................
soapUI Pro DataSourceLoop Step
Data Dri·en \eb Ser·ice 1esting is one on soapUIs' strengths. In soapUI this can be done bv Groo·v
scripting. but in soapUI Pro this is simpliíied.
1he DataSourceLoop Step is used together with the DataSource Step to create a sequence oí steps that
should be executed íor each row oí data. It must be placed aíter its corresponding DataSource step and is
coníigured bv either double-clicking or selecting "(oníigure" írom its popup menu. which displavs the
íollowing dialog:
1he dialog contains 2 options:
· DataSource Step - selects the DataSource Step to check íor more data
· 1arget Step - selects the Step to loop to ií more data is a·ailable
lor example. ií a DataSource step is used to read data írom an external íile and the íollowed bv a request
using that data. a DataSource Loop should be added aíter the request speciíving the DataSource Step and
the Request step as its target step... i.e. loop back to the request ií more data is a·ailable,.
Next: soapUI Pro DataSink Step
1 . 8 . 4 . 1 0 D A T A S O U R C E L O O P
197
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.11
DataSink
......................................................................................................................................
soapUI Pro DataSink Step
Oíten vou want sa·e the data when doing \eb Ser·ice testing. 1his can be in to take a response and use
it in later Requests. sa·e inío íor logging purposes or e·en to actuallv populate a business database.
1his can be done in soapUI bv writing a Groo·v script. but is simpliíied in soapUI Pro.
soapUI Pro includes a specialized DataSink 1estStep that greatlv eases the task oí sa·ing oí data collected
during a test to an external storage. 1he íollowing DataSink tvpes are supported:
· JDB( DataSink - writes data to a JDB( datasource
· Lxcel DataSink - writes data to an Lxcel xls, íile
· lile DataSink - writes data to a columnar data íile
· Groo·v DataSink - calls a Groo·v Script íor each set oí data
· Propertv DataSink - aggregates ·alues to a propertv
The soapUI Pro DataSink Editor
1he DataSink editor is di·ided into 4 parts:
· A list oí properties to the leít containing the ·alues to be sa·ed.
· A toolbar to the top right íor selecting a DataSink and setting properties and options
· A DataSink speciíic coníiguration panel to the right
· A Data Log inspector at the bottom íor displaving rows processed bv the DataSink
1 . 8 . 4 . 1 1 D A T A S I N K
198
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he list oí Properties should contain those properties that will be passed to the coníigured Datasink. thev
are added´remo·ed using the Add´Remo·e toolbar buttons. 1he DataSink dropdown selects the
DataSink to use
soapUI Pro DataSink Options
1he DataSink Options dialog is as íollows:
1he íollowing settings are a·ailable:
· Shared - controls whether this DataSink should be shared between threads in a Load1est see below,
1 . 8 . 4 . 1 1 D A T A S I N K
199
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
soapUI Pro DataSink Execution
L·erv time the 1est(ase execution ílow passes the DataSink Step it will call the coníigured DataSink with
the current propertv ·alues. Values should ha·e been pre·iouslv set bv either a Groo·v script or a
propertv transíer. or can alternati·elv contain a PropertvLxpansion svntax.
It is possible to drag properties írom the Na·igator tree into the Properties table to either add new a new
propertv containing a PropertvLxpansion íor the dragged propertv. or ií dragged onto an existing
propertvs' ·alue: to create a PropertvLxpansion there instead.
1he "Shared" option in the toolbar controls ií the DataSink should be shared between threads during a
Load1est. meaning that all running threads will write svnchronized, to the same DataSink instead oí
each creating their own.
soapUI Pro JDBC DataSink
1he JDB( DataSink has the íollowing coníiguration panel:
1he 4 a·ailable options are prettv straight íorward:
· Driver - the JDB( Dri·er to load and use íor this DataSink. Must be a·ailable in the soapUI
classpath either bv placing it in a soapui´bin´ext directorv. the jre´lib´ext directorv or bv directlv
modiíving the soapui.bat´.sh íiles to include the required jar íiles
· Connection String - the connection string to use
· SQL Update - the update statement to issue íor the created connection. using Prepared Statement
svntax ie · is used as ·alue placeholder,.
· Stored Procedure - select ií the SOL statement calls a stored procedure
soapUI Pro Excel DataSink
1 . 8 . 4 . 1 1 D A T A S I N K
200
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he Lxcel DataSink has the íollowing coníiguration panel:
1he 4 a·ailable options are prettv straight-íorward:
· Iile - the source excel íile to use as a template íor adding data
· Out Iile - the target excel íile to write. Ií not speciíied the data is written to the source íile
· Worksheet the worksheet to which the data should be added
· Start at Cell - the top-leít cell to start at when writing data.
soapUI Pro File DataSink
1he lile DataSink has the íollowing coníiguration panel:
liles will be written in a simple row íormat. using the speciíied separator. 1he a·ailable options are:
· lile - the íile to write to
· Separator - the separator íor the columns in each row
· 1rim Values - ·alues will be trimmed beíore writing
· Append Values - ·alues will be appended to an existing íile instead oí creating a new one when the
1est(ase starts
1 . 8 . 4 . 1 1 D A T A S I N K
201
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
soapUI Pro Groovy DataSink
1he Groo·v DataSink has the íollowing coníiguration panel:
1his step allows anv kind oí DataSink to be created íor a DataSink Step. A·ailable context ·ariables are:
· "context" - the current 1estRun(ontext íor storing context-speciíic ·alues
· "properties" - a Map containing the current propertv ·alues
· "testRunner" - the current 1estRunner object
· "log" - a log íor logging
soapUI Pro Property DataSink
1he Propertv DataSink has the íollowing coníiguration panel:
1 . 8 . 4 . 1 1 D A T A S I N K
202
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1his step allows íor aggregation oí ·alues into a propertv that can be used elsewhere:
· Result Propertv - the target propertv in this 1estStep to write to must be deíined!,
· Preíix - the preíix íor the propertv ·alue
· (ontent - the content to add íor each time the DataSink is executed
· Suííix - the suííix íor the propertv ·alue
As seen in the example screenshot. propertv-expansion is supported in these íields. 1he example will
continouslv "build" an XML list oí items which can íor example be used in a later request bv reíerring to
the DataSinks "test" propertv.
Next: DataGen 1estStep
1 . 8 . 4 . 1 1 D A T A S I N K
203
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.8.4.12
DataGen
......................................................................................................................................
DataGen TestStep
1he "DataGen" 1estStep can be used to generate data to be used as input in vour 1est(ases. íor example
number or date sequences. random selections. etc. 1he generated data is a·ailable as properties and can
thus be reíerred to with Propertv 1ransíers and Lxpansions just like anv other propertv. (reate a
DataGen step as usual írom the 1est(ase popup menu. Double-clicking the 1estStep will open the
íollowing editor:
1he table at the top contains the deíined DataGen properties with their common settings see below,.
selecting a propertv in the table shows the corresponding coníiguration panel at the bottom.
Add and delete properties using the toolbar buttons at the top. the Add button opens the íollowing
dialog:
1 . 8 . 4 . 1 2 D A T A G E N
204
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he tvpes oí propertv a·ailable are currentlv:
· Script : speciíies a propertv whose ·alue is created bv a groo·v script
· 1emplate : speciíied a block oí content to be used when building other ·alues
· Number : allows íor number-based sequential creation oí propertv ·alues integers. dates. etc,
· List : speciíies a list oí possible ·alues to return when the propertv is read
Script
1he coníiguration panel when selecting a Script propertv is as íollows:
1 . 8 . 4 . 1 2 D A T A G E N
205
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Speciív a groo·v script that returns the desired ·alue íor the propertv. lor example vou could create a
propertv that contains todav date in a nice íormat:
def sdf = new java.text.SimpleDateFormat("yyyy-MM-dd")
return sdf.format( new Date())
Anvwhere in vour 1est(ase where PropertvLxpansions are a·ailable. vou could use this with
>¦DataGen4todav}. which would be replaced with todavs date when used.
Template
1he 1emplate coníiguration-panel is equallv simple:
1 . 8 . 4 . 1 2 D A T A G E N
206
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1his tvpe is useíul íor building complex multiple-line properties. íor example to be inserted into requests.
lere one can speciív anv content that can also contain propertv-expansions. íor example
<date><today>${DataGen#today}</today></date>
\hich would e·aluate to an XML element containing todavs date when used in conjunction with the
abo·e deíined script-propertv.
Number
1his propertv tvpe is used íor generating lists oí numbers: the start´end´step ·alues speciív the range oí
the sequence and its increment or decrement,. 1he pattern speciíies how to íormat the propertv ·alue
using the ja·a Decimallormat class see this page íor some examples,. Selecting the Random check box
will select a random number within the speciíied range instead with speciíied step as modulus,. 1he
Persist options will sa·e the last number when sa·ing the project so the sequence can continue at its last
·alue ií required remember though that projects are not sa·ed aíter running through the command-line
tools,.
So íor example ií vou want to generate random USD currencies between 100 and 1000 USD with a 50
USD increment vou could speciív the íollowing:
1 . 8 . 4 . 1 2 D A T A G E N
207
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
List
Another straight-íorward coníiguration:
1he abo·e screen shot coníigures a list oí weekdavs and sets the propertv to select a random line each
time it is read. ií the Randomize check box is not checked. the ·alues are used sequentiallv.
Common Configuration Properties
1he table listing the properties contains two more coníiguration possibilities: Mode and Shared.
Mode controls how the propertv ·alue is e·aluated and has two possible ·alues: RLAD and S1LP.
RLAD will re-e·aluate the propertv each time it is reíerenced. 1his works ok with íor example, our
todav propertv created abo·e and anv other propertv that can´should ha·e its ·alue recreated e·erv time.
1his mav not alwavs be desired though: íor example vou might be using a Number propertv to generate a
unique ID to use during the entire run oí a 1est(ase. Ií vou are reíerring to this ID in se·eral
requests´scripts´etc. setting it to RLAD would gi·e vou a new ·alue e·erv time. instead oí one ·alue that
is alwavs the same. In this case set the Mode to S1LP and the propertv will be e·aluated when the
DataGen 1estStep is executed during the execution oí the containing 1est(ase. Please note that beíore
this execution the propertv will not ha·e anv ·alue at all so be sure to put the DataGen beíore anv steps
that might be reíerring to it.
Shared controls whether the propertv should be shared between threads in a Load1est: mavbe vou are
using a Number propertv to create unique sequential IDs and also need them to be unique across threads
in which case this propertv is required to be shared. otherwise each thread would create the same
sequence oí ·alues which would then not be unique across all runs.
Next: Load 1esting \eb Ser·ices with soapUI
1 . 8 . 4 . 1 2 D A T A G E N
208
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.9
Load Testing
......................................................................................................................................
Web Service Load Testing
soapUI pro·ides extensi·e load testing íunctionalitv allowing vou to do the íollowing:
· lunctional Load1esting : ·alidate íunctionalitv under load using standard 1est(ase methods
· Beha·ioral Load1esting : analvze períormance beha·iour under ·arving load with diííerent load
strategies
· Períormance Load1esting : íind maximal períormance a·ailable using thread strategies and
(ommand Line Load1est execution
· Requirements Dri·en Load1esting : deíine períormance requirements and continuouslv ·alidate using
Load 1est assertions
Anv number oí Load1ests can be created íor a 1est(ase using the 1est(ases "New Load1est"
popup-menu action,. each with diííerent strategies. assertions. etc. to ·alidate´assess a 1est(ases and its
1estSteps períormance under diííerent circumstances.
1he documentation íor load testing in soapUI has been split into the íollowing documents:
· 1his document gi·es a background on the soapUI approach to load testing and an o·er·iew oí the
Load1est Lditor
· Load 1est (oníiguration : describes limits and strategies
· Load 1est Lxecution : describes the execution oí Load1ests
· Load 1est Assertions : speciíies the a·ailable Load1est assertions and how thev are used
· Load 1est Diagrams : describes the a·ailable diagrams during Load1esting
· JMeter (omparison : a comparison with the popular JMeter tool
Requirements Driven Load Testing
One oí our main objecti·es with the load testing íunctionalitv in soapUI was to implement a
"requirement-dri·en" approach to load testing. lar too oíten. load-testing in our experience, is
períormed to see "how íast" a certain \eb Ser·ice or business process is. Although this mav be
interesting írom a technical and sometimes business, point oí ·iew. more oíten it is important the web
ser·ice is "íast enough" íor the actual business processes being realized. which is usuallv íar below the
actual períormance achie·able. Although this "íast enough" is usuallv ·erv hard to deíine bv the business
owner. we belie·e that this is none-the-less the best approach when assessing the períormance oí a web
ser·ice and´or its en·ironment.
Based on this approach. soapUI allows vou to deíine a number oí Load1est Assertions that are
continuouslv applied to an ongoing Load1est to ·alidate that it períorms "as required". íor example the
a·erage response time oí a request can be asserted to not go under a speciíied ·alue íor a longer period oí
1 . 9 L O A D T E S T I N G
209
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
time. Other assertions a·ailable include max-response time. 1PS. etc...
1his íunctionalitv can íurther be used íor sur·eillance testing. where a number oí Load1ests are run
periodicallv using some scheduling tool to assess that indi·idual web ser·ices íor example in a SOA or an
integration API, continuouslv períorm as required. A setup íor this is described in the Sur·eillance
Scenario .
The LoadTest Editor
1he Load1est Lditor gi·es an o·er·iew oí the current Load1est coníiguration. results and e·ents:
1he editor contains the íollowing components top-down,
· 1he Load1est toolbar containing a number oí actions and the 1est Limit settings íor this Load1est
· 1he Load Strategv toolbar containing settings íor the selected Load Strategv
· 1he Statistics 1able showing up-to-date statistics on the current Load1est
· A 1abbed Pane containing two tabs: a "Load1est Log"-tab showing log-e·ents íor the current
Load1est and a "Load1est Assertions"-assertions where the assertions íor this Load1est can be
coníigured
1 . 9 L O A D T E S T I N G
210
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
The LoadTest Toolbar
1he main toolbar contains the íollowing actions leít to right,:
· Run : Starts the Load1est as described under Load1est Lxecution
· Cancel : (ancels an ongoing Load1est
· Statistics Graph : Show the Statistics Graph íor the Load1est
· Statistics History Graph : Show the Statistics listorv Graph íor the Load1est
· Reset Statistics : Resets the statistics íor an ongoing Load1est
· Lxport Statistics : Prompts to export the current Load1est Statistics to a comma separated íile
· Options : Shows the Load1est Options dialog
· Limit Settings : Sets the limit íor the Load1est as described in the Lxecution document
· 1he íar right contains a Progress Bar displaving the progress in percent, oí the current Load1est
execution
1he LoadStrategv toolbar is described in the Load 1est Lxecution document.
LoadTest Options
1he Load1est Options dialog contains the íollowing settings:
· 1hread Startup Delay : Sets the startup delav íor each thread in milliseconds,. setting to 0 will start
all threads simultaneouslv
· Reset Statistics when thread-count changes : Automaticallv resets statistics when the number oí
threads changes. Since íor example, the a·erage is calculated using the number oí threads. this ·alue
will be "iníluenced" bv pre·ious results írom a diííerent thread-count. which can be a·oided bv
resetting the statistics when the number oí threads changes
· Calculate 1PS/BPS based on actual time passed : Bv deíault. 1PS 1ransactions per second, is
calculated with 1000´a·g,threadcount ,. see (alculation oí 1PS´BPS . \hen setting a 1est(ase
delav using the Simple LoadStrategv. the a·g will generallv be ·erv low. but the actual transactions per
second will not be equi·alentlv high since there is a delav,. Selecting this option will calculate 1PS
using time-passed´cnt, instead
· Include request write in calculated time : \hen selected. the time to establish the connection with
the target endpoint and write the l11P request will be included in the calculated time íor Request
test steps. Select this option ií vou want the "actual" request time measured includes proxv. requests.
authentication challenges. etc,
· Include response read in calculated time : \hen selected. the time to read the l11P response
will be included in the calculated time íor Request test steps. Ií not selected. onlv the time íor reading
the response l11P headers will be included the response content will still be read íor assertions and
e·entual results ·iewing,
· Close Connections after each request : Select this ií vou want to disable Keep-Ali·es´(onnection
reuse. which will result in a load testing scenario which resembles an en·ironment with manv
diííerent \eb Ser·ice clients
· Sample Interval : Sets the sample-inter·al íor the Load1est Statistics table in milliseconds,. deíault
1 . 9 L O A D T E S T I N G
211
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
is 250ms.
· Disable History : Discards all historical statistics internal useíul íor preser·ing memorv during
·erv-long-running tests,
· Max Assertions in Log : Discards the underlving MessageLxchange íor assertion errors in the
Load1est log aíter the speciíied amount. Discarded assertions contain the text "|discarded|" in their
message column in the Load1est Log. Use this option to íree memorv ií vou are ha·ing a lot oí
assertions.
· Cancel Running : (ancels anv running threads when the limit has been reached.
1he eííect oí some oí these options on Load1est results can be rather substantial íor response times
depending on network coníiguration. etc, and is illustrated and discussed in the JMeter (omparison
document.
1he "Statistics Log" tab contains settings íor automaticallv exporting Load1est statistics continuouslv
during the execution oí a Load1est. 1he options are:
· Log lolder - the íolder where to create the log-íiles. soapUI will create one íile íor each 1estStep and
one íor the whole 1est(ase.
· Log Inter·al - how oíten in milliseconds, the current statistics ·alues should be written
1 . 9 L O A D T E S T I N G
212
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Log on 1hread(ount change - automaticallv logs statistics ·alues beíore changing the number oí
threads
The Statistics Table
1he statistics table shows real time statistics íor each 1estStep in the underlving 1est(ase and íor the
1est(ase total.
1 . 9 L O A D T E S T I N G
213
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he Statistics currentlv collected are described in detail in the Load1est Lxecution document.
Double clicking a 1estStep row in the table opens that 1estSteps associated editor.
Right clicking on a 1estStep shows a popup menu show 1estStep speciíic actions and actions to add
Load1est Assertions íor the selected 1estStep as described under Load1est Assertions .
The LoadTest Log
1he Load1est Log displavs execution status messages and errors reported bv the Load1est Assertions.
Double-clicking an error will open the errors result ·iewer ií a·ailable,. íor example allowing vou to see
the actual request´response that generated the error.
1he top toolbar contains the íollowing actions leít-to-right,:
· Remove Lrrors : remo·es all errors írom the Load1est Log
· Lxport : prompts to export the current Load1est log to a íile
· Show 1ypes filter : íilters which tvpe oí errors´messages that should be shown in the log
· Show Steps filter : íilters which steps that should be shown in the log
1he table is sortable bv clicking the column-header íor the column to be sorted on. A label under the
table displavs the number oí rows currentlv in the table.
Next: Getting Started with \eb Ser·ice Load 1ests
1 . 9 L O A D T E S T I N G
214
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.9.1
Getting Started
......................................................................................................................................
Getting Started with Web Service Load Testing
soapUI 1.5 introduces simple and poweríul SOAP Load1esting íunctionalitv allowing vou to:
· Validate a \eb Ser·ices períormance under diííerent Load scenarios
· Maintain lunctional ·alidations to see that thev don't "break" under load
· Run se·eral load tests simultaneouslv to see how thev aííect each other
lere we will continue írom the lunctional 1est(ase created in the pre·ious "Getting Started" document.
Start bv creating a Load1est íor the created 1est(ase using its "New Load1est" popup menu option. 1he
opened Load1est Lditor should be something like the íollowing depending on which steps vou created
in vour 1est(ase,:
1he Load1est is pre coníigured to run íor 60 seconds top right, with 5 threads using the Simple
LoadStrategv. Modiív these ·alues as desired read more about soapUI Load1est (oníiguration , and run
the test. \ou will see the statistics table in the middle beginning collecting data and aíter 60 seconds
should ha·e a íinished Load1est as íollows read more about Load1est Lxecution ,:
Add Assertions to a Load Test
soapUI allows vou to add Load1est Assertions to Load1ests just as to lunctional 1estSteps. \hen
creating a Load1est. soapUI will alwavs add a 1estStep Status Assertion íor us. we will add a 1estStep
Max Assertion to ·alidate that our 1est(ase ne·er exceeds a certain execution time.
Select the "Load1est Assertions" tab at the bottom oí the Load1est Lditor and press the displaved "Add
Assertion" button. Select the "Step Maximum" assertion and coníigure it as íollows in the displaved
dialog:
1he Step Maximum assertion checks that a steps max-time does not exceed a speciíied ·alue.
· Name - the name oí the assertion. lea·e it it íor now
· Minimum Requests - the minimum number oí runs that must ha·e been executed beíore applving
this assertion. \e will allow the íirst 10 1est(ase runs to pass.
· Max 1ime - the maximum allowed step time. we set it to 500 m.
· Max Lrrors - the maximum number oí errors to allow beíore canceling the Load1est. we will allow 5
"breaches" oí the 500ms limit beíore the Load1est should íail
· 1estStep - the target step to assert. \e select the request in our 1est(ase
1 . 9 . 1 G E T T I N G S T A R T E D
215
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Run again!
Now running the Load1est might gi·e vou a result like to íollowing where the 1est(ase 5 times exceeded
the limit oí 500ms and íailed the Load1est.
\ou can double click an assertion íailure in the log and ·iew the actual request that íailed. allowing vou to
debug the request´response message. etc.. Double-clicking one oí the errors abo·e shows the íollowing:
Now What?
1rv plaving around with the diííerent Load1est Strategies. Load 1est Diagrams . etc..
Next: (oníiguring \eb Ser·ice Load 1ests
1 . 9 . 1 G E T T I N G S T A R T E D
216
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.9.2
Limit & Strategies
......................................................................................................................................
LoadTest Configuration
1he actual execution oí a Load1est is coníigured in two dimensions:
· 1he Load1est Limit controls how long a Load1est should run
· 1he Load1est Strategies control how 1est(ases are scheduled and threaded i.e. run in parallel,
LoadTest Limit
1he Load1est Limit is speciíied on the top right oí the Load1est Lditor and consists oí two settings:
· Limit : speciíies íor how manv 1est(ase runs or seconds the Load1est should run
· Limit 1ype : speciíies how to limit the Load1est: Seconds will run the Load1est íor the speciíied
time. 1otal Runs will run the underlving 1est(ase íor the speciíied number oí times in total.
Please note that the "1otal Runs" Limit 1vpe does not mean per thread but in total: ií íor example
setting the Limit to 1000 and coníiguring 5 threads. each thread will run approximatelv 200 requests
depending on execution times...,.
Setting the Limit to 0 with either Limit 1vpes will run the Load1est indeíinitelv. A progress bar to the
right oí the settings will show the current Load1est progress.
LoadTest Strategies
A Load1est can in soapUI be run using a number oí strategies íor how 1est(ases are executed. All
strategies ha·e a thread-count allowing the speciíication oí how manv 1est(ases that should be run in
parallel. 1he current strategv is selected using the a·ailable Strategv combo. which will show that
strategies settings to its right. Some strategies allow interacti·e changing oí the thread count while
executing the Load1est. others don't.
1he íollowing Load1est Strategies are currentlv a·ailable:
· Simple : 1est(ase execution with a coníigurable delav
· Variance : 1est(ase execution ·arving the number oí threads o·er time
· Burst : 1est(ase execution in "bursts"
· 1hread : 1est(ase execution with a íixed thread count modiíication
· Grid : Deíines a custom ·ariation oí thread count soapUI Pro onlv,
· Script : Lets a groo·v script control the number oí threads soapUI Pro onlv,
1 . 9 . 2 L I M I T & S T R A T E G I E S
217
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Since multiple Load1ests with diííerent strategies can be created one could íor example create one
Load1est with a simple "base" load using the Simple strategv and another Load1est using the Burst
strategv to monitor how base períormance is aííected when running both Load1ests simultaneouslv
within soapUI or írom the command-line.
Load1est Simple Strategv
1he Simple Strategv has the íollowing settings:
· 1est Delay : sets a delav between each 1est(ase run
· Random : sets how much oí the delav to randomize
Use this íor simple load testing. lor example setting the delav´random to 1000´0.5 will delav each
threads 1est(ase execution bv 500 to 1000 ms. Setting the delav to 0 will ignore the random setting and
run without anv delavs.
Ií setting a delav be aware that the 1PS statistic will gi·e misleading results unless the "(alculate 1PS on
actual time passed" option is selected in the Load1est Options dialog
Load1est Variance Strategv
1he ·ariance strategv has the íollowing settings:
· Interval : sets the duration oí each ·ariance cvcle in seconds
· Variance : sets how much the thread-count should be ·aried during the cvcle
Use this strategv íor simulating a linearlv ·arving number oí threads o·er time. 1he strategv will start at
the currentlv coníigured thread-count. increase to current - current·ariance,. decrease to current -
current·ariance, and increase back to the current thread-count.
lor example setting the thread-count to 20. duration to 480 and ·ariance to 0.5. the strategv will increase
írom 20 to 30 threads in the íirst 2 minutes. decrease to 10 threads oí the next 4 minutes and then
increase back to the original 20 in the last 2 minutes.
Load1est Burst Strategv
1he Burst strategv has the íollowing settings:
· Burst Delay : sets the delav between each burst
· Burst Duration : sets duration íor each burst
Use this strategv to simulate a "burst" load and íor example monitor svstem beha·iour during the
"reco·erv" periods
lor example setting the limit tvpe to seconds. and limit to 600. the thread-count to 30. burst delav to 50.
and burst duration to 10 will pause all 30 threads íor 50 seconds and run them íor 10 seconds repeatedlv
under 10 minutes.
Load1est 1hread Strategv
1 . 9 . 2 L I M I T & S T R A T E G I E S
218
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he 1hreads Strategv has the íollowing settings:
· Start 1hreads : sets the number oí threads to start at
· Lnd 1hreads : sets the number oí threads to end at
Use this strategv to ·arv the number oí threads írom a start to end ·alue linearlv during the entire
Load1est. 1his can íor example be useíul to íind the thread-count at which the best 1PS is achie·ed.
lor example setting the limit tvpe to seconds. and limit to 600. the start threads to 1. and end threads to
30 will increase the number oí threads írom 1 to 30 o·er 10 minutes.
Load1est Grid Strategv
1he Grid Strategv has the coníiguration dialog:
Lach row in the grid coníigures the number oí threads aíter the elapsed time since the pre·ious row. In
the abo·e example the number oí threads will change to 8 aíter 10 seconds. then to 12 aíter another 10
seconds. etc. Both Llapsed 1ime and 1hread(ount are stored relati·elv to the current 1hread(ount and
limit. so ií these are changed the grid ·alues will be recalculated accordinglv.
Load1est Script Strategv
1he Script Strategv has the coníiguration dialog:
1 . 9 . 2 L I M I T & S T R A T E G I E S
219
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
lere vou create a script that should return the number oí threads the 1est(ase should use. 1he script is
called at the inter·al speciíied in the Load1est Options dialog. 1he abo·e example would set a random
number oí threads between 1 and 11 each time it is called.
Next: \eb Ser·ice Load 1esting Lxecution
1 . 9 . 2 L I M I T & S T R A T E G I E S
220
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.9.3
Execution
......................................................................................................................................
LoadTest Execution
\hen running a Load1est soapUI internallv creates a complete copv oí the underlving 1est(ase íor each
thread. allowing each 1est(ase to maintain its own state and properties. Depending on which limit and
strategv has been selected. load testing will proceed as coníigured until the Load1est terminates due to
one oí the íollowing:
· It has reached its coníigured Load 1est limit
· It has been canceled bv the user with the "(ancel" button on the Load1est toolbar
· It has been canceled bv a Load1est Assertion when the maximum number oí allowed errors íor that
assertion has been passed
During execution. the íollowing statistics are periodicallv collected and displaved in the Statistics 1able:
· min - the shortest time the step has taken
· max - the longest time the step has taken
· avg - the a·erage time íor the test step
· last - the last time íor the test step
· cnt - the number oí times the test step has been executed
· tps - the number oí transactions per second íor the test step. see (alculation oí 1PS´BPS below.
· bytes - the number oí bvtes processed bv the test step
· bps - the bvtes per second processed bv the test step
· err - the number oí assertion errors íor the test step
(ollection and calculation oí this data is períormed asvnchronouslv i.e. independentlv írom the actual
1est(ase executions, in soapUI. so it should not aííect the actual load testing períormance.
1he 1otal row shows the statistics íor the 1est(ase itselí.
LoadTest Step Time calculation
soapUI internallv uses the System.nanoTime() method íor determining the actual time taken bv a
test-step. 1he íollowing table describes how these times are calculated íor the a·ailable 1estStep tvpes:
Step Type Duration
Request Step The request duration is calculated depending on the settings in the
LoadTest Options dialog (as described there).
...........................................................................................................................................................................................
1 . 9 . 3 E X E C U T I O N
221
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Step Type Duration
Groovy Script The actual script evaluation
...........................................................................................................................................................................................
Properties Step The time to load/save the properties (if configured)
...........................................................................................................................................................................................
Delay Step The steps delay
...........................................................................................................................................................................................
Property Transfer The time it took to transfer all properties
...........................................................................................................................................................................................
Goto Step The time it took to evaluate the goto-conditions
LoadTest Assertions
\hen running a Load1est. the coníigured assertions are applied and will generate an error in the log ií
not met:
Assertion errors can be double clicked and will show a ·iew displaving the underlving 1estStep state that
íailed the assertion. lor example the íollowing will be shown íor Request that íailed an assertion:
1 . 9 . 3 E X E C U T I O N
222
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Calculation of TPS/BPS
Depending on the setting oí the "(alculate 1PS.." option in the Load1est Options dialog. 1PS and BPS
are calculates as íollows:
· NO1 based on actual time passed deíault,:
· 1PS : 1000´a·g,threadcount. íor example a·g ~ 100 ms with ten threads will gi·e a 1PS oí 100
· BPS : bvtes´cnt, 1PS. i.e. the a·erage number oí bvtes per request 1PS. lor example a total
number oí recei·ed bvtes oí 1000000 íor 100 requests with a 1PS oí 100 would gi·e 100000´100
100, ~ 1000000 BPS
· Based on actual time passed:
· 1PS : 1ime passed in 1est(ase ´ (N1 ´ 1000. i.e. a 1est(ase that has run íor 10 seconds hand
handled 100 request will get a 1PS oí 10
· BPS : Bvtes ´ 1ime passed ´ 1000. i.e. a 1est(ase that has run íor 10 seconds and handled
100000 bvtes will get a BPS oí 10000.
Please note the time-passed ·alue used is the time íor the entire 1est(ase. not each step íor itselí.
1his can bias the 1PS´BPS ·alues quite a lot íor those 1estSteps that take a small amount oí the
1est(ases total time
1he option to base on actual time passed can be useíul when setting a 1est(ase delav using the Simple
LoadStrategv. which will generallv gi·e a low a·erage. but the actual transactions per second will not be
equi·alentlv high since there is a delav,. Selecting this option will calculate 1PS using time-passed´cnt,
instead.
1 . 9 . 3 E X E C U T I O N
223
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: \eb Ser·ice 1est Assertions
1 . 9 . 3 E X E C U T I O N
224
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.9.4
Assertions
......................................................................................................................................
Web Service LoadTest Assertions
soapUI allows the creation oí an arbitrarv number oí Load1est Assertions íor a Load1est either írom the
Load1est Statistics Popup Menu or írom the "Load1est Assertions" tab at the bottom oí the Load1est
editor:
1he toolbar at the top oí the tab contains the íollowing actions leít-to-right,:
· Add Assertion - prompts to add and coníigure a new Load1est Assertion
· Remove Assertion - prompts to remo·e the currentlv selected assertion
· Assertion Options - shows the options íor the currentlv selected assertion
Below the toolbar a table containing the coníiguration assertions is shown with the íollowing columns:
· Name : the coníigured name oí the assertion
· Step : the target step íor the assertion
· Details : detailed iníormation on the assertion
A popup menu containing the same actions as in the toolbar is also a·ailable.
soapUI currentlv pro·ides the íollowing assertion tvpes:
Type Short Description
Step Maximum Asserts a steps max time
...........................................................................................................................................................................................
Step Status Asserts a steps status
...........................................................................................................................................................................................
Step TPS Asserts a steps TPS
...........................................................................................................................................................................................
Max Errors Asserts the total number of errors
...........................................................................................................................................................................................
Step Average Asserts a steps average
1 . 9 . 4 A S S E R T I O N S
225
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Step Maximum Assertion
1he Step Maximum assertion checks that a steps max time does not exceed a speciíied ·alue. It has the
íollowing settings:
· Name - the name oí the assertion
· Minimum Requests - the minimum number oí runs that must ha·e been executed beíore applving
this assertion. Use this íor a·oiding assertion errors during startup oí a Load1est
· Max 1ime - the maximum allowed step time. Ií this time is exceeded. an assertion error is logged to
the Load1est log
· Max Lrrors - the maximum number oí errors to allow beíore cancelling the Load1est
· 1estStep - the target step to assert. Selecting "- Anv -" will assert all steps. selecting "- 1otal -" will
assert the total time taken íor the entire 1est(ase run
Step Status Assertion
1he Step Status Assertion checks that a step has not íailed with an error. íor example a Request steps or a
Groo·v script step. It has the íollowing settings:
· Name - the name oí the assertion
1 . 9 . 4 A S S E R T I O N S
226
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Minimum Requests - the minimum number oí runs that must ha·e been executed beíore applving
this assertion. Use this íor a·oiding assertion errors during start up oí a Load1est
· Max Lrrors - the maximum number oí errors to allow beíore cancelling the Load1est
· 1estStep - the target step to assert. Selecting "- Anv -" will assert all steps
Step TPS Assertion
1he Step 1PS Assertion checks that a steps 1PS does not go below a speciíied ·alue. It has the íollowing
settings:
· Name - the name oí the assertion
· Minimum Requests - the minimum number oí runs that must ha·e been executed beíore applving
this assertion. Use this íor a·oiding assertion errors during start up oí a Load1est
· Minimum 1PS - the minimum required 1PS. Ií the actual 1PS is lower. an assertion error is logged
to the Load1est log
· Max Lrrors - the maximum number oí errors to allow beíore cancelling the Load1est
· 1estStep - the target step to assert. Selecting "- Anv -" will assert all steps. selecting "- 1otal -" will
assert the total 1PS íor the entire 1est(ase run
1 . 9 . 4 A S S E R T I O N S
227
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Max Errors Assertion
1he Max Lrrors Assertion checks that the total number oí errors íor a speciíied 1estStep does not
exceed a speciíied ·alue. It has the íollowing settings:
· Name - the name oí the assertion
· Max Absolute Lrrors - the absolute maximum allowed number oí errors íor the speciíied 1estStep
· Max Relative Lrrors - the relati·e maximum allowed number oí errors íor the speciíied 1estStep.
íor example 0.2 will assert that at most 20° oí the runs íor the speciíied 1estStep result in an error
· 1estStep - the target step to assert. Selecting "- Anv -" will assert all steps. selecting "- 1otal -" will
assert the total number oí errors íor the entire 1est(ase run
Step Average Assertion
1he Step A·erage Assertion checks that a steps a·erage does not go o·er a speciíied ·alue. It has the
íollowing settings:
· Name - the name oí the assertion
· Minmum Requests - the minimum number oí runs that must ha·e been executed beíore applving
this assertion. Use this íor a·oiding assertion errors during start up oí a Load1est
· Max Average - the maximum allowed a·erage. Ií the actual a·erage is higher. an assertion error is
logged to the Load1est log
· Max Lrrors - the maximum number oí errors to allow beíore cancelling the Load1est
· Sample Interval - the sample inter·al
· 1estStep - the target step to assert. Selecting "- Anv -" will assert all steps. selecting "- 1otal -" will
assert the total a·erage íor the entire 1est(ase run
1 . 9 . 4 A S S E R T I O N S
228
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: \eb Ser·ice Load 1est Diagrams
1 . 9 . 4 A S S E R T I O N S
229
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.9.5
Graphs
......................................................................................................................................
Diagrams
soapUI pro·ides 2 diagrams íor beha·ioral analvsis oí Load1est Statistics o·er time neither pro·ides anv
exact ·alues´legends,. 1hese are:
· A Statistics diagram showing all statistics íor a selected 1estStep
· A Statistic History diagram showing a selected Statistic íor all 1estSteps
Both diagrams share a "Resolution" setting which controls how oíten the diagram should be updated.
1his can be set either to "Data" or a number oí milliseconds:
· Data - means that the diagram will be updated whene·er the main Load1est Statistics are updated.
which in turn is controlled bv the "Sample Inter·al" setting in the Load1est Options dialog. 1his is
the deíault setting and suííicient ií vou ha·e a high throughput oí 1est(ase runs which will
constantlv update the Statistics. Ií vou ha·e a Load1est that has long-running 1est(ases. this option
will result in a diagram that updates ·erv inírequentlv which mav both be coníusing and not what is
desired.
· XXX - an inter·al in milliseconds. the diagram will be updated e·erv XXX ms regardless oí ií the
underlving Statistics ha·e changed or not.
Be aware oí the íact that all statistics íor these diagrams are alwavs collected internallv. i.e. vou can open
the diagram aíter running vour Load1ests and see the results. 1his is recommended as it does not take
anv períormance írom the UI during Load1esting.
The LoadTest Statistics Grapgh
1he statistics diagram shows a number oí statistics íor a selected 1estStep or the 1est(ase 1otal. 1he
toolbar at the top contains a combo-box íor selecting which step to displav and a button to the íar right
íor exporting the currentlv selected steps data to a comma separated íile.
1 . 9 . 5 G R A P H S
230
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
The Statistics History Graph
1he statistics historv diagram shows a selected statistic íor all 1estSteps in the 1est(ase. 1he toolbar at
the top contains a combo-box íor selecting which statistic to displav and a button to the íar right íor
exporting the currentlv selected statistics data to a comma separated íile.
Next: JMeter Load 1est (omparison
1 . 9 . 5 G R A P H S
231
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.9.6
JMeter comparison
......................................................................................................................................
JMeter and soapUI Performance Comparison
1his document aims mainlv to compare the results obtained with the popular JMeter tool írom Apache
with those obtained with soapUI and to show and discuss some oí the diííerences in the results obtained
with the 2 tools. Ií vou think or know we are doing something wrong in our tests or conclusions. don't
hesitate to contact us and we will trv to sort things out :-,
A íeature comparison will between the two tools will not be done in anv detail. generallv one could sav
that JMeter is much better at load-testing in general ie l11P. JDB(. JMS. etc. etc, while soapUI is
better at load-testing web ser·ices speciíicallv. Most things vou can do with soapUI can probablv be done
in JMeter. but since JMeter has a more "generic" approach to almost e·ervthing. it won't alwavs be as
"intuiti·e" as it is or at least should be, in soapUI. On the other hand. manv things that can be done in
JMeter are not possible in soapUI íor example distributed load testing,.
In general one can sav that Load 1esting \eb Ser·ices is extremelv diííicult since so manv íactors can
aííect the measured results: network latencv. host load. hardware. j·ms. etc... Both soapUI and JMeter
will be a "·ictim" to this. although soapUI has slightlv more options to control exactlv what and how
results are to be measured in the 1est(ase options dialog,.
Comparison Setup
1he setup íor the comparison is a simple request to a web ser·ice running locallv under an impro·ed
·ersion oí JBoss 4.0.3SP1 and running a slightlv modiíied sample \eb Ser·ice írom the jbossws 4.0.3
samples. A simple request will be run 5000 times under 4 diííerent loads: 1 thread. 5 threads. 10 threads
and 25 threads all using the simple Load 1est strategv with no delav. the 1est(ase Options are coníigured
to include onlv request write times. and will be run with and without closing connections aíter each
request.
1his is in JMeter is coníigured equi·alentlv using one 1hreadGroup with no ramp-up and ·arving the
loop count and number oí threads accordinglv: 1´5000. 5´1000. 10´500 and 25´200. 1he
"\ebSer·iceSOAP, Request" sampler is used and coníigured as shown below. An "Aggregate Report"
1 . 9 . 6 J M E T E R C O M P A R I S O N
232
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
listener is coníigured íor collecting the results.
Mv laptop is running \inXP SP2 on a Pentium M 1.8 with 1Gb oí RAM. JRL 1.5.0_06 is used íor
running JBoss. JMeter and soapUI.
Results
1he table shows the results. íor each test the a·erage and 1PS times are shown. , tests are run without
closing connections
Threads jmeter soapUI soapUI (*) soapUI cmdline
soapUI cmdline
(*)
1 8 ms, 105 TPS 6.78 ms, 147 TPS 10.7 ms, 94 TPS 5.75 ms, 174 TPS 10 ms, 99 TPS
...........................................................................................................................................................................................
5 43 ms, 110 TPS 38.7 ms, 128 TPS 23.7 ms, 211 TPS 30.4 ms, 164 TPS 24 ms, 210 TPS
...........................................................................................................................................................................................
10 86 ms, 112 TPS 82 ms, 122 TPS 46.5 ms, 215 TPS 61 ms, 164 TPS 38 ms, 262 TPS
...........................................................................................................................................................................................
25 214 ms, 114 TPS 204 ms, 123 TPS 124 ms, 202 TPS 159 ms, 157 TPS 95 ms, 263 TPS
1his can be plotted as íollows:
1 . 9 . 6 J M E T E R C O M P A R I S O N
233
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
As can be seen in the graph and numbers. soapUI consistentlv gi·es a higher 1PS ·alue than JMeter.
except when reusing connections and running onlv one thread. 1his mav be a bit surprising. e·identlv it is
íaster íor lttp(lient and the JVM to create new connections than to pool existing ones.
1he biggest diííerence between the two tools can be seen when switching to connection-reuse and
running írom the command-line. 1his is expected. connection reuse should ha·e a big impact when
running manv threads. and running írom the command-line uses no UI resources at all.
One could argue that closing connections aíter each request is a more realistic scenario íor web ser·ices
that ser·e a large number oí diííerent clients. íor example an online weather ser·ice. \eb Ser·ices
running internallv in a SOA mav be more likelv to ser·e a smaller number oí clients. so these could be
tested with connection reuse enabled.
Looking through the JMeter sources. it seems as ií JMeter uses l11P 1.0 and does not maintain anv
internal connection pool íor \eb Ser·ice requests. Also. it uses System.currentTimeMillis() íor
measuring elapsed time instead oí the System.nanoTime() íeature a·ailable in Ja·a 1.5 and used bv
soapUI.
Further Analysis
Since the abo·e results indicate an impro·ed result when reusing connections. I ran a Load1est in soapUI
using the "1hreads" strategv increasing the number oí threads írom 1 to 25 o·er a period oí 250 seconds.
both with and without connection reuse. 1he graphs below show the results:
lirst without connection reuse click on image íor íull-size,:
1 . 9 . 6 J M E T E R C O M P A R I S O N
234
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1his coníirms the pre·ious results: 1PS does not ·arv much when increasing the number oí threads. the
a·erage request time "takes" the entire increased load.
And then with connection reuse click on image íor íull-size,:
1he results here also coníirmed those abo·e: when reusing connections the 1PS ·alue increases steadilv
up to about 6 threads and then lies still. Also. one can see that the a·erage request time starts increasing
steadilv íirst when the 1PS has hit its peak. the a·erage then "takes" all the increased load just as when
not reusing connections at all.
1 . 9 . 6 J M E T E R C O M P A R I S O N
235
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Conclusion
1he ·alues obtained with soapUI are almost consistentlv "higher". ií this is better is a matter oí discussion.
One clear ad·antage oí soapUI seems to be the possibilitv to reuse connections. which also makes a big
diííerence when running manv threads ie simulating manv clients,.
Based on the abo·e results mv recommendation would thereíore be the íollowing:
· lor beha·ioural and íunctional load testing oí \eb Ser·ices: start with soapUI. mo·e to JMeter ií
vou need its "high proíile" íeatures.
· lor períormance load testing oí \eb Ser·ices: use soapUI in conjunction with another tool íor
example JMeter, and weigh the results!
Files
Ií vou want to run the tests vourselí. the íollowing íiles are a·ailable in Load 1est (omparison Zip :
File Description
comparison-soapui-project.xml soapUI project file containing all tests run in the comparison
...........................................................................................................................................................................................
soapui-compare.jmx jmeter project file containing all tests run in the comparison
...........................................................................................................................................................................................
ws4ee-samples-server-ejb.jar precompiled jar file containing tested Web Service, just drop this in
the JBoss 4.0.3 deploy folder and the above tests should run as
configured (you may need to change the endpoint)
\ou can download JBoss 4.0.3SP1 írom here . but vou can also use the 4.0.4R(2 release using the new
JBoss\S stack which gi·es slightlv diííerent results than those shown abo·e not shown here since this
comparison is not meant to compare jboss ·ersions,
Next: \eb Ser·ice Mocking
1 . 9 . 6 J M E T E R C O M P A R I S O N
236
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.10
Mocking
......................................................................................................................................
Web Service Mocking
In soapUI 1.¯ we introduced the possibilitv to create Mock Implementations. or \eb Ser·ice
Simulations. called "MockSer·ices", oí anv \eb Ser·ice írom its \SDL contract. A soapUI
MockSer·ice can expose an arbitrarv number oí operations " MockOperations ", írom diííerent \SDLs
which can íurther be coníigured quite extensi·elv in regard to which responses, " MockResponse ",
thev should return. including the possibilitv to create custom Groo·v scripts íor both dispatching and
response creation. MockSer·ices can be hosted´run either directlv in soapUI or ·ia the command line
MockSer·iceRunner and be in·oked írom anv client including soapUI itselí oí course, as usual.
Mocking oí \eb Ser·ices opens íor a number oí interesting usage scenarios:
· Client development or testing - create a MockSer·ice íor an existing contract that returns a number
oí predictable results which can be used bv client de·elopers´integrators during the de·elopment
phase.
· 1est Driven development from WSDL contract (both server and client) - Starting írom onlv a
\SDL. generate both client and ser·er stubs using anv oí the soapUI tool integrations, together
with a MockSer·ice which can be used to build entire íunctional 1estSuites in soapUI beíore the
actual ser·ice implementation is readv.
· Web Service rapid prototyping - Ouicklv create simple \SDL implementations íor disco·ering
optimal message exchanges. etc
· etc..
soapUI Pro íurther introduces a MockResponse 1estStep which can be added to anv íunctional 1est(ase
to simulate the handling oí a SOAP request as part oí the test. which opens oí testing oí asvnchronous
\eb Ser·ices. etc.
Next: Getting Started with Mock \eb Ser·ices
1 . 1 0 M O C K I N G
237
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.10.1
Getting Started
......................................................................................................................................
Getting Started with Web Service Mocking
In soapUI 1.¯ we introduced the possibilitv to create mock implementations oí operations and entire
ser·ices with a combination oí static response messages combined with Groo·v scripts. attachments and
custom http headers. 1his opens íor a number oí usage scenarios. including:
· Rapid \eb Ser·ices Prototvping: generate a complete static mock implementation írom a \SDL in
seconds and add dvnamic íunctionalitv using Groo·v.
· (lient testing´de·elopment: create mock implementations oí desired operations and set up a number
oí alternati·e responses including scripts. attachments and custom http headers,. (lients can be
de·eloped and tested without access to the "li·e" ser·ices. Responses can be cvcled. randomized or
selected with XPath expression írom incoming request
· 1est Dri·en De·elopment: (reate soapUI 1estSuites and 1est(ases against MockSer·ices beíore or
during the actual ser·ices being implemented
· etc...
In the íollowing example we will create a mock implementation oí an existing ser·ice. tailor the mock
response with some Groo·v and call the mock ser·ice írom within soapUI. Start bv creating a new
project íor the publiclv a·ailable (urrencv(on·erter at
http:´´www.webser·icex.net´(urrencv(on·ertor.asmx·\SDL
Create a MockService
Aíter importing. vou should get an interíace with one operation and request. Right-click the interíace and
select the "Generate MockSer·ice" menu option:
1his opens the íollowing dialog which lets vou speciív the local port´path íor the create ser·ice can oí
course be changed later..,:
Just lea·e the suggested ·alues. íor this and coming dialogs.. \hen the MockSer·ice has been created.
vou will get a new tree hierarchv similar to the the initial Interíace. but with graved icons... 1he
MockSer·ice contains a MockOperation corresponding to the operation in the original interíace and
soapUI has also created one MockResponse íor this operation írom its schema... Double click both the
MockSer·ice and "Response 1" tree nodes to open their corresponding editors. aíter some mo·ing or
resizing around vou should be able to arri·e at the íollowing:
1he MockSer·ice editor top leít, contains a toolbar. a list oí all operations íor the ser·ice and a
1 . 1 0 . 1 G E T T I N G S T A R T E D
238
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
request´response log which logs all incoming requests that ha·e been handled bv the MockSer·ice.
1he MockResponse editor is ·erv similar to the standard soapUI Request editor which can´will be
coníusing at íirst :-,. onlv the "íocus" has been shiíted to the response-tabs oí the editor. since this is
where the editing oí the mock response will be done. 1he "Incoming Request" tab´·iew shows the last
recei·ed request to the operation useíul íor debugging client calls,. including attachments and
http-headers.
Invoke the MockService from within soapUI
In the screen abo·e vou can see the deíault response that has been generated bv soapUI írom the
schema. Lets continue bv just in·oking this mock operation írom within soapUI:
1. (lick the green arrow button in the MockSer·ice editor... this will start the ser·ice on the coníigured
port´path which can also be seen in the log this has alreadv been done in the screenshot abo·e..,
2. In the MockResponse editor. select the leít-most button in the toolbar. which will prompt to open
one oí the existing requests íor the corresponding operation in vour project. \hen opening the
request. soapUI will automaticallv change its endpoint to the endpoint oí the now locallv running
MockSer·ice
3. Submit the opened request! Ií all goes well vou should get the pre·iouslv create MockResponse in the
request editors response window:
Switching back to the MockResponse editor and selecting its "Incoming Request" tab´·iew. vou should
be able to see the request that was posted to the MockSer·ice and handled bv the corresponding
MockOperation:
(ongratulations! lopeíullv all went well and vou now ha·e vour íirst MockSer·ice up and running... leel
íree to modiív the created MockResponse content and resubmitting the request to see that vour changes
are instantlv a·ailable no need to restart the MockSer·ice,
Customize the MockResponse
Let's continue bv making the created mock response a bit more dvnamic with a Groo·v script. Switch to
the "Response Script" tab in the MockResponse editor and enter the íollowing:
Go back to the Mock Response tab and change the response bodv to
Now. when submitting a request to this MockResponse. the script will be e·aluated and the generated
rate ·alue will be inserted into the outgoing response message:
OK... this should get vou started with vour íirst mock ser·ice... now vou can continue with:
· Adding some more responses to the MockOperation ·ia its right-button menu,. (hange the dispatch
method through the MockOperation Options dialog
· Add more dvnamic script beha·ior database or íile access. input processing. etc...,. attachments.
custom response http headers. etc...
1 . 1 0 . 1 G E T T I N G S T A R T E D
239
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Generate a web ser·ice client with one oí soapUI's tool integrations and call vour MockSer·ice írom
there to see what message the client actuallv sends and that it handles vour response correctlv,
· etc...
Next: Mock \eb Ser·ices
1 . 1 0 . 1 G E T T I N G S T A R T E D
240
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.10.2
Mock Services
......................................................................................................................................
Mock Web Services
MockSer·ices are displaved in the na·igator under their containing project node. 1hev can be created in a
number oí wavs:
1. lrom the Project popup menu with the "New MockSer·ice" action. (reates an emptv MockSer·ice
with no operations.
2. lrom an existing request bv selecting the "(reate MockResponse" toolbar button which will prompt
íor which MockSer·ice to add the selected requests operation and current response as a
MockResponse.
3. lrom the Interíace popup menu with the "Generate MockSer·ice" action. 1his will prompt as
íollows:
Aíter speciíving a path and port to listen on. soapUI will create a MockSer·ice with a MockOperation
corresponding to each oí the speciíied interíaces operation. Lach MockOperation will íurther be
coníigured with a deíault MockResponse which will be created írom the associated \SDL and
Schema deíinition in the same manner as when importing interíaces and creating requests.
1 . 1 0 . 2 M O C K S E R V I C E S
241
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Once created. an arbitrarv number oí MockOperations can be added to a MockSer·ice. there is no
requirement that all operations come írom the same interíace or that all operations írom an interíace be
mocked. Just mock those operations that are required.
MockService Actions
Right-clicking a MockSer·ice node in the na·igator shows a popup menu with the íollowing actions:
· Show MockService Lditor - opens the MockSer·ice Lditor. see below
· Start Minimized - opens´minimizes the MockSer·ice editor and starts the MockSer·ice
· Stop - stops the MockSer·ice
· New MockOperation - prompts to create a new MockOperation in the MockSer·ice
· Clone MockService - clones the entire MockSer·ice
· Add Lndpoint to Interface - prompts to add this MockSer·ices local endpoint to an Interíace in the
same project. 1he endpoint will be automaticallv updated ií it changed in the MockSer·ice Lditor.
· Rename - prompts to rename the MockSer·ice
· Remove - prompts to remo·e the MockSer·ice
· Online Help - displavs this page in an external browser
MockService Details Tab
1he bottom leít details tab íor a MockSer·ice displavs the íollowing properties:
· Name : the name oí the MockSer·ice
· Description : an arbitrarv description oí the MockSer·ice. displaved as a tooltip o·er the
MockSer·ices' node in the Na·igator.
· Path - the path this MockSer·ice listens on read onlv,
· Port - the port this MockSer·ice listens on read onlv,
· Match SOAP Version - controls ií incoming requests must match the SOAP Version oí a
corresponding MockOperation in a MockSer·ice.
· Require SOAP Action - controls ií incoming requests SOAPAction must match the SOAPAction oí
a corresponding MockOperation in a MockSer·ice.
· Dispache Response : enables dispatching oí request containing a Response Message instead oí a
request.
· Incoming WSS - the Incoming \SS coníiguration to use íor decrvpting incoming requests. 1his is
necessarv ií the entire bodv oí a message is encrvpted since it can not be dispatched otherwise.
· Default Outgoing WSS - the deíault Outgoing \SS coníiguration to applv to all MockResponses.
(an be o·er ridden on the MockResponse le·el.
1he 1est Properties tab contains the custom properties deíined íor this MockSer·ice
The MockService Editor
Double-clicking a MockSer·ice in the na·igator opens the MockSer·ice editor as seen to the right. lrom
the top down the editor has the íollowing parts:
1 . 1 0 . 2 M O C K S E R V I C E S
242
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
A 1oolbar with the íollowing options:
· Run - Starts the MockSer·ice on the coníigured path´port and waits íor requests see below,
· Stop - Stops a running MockSer·ice
· Open Interface - Opens an l1ML page with links to the currentlv published \SDL and its parts
see below,
· Options - Opens the MockSer·ice Options dialog see below,
· Help - Opens this page in a browser
1he list oí MockOperations currentlv coníigured íor this MockSer·ice. Right-clicking show the
MockOperations a·ailable actions. double-clicking opens the MockOperation editor
A rolling log oí handled requests with a toolbar with the íollowing options:
· Lnable - Lnables the MockSer·ice log
· Clear - (lears all entries írom the log
· Options - Prompts íor the maximum number oí entries to hold in the log. Keep this low as an entrv
can take up a íair amount oí memorv depending on message size. attachments. etc..,
Double-clicking on an entrv in the log displavs the entire message exhange íor that request as shown
below:
1 . 1 0 . 2 M O C K S E R V I C E S
243
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.10.2 MOCK SERVICES
244
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
MockService Inspectors
Below the list oí MockOperations there are 4 inspectors a·ailable leít to right,:
· Description : allows vou to enter an arbitrarv description íor the MockSer·ice
· Properties : manages custom properties íor the MockSer·ice
· Start Script : speciíies a Groo·v Script that should be run when starting the MockSer·ice. useíul íor
initializations. etc...
· Stop Script : speciíies a Groo·v Script to be run when stopping the MockSer·ice. useíul íor cleanup.
closing connections. etc..
MockService Options
1he MockSer·ice Options dialog has the íollowing options:
· Path - the local path to mount on
· Port - the port to listen on
· lost - the external IP oí the local machine used íor \SDL Publishing,
· lost Onlv - onlv bind to host IP instead oí all IP's
· Docroot - path to a local íolder that should be used to ser·e íiles íor GL1 requests to the
MockSer·ice path
1 . 1 0 . 2 M O C K S E R V I C E S
245
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· lault Operation - MockOperation to dispatch to ií a SOAP lault message is recei·ed bv the
MockSer·ice
MockService execution
\hen starting the MockSer·ice using the Run toolbar button. soapUI starts a local http ser·er ií not
alreadv running íor another MockSer·ice, as coníigured in the MockSer·ice Options dialog. 1his can be
seen in the soapUI-log as íollows:
SOAP Requests can now be issued to the ser·er írom anv client as ií it were a "real" \eb Ser·ice. the
incoming requests will be dispatched to the matching MockSer·ice ´ MockOperation which will íurther
dispatch as coníigured in Request Dispatching . \hile the MockSer·ice is running. it is still possible to
add´remo·e MockOperations. MockResponses. etc... 1he onlv ·alues that can not be changed are the
path and port oí the MockSer·ice. íor this it is required to íirst stop the MockSer·ice and then start it
again aíter changing as desired.
Ií an error occurs during request processing a SOAP lault will be returned. íor example in the íollowing
situation a request was issued írom within soapUI that could not be matched to anv a·ailable
1 . 1 0 . 2 M O C K S E R V I C E S
246
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
MockSer·ices MockOperation:
WSDL Publishing
\hen starting a MockSer·ice. the corresponding \SDL's and their reíerenced parts \SDLs and XSDs,
are made a·ailable ·ia a local web interíace. All includes´imports are rewritten to reíerences the correct
íiles. and the ser·ice port is changed to the one oí the MockSer·ice.
1he root page oí the MockLngine displavs a list oí running MockSer·ices:
Selecting a MockSer·ice displavs the Interíaces mocked bv it:
Selecting an interíace displavs the list oí parts in the Interíace:
1 . 1 0 . 2 M O C K S E R V I C E S
247
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
... and selecting a part displavs it in vour browser:
1he root \SDL part displaved íirst in the list oí parts, can be used to generate clients. etc..
As oí soapUI 2.5. it is possible to call the MockSer·ice path with "·\SDL" which will return the mocked
\SDL directlv. Ií multiple \SDLs are being mocked. soapUI automaticallv creates a \SDL that
imports these \SDLs instead.
Next: MockSer·ice (o·erage
1 . 1 0 . 2 M O C K S E R V I C E S
248
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.10.2.1
Coverage
......................................................................................................................................
MockService Coverage
\hen enabling (o·erage íor a MockSer·ice . soapUI will continuouslv accumulate and analvze mock
requests or responses and add their co·erage to the (o·erage Panel. 1his collects the íollowing 2
measurements:
· (lient (o·erage : how much oí the \SDL contract that vour client is actuallv submitting.
· Mock (o·erage : how much oí the contract vour Mock is actuallv mocking
\hen collecting co·erage íor a MockSer·ice. the (o·erage Panel contains the Interíace-related part oí
the (o·erage 1ree and the containing MockSer·ice and its MockOperations: under each MockOperation
the actual exchanged messages are shown.
As the onlv test tool in the world. soapUI Pro shows vou how much oí vour \eb Ser·ices vou ha·e
tested
1his will ensure vour test qualitv. 1rv it out and see how íun it is.
...........................................................................................................................................................................................
1 . 1 0 . 2 . 1 C O V E R A G E
249
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: Mock Operations
1 . 1 0 . 2 . 1 C O V E R A G E
250
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.10.3
Mock Operations
......................................................................................................................................
Web Service Mock Operations
A MockOperation is a simulation oí an operation in one oí the current projects interíaces and will
dispatch incoming requests ií thev match the operations SOAP Action and arguments. A MockOperation
contains a ·ariable number oí MockResponses that contain actual response messages to be returned to a
caller. Dispatching oí requests to a speciíic MockResponse can be done in a number oí wavs as described
below.
MockOperation Actions
Right clicking a MockOperation node in the na·igator or MockSer·ice editor shows a popup menu with
the íollowing actions:
· Open MockOperation Lditor - opens the MockOperation Lditor. see below
· Open Request - prompts to open an existing request íor the operation being mocked with the
endpoint set to the MockSer·ices endpoint. 1his is the preíerred wav oí quicklv testing a
MockSer·ice írom within soapUI aíter the MockSer·ice has been started.
· New MockResponse - prompts to add a new MockResponse to the MockOperation
· Change Operation - prompts to change the Interíace Operation mocked bv this MockOperation
see below,
· Rename - prompts to rename the MockOperation
· Remove - prompts to remo·e the MockOperation
· Online Help - displavs this page in an external browser
MockOperation Details Tab
1he bottom leít details tab íor a MockOperation displavs the íollowing properties:
· Name : the name oí the MockOperation
· Description : an arbitrarv description oí the MockOperation. displaved as a tool tip o·er the
MockOperations' node in the Na·igator.
· WSDL Operation - shows which Interíace Operation that is being mocked
· Dispatch Style - shows how incoming requests to this MockOperation are dispatched.
Change Operation
1his action prompts to change the Operation mocked bv this MockOperation with the íollowing dialog:
1 . 1 0 . 3 M O C K O P E R A T I O N S
251
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he dialog options are as íollows:
· Name - changes the name oí the MockOperation
· Interface - the interíace containing the operation to be mocked
· Operation - the operation to be mocked
· Recreate Responses - recreates all MockResponses contained in the MockOperation írom the new
operations schema.
· Create Optional - creates optional content when recreating responses
· Keep Lxisting - tries to keep existing element´attribute ·alues when recreating responses will onlv
work íor elements´attributes with same namespace´position in document
The MockOperation Editor
Double-clicking a MockOperation in the na·igator opens the MockOperation editor as seen below. lrom
the top down the editor has the íollowing parts:
A 1oolbar with the íollowing options:
· Add MockResponse - Prompts to add a new MockResponse to the MockOperation
· Open Request - prompts to open an existing request íor the operation being mocked as described
abo·e
· interface - 1he Interíace containing the operation to be mocked
· Operation - 1he operation to be mocked
· Help - Opens this page in a browser
1he list oí MockResponse currentlv coníigured íor this MockOperation. Right-clicking show the
MockResponses' a·ailable actions. double clicking opens the MockResponse editor
1 . 1 0 . 3 M O C K O P E R A T I O N S
252
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
A Dispatch 1oolbar and coníiguration are below whose content depends on the selected dispatch stvle
see below,
Request Dispatching
Incoming requests to a MockOperation can be dispatched in one oí 4 wavs using the dispatch combo
box:
· SLQULNCL - dispatches to the coníigured responses in sequence. starting írom the beginning
when the last has been reached.
· RANDOM - dispatches randomlv between existing MockResponses
· XPA1H - dispatches based on a speciíied XPath expression that will be used to select the name oí
the MockResponse step to dispatch to.
· SCRIP1 - allows a Groo·v script íor dispatching based on anv arbitrarv criteria
· QULRY_MA1CH - speciíies a number oí matching queries íor the request and their target
MockResponse see below,
Both the XPath and Script dispatch methods allow speciíication oí a deíault response to be returned ií
there is no matching response íor the XPath or script expression. \hen selecting XPath or Script. a
corresponding editor is shown below the dispatch toolbar where the XPath expression or Groo·v script
can be entered and tested. \hen running soapUI Pro. the XPath editor also includes a button íor the
1 . 1 0 . 3 M O C K O P E R A T I O N S
253
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
XPath Selector .
Query-Match Dispatching
1he OULR\_MA1(l dispatch option has the íollowing coníiguration panel:
1he list to the leít contains a list oí queries with a toolbar íor adding´remo·ing´etc these. Selecting a
querv item in the list enables the detail ·iew to the right íor the querv which contains the íollowing íields:
· XPath : the XPath expression to applv to a request to this MockOperation
· Lxpected ·alue : the ·alue to check íor
· Dispatch 1o : the MockResponse to dispatch to ií the expected ·alue matches that selected írom the
request
· Disabled : option to disable the item
1he toolbar on top oí the Detail area has the íollowing buttons:
'
· Deíine Namespaces : create namespace declarations írom the last recei·ed request
· Lxtract : applies the deíined XPath expression to the last request and sa·es the extracted ·alue to the
Lxpected Value íield
· Select... : Opens the soapUI Pro XPath Selector íor the last request and writes the selected nodes'
XPath to the XPath íield
Groovy Script Dispatching
Using Groo·v scripts as a controller to dispatch incoming is a ·erv ílexible wav oí creating
MockOperations. 1he script has access to the íollowing ·ariables:
1he script has access to the íollowing objects:
· log - a standard log4j Logger íor logging arbitrarv iníormation to the Groo·v log
1 . 1 0 . 3 M O C K O P E R A T I O N S
254
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· context - an instance oí MockRun(ontext that can hold dvnamicallv user-deíined properties. 1he
context is ser·ice scoped. i.e. shared between all MockOperations´MockResponses íor a
MockSer·ice during its liíetime. Since this object implements the Map interíace it can be accessed
using Groo·v`s built-in collection support see example screenshot abo·e,
· requestContext - an instance oí MockRun(ontext that can hold dvnamicallv user-deíined
properties. 1he context is request scoped. i.e. is onlv a·ailable during this request and not shared with
other MockOperations. Use this to pass ·alues írom the dispatch script to the handling
MockResponse. Since this object implements the Map interíace it can be accessed using Groo·v`s
built-in collection support see example screenshot abo·e,
· MockRequest - an instance oí \sdlMockRequest which pro·ides access to request-related objects.
including the underlving lttpSer·letRequest´lttpSer·letResponse objects
· MockOperation - an instance oí \sdlMockOperation which pro·ides access to the current
MockOperation object
1he script must return the name oí the MockResponse to dispatch to. i.e. the script shown in the
screenshot abo·e alwavs dispatches to a MockResponse named "Response 1"
Next: Mock Responsese
1 . 1 0 . 3 M O C K O P E R A T I O N S
255
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.10.4
Mock Responses
......................................................................................................................................
Mock Responses
A MockResponse is where vou send the simulated response írom the MockSer·ice. It holds an actual
response to returned írom a MockOperation. 1he response is ·erv poweríul and can be coníigured in
regards to response content. http headers. attachments and dvnamic processing using groo·v íor
example to process the input or read data írom some external source,.
MockResponses are added to a MockOperation írom their popup menu or írom the Request
popup´editor with the "Add to MockSer·ice" action´button.
MockResponse Actions
Right clicking a MockResponse node in the na·igator or in the MockOperation editor shows a popup
menu with the íollowing actions:
· Open MockResponse Lditor - opens the MockResponse Lditor. see below
· Open Request - prompts to open the editor íor an existing request íor this MockResponses
MockOperation with the correct local endpoint.
· Add to 1estCase - prompts to add a corresponding MockResponse Step to a 1est(ase
· Create 1estRequest - prompts íor 1est(ase where to create MockResponse 1estStep
· Clone - prompts to clone the MockResponse
· Rename - prompts to rename the MockResponse
· Remove - prompts to remo·e the MockResponse
· Online Help - displavs this page in an external browser
MockResponse Details Tab
1he bottom leít details tab íor a MockResponse displavs the íollowing properties:
· Name - the name oí the MockResponse
· Description - an arbitrarv description oí this MockResponse
· Message Size - shows the size oí the current response message content in characters,
· Lncoding - the encoding to use íor the content oí the MockResponse message.
· Outgoing WSS : the project-le·el Outgoing \SS coníiguration that should be applied to the
response
· Lnable M1OM/Inline - enables M1OM´Inline processing íor MockResponse messages in the
same wav as described íor Request Attachments
· Iorce M1OM - alwavs returns M1OM packaged responses. e·en ií there are no M1OM
1 . 1 0 . 4 M O C K R E S P O N S E S
256
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
attachments in response.
· Lnable Multiparts - enables multiparts in the same wav as described íor Multipart Attachments
· Lncode Attachments : 1ells soapUI to automaticallv encode attachments that ha·e a corresponding
\SDL part with the xsd-tvpe set to either base6Binarv or hexBinarv.
· Strip Whitespaces : Strips outgoing responses oí anv unnecessarv whitespaces and xml comments.
required bv some ser·ers.
· Remove Lmpty Content : Remo·es emptv elements´attributes írom outgoing responses.
· Lntitize Properties : Lntitize expanded propertv ·alues
· Response H11P-Status : read onlv, show http response status
· Response Delay : \aits the speciíied number oí milliseconds beíore returning the response.
· WS-Addressing : enables´disables ws-addressing.
The MockResponse Editor
Double-clicking a MockResponse in the na·igator or MockOperation editor opens the MockResponse
editor as seen below:
1his editor is more or less a copv oí the standard request editor. but shiíts íocus to the right-hand
response area where the MockResponse is coníigured. 1he leít hand request area shows the latest request
handled bv this MockResponse. including its l11P leaders and Attachments.
1he Response Area contains the same XML Source editor . l11P leaders tab and Attachments tab as
in the Request Lditor but now all editable,. Additionallv. a "Response Script" tab is a·ailable that
displavs a Groo·v script editor íor creating scripts that should be executed beíore returning the actual
response content see more below,.
MockResponse Editor Toolbar
1 . 1 0 . 4 M O C K R E S P O N S E S
257
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he toolbar at the top oí the MockResponse editor contains the íollowing actions leít to right,:
· Open Request - Opens a new or existing request that can be issued to this MockOperation when its
MockSer·ice is running. the request will ha·e the correct local endpoint set automaticallv.
· Recreate Response - Prompts to create a deíault response message írom the associated
\SDL´Schema deíinition
· Create Lmpty Response - Prompts to create an emptv SOAP response message
· Create SOAP Iault - Prompts to creates an emptv SOAP lault. ií the operation being mocked
deíines anv íaults. soapUI will prompt íor which oí these to generate en deíault detail element:
· 1oggle Layout - toggles between the a·ailable split´tab lavouts as described in Lditor Lavouts .
· Online Help - shows this document in an external browser.
Response Scripts
1he "Response Script" tab shows a standard Groo·v editor íor a script that will be executed prior to
returning the coníigured response message. opening íor the possibilitv to create response speciíic scripts
that can dvnamicallv create content oí the outgoing response.
1he script has access to the íollowing objects:
· log - a standard log4j Logger íor logging arbitrarv iníormation to the groo·v log
· context - an instance oí MockRun(ontext that can hold dvnamicallv user-deíined properties. 1he
context is ser·ice scoped. i.e. shared between all MockOperations´MockResponses íor a
MockSer·ice during its liíetime. Since this object implements the Map interíace it can be accessed
using Groo·v's built-in collection support see example screenshot abo·e,
· requestContext - an instance oí MockRun(ontext that can hold dvnamicallv user-deíined
properties. 1he context is request scoped. i.e. is onlv a·ailable during this request and not shared with
other MockOperations. Use this to pass ·alues írom the dispatch script to the handling
MockResponse. Since this object implements the Map interíace it can be accessed using Groo·v`s
built-in collection support.
1 . 1 0 . 4 M O C K R E S P O N S E S
258
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· mockRequest - an instance oí \sdlMockRequest which pro·ides access to request-related objects.
including the underlving lttpSer·letRequest´lttpSer·letResponse objects
· mockResponse - an instance oí \sdlMockResponse which pro·ides access to the current
MockResponse object íor example íor dvnamic manipulation oí attachments,
1he Run button in the script toolbar will attempt to run the script. setting the context to either the
currentlv a·ailable context ií the MockSer·ice is running, or an emptv one. 1he MockRequest will be set
to the last handled request ií a·ailable.
Properties set in the context can then be used using standard propertv expansion in the response. íor
example the íollowing script:
context.randomValue = Math.random()
creates a "randomValue" propertv which can then be "used" in the outgoing response:
<detail>${randomValue}</detail>
WS-A Properties
1he \S-A Inspector displavs properties used íor adding \S-A headers to a MockResponse according to
\S Addressing speciíication
Lnable \S-A Addressing Must understand indicates whether a header entrv is mandatorv or optional íor
the recipient to process. Add deíault \S-A:Action indicates ií bv deíault generated action is to be added
to request´mock response. Action - speciíies the ·alue oí the Action propertv. Ií not speciíied. and 'Add
deíault \S-A:Action is checked' . deíault action írom \SDL will be generated and added. Although
Action propertv is mandatorv bv \S-A core speciíication bv checking pre·ious check box and lea·ing
this emptv it is possible íor action propertv to be leít unspeciíied íor testing purposes. Add deíault
\S-A:1o indicates ií deíault 1o is to be added to request´mock response. 1o - OP1IONAL element
speciíies the ·alue oí the 1o propertv Relates1o- OP1IONAL element speciíies the ·alue oí the
Relates1o propertv. Ií not speciíied. and \S-A Settings see Preíerences , 'Use deíault Relates1o' is
checked . deíault ·alue oí 'http:´´www.w3.org´2005´08´addressing´unspeciíied' will be used.
Relationship1vpe- OP1IONAL element speciíies the ·alue oí the Relationship1vpe propertv. Ií not
speciíied. and \S-A Settings see Preíerences , 'Use deíault Relationship1vpe' is checked . deíault ·alue
oí 'http:´´www.w3.org´2005´08´addressing´replv' will be used. lrom - OP1IONAL element speciíies
the ·alue oí the lrom propertv lault1o - OP1IONAL element speciíies the ·alue oí the lault1o
propertv Replv1o - OP1IONAL element speciíies the ·alue oí the Replv1o propertv Generate
MessageID - indicates ií messageId should be randomlv generated MessageID - OP1IONAL element
speciíies the ·alue oí the MessageID propertv. Ií not speciíied. and pre·ious check box is checked .
random MessageID will be generated íor RequestResponse operation.
1 . 1 0 . 4 M O C K R E S P O N S E S
259
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: SOAP Monitor
1 . 1 0 . 4 M O C K R E S P O N S E S
260
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.11
SOAP Monitoring
......................................................................................................................................
SOAP Monitor
soapUI 2.0 adds poweríul SOAP Monitoring possibilities. allowing vou to capture and períorm SOAP
traííic analvsis between an existing client and ser·er. 1he captured traííic can be used to generate both
1est(ases and MockSer·ices. and soapUI Pro adds extremelv cool, (o·erage possibilities allowing vou
to monitor the actual utilization oí the monitored \SDL contracts,.
Start the SOAP Monitor írom the Project popup menu with the "Launch SOAP Monitor" action:
Speciív which port the monitor should listen on and which mode it should run in:
· Http Proxy : starts the monitor as an l11P Proxv. \hen selecting this option. coníigure the
monitors' host:port as the proxv íor the client vou want to monitor. Also. set proxv host:port in
global settings.
· H11P 1unnel : starts the monitor as a l11P 1unnel. point vour client directlv at the host:port oí
the monitor with the rest oí the URL intact. 1he "Add endpoint" option will add the created tunnels
endpoint to all interíaces in the project . íor easv redirection oí requests within soapUI. Also speciív
kev store. password. kev password. trust store and trust store password. Client key store and key
store password are used íor authetication on end point ser·er.
1 . 1 1 S O A P M O N I T O R I N G
1
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he Incoming Request´Response \SS settings are used to select the Incoming \SS coníigurations to
use íor decrvpting or ·alidating monitored messages. which can be useíul íor ·iewing encrvpted content
and ·alidating securitv
Reuse request state is used íor l11P attributes that mav persist írom request to request. such as cookies
and authentication credentials.
Main Window
1he SOAP Monitor is displaved with the íollowing window components top to bottom,:
· 1he main toolbar with options íor starting´stopping´re-coníiguring the SOAP Monitor
· 1he a·ailable monitor tabs "1raííic Log" and "(o·erage" in soapUI Pro,
· A traííic-log toolbar with actions to create requests. 1est(ases. MockSer·ices and clear the log
· A íilter bar íor íiltering out which requests to show in the traííic log
· 1he traííic log itselí containing rows íor captured messages
· A "Message (ontent" inspector that displavs the actual content oí the message selected in the table.
All standard request´response editor ·iews and inspectors are a·ailable
Once started. the monitor will displav captured messages as rows in the log table with their rele·ant data.
Requests that belong to Interíaces´Operations a·ailable in the containing project will automaticallv be
mapped to these and use underlving schema-iníormation in the message inspectors in the Message
(ontent ·iews:
1 . 1 1 S O A P M O N I T O R I N G
2
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Bv deíault. the log will keep the 100 most recent messages. this can be adjusted in the SOAP Monitor
options dialog a·ailable írom the top toolbar.
Using Captured Messages
1he 3 leít-most buttons in the traííic tables toolbar allow íor creation oí new items írom captures
messages:
· Create Requests : creates requests under their corresponding operations íor each selected request in
the traííic log
· Create 1estCase : prompts to create a 1est(ase or add to an existing one,. bv creating
1estRequests corresponding to the currentlv selected requests in the traííic log
· Create MockService : prompts to create a MockSer·ice or add to an existing one,. bv creating
MockOperations or MockResponses corresponding to the currentlv selected requests in the traííic
log
1he combination oí the last 2 can be used to record and simulate an entire con·eration between a client
and ser·er íor replaving. testing. etc..
Next: SOAP Monitor (o·erage
1 . 1 1 S O A P M O N I T O R I N G
3
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.11 SOAP MONITORING
4
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.11.1
Coverage
......................................................................................................................................
SOAP Monitor Coverage
\hen enabling \SDL (o·erage íor a SOAP Monitor. soapUI will continuouslv accumulate and analvze
monitored requests and add their co·erage to the (o·erage Panel. 1his can be used in manv situations.
íor example:
· Ií vou are running manual tests and want to see how much these co·er. vou can run these through a
SOAP Monitor and analvze the results.
· Ií vou want to see the actual utilization oí a contract in a testing or li·e en·ironment.
· etc...
\hen collecting co·erage íor a SOAP Monitor. the (o·erage Panel onlv contains the Interíace-related
part oí the (o·erage 1ree. since no 1estSuites´1est(ases are applicable during this analvsis:
Next: \eb Ser·ice 1est Usage Scenarios
1 . 1 1 . 1 C O V E R A G E
1
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
As the onlv test tool in the world. soapUI Pro shows vou how much oí vour \eb Ser·ices vou ha·e
tested
1his will ensure vour test qualitv. 1rv it out and see how íun it is.
...........................................................................................................................................................................................
1 . 1 1 . 1 C O V E R A G E
2
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.12
Usage Scenarios
......................................................................................................................................
Web Service Test Usage Scenarios
1his section describes some more complete soapUI usage scenarios. currentlv the íollowing are
described:
Scenario Description
Data Driven Web Service Testing Shows how to use a combination of TestSteps or Groovy Scripts to
allow test data (query parameters, username/password, etc) to be
provided from an external source
...........................................................................................................................................................................................
Template Driven Web Service Testing Extends Data Driven testing to show how to read a series for test
values from an external source and run the entire TestCase for each
row of values.
...........................................................................................................................................................................................
Interactive Testing Shows how to use Groovy scripts to create an input dialog for a
TestCase and for displaying the result.
...........................................................................................................................................................................................
Surveillance Testing Describes how to use a scheduling tool in conjunction with soapUI to
set up ongoing test processes that continuously validate functionality
and performance.
Ií vou ha·e anv suggestions or requests íor more scenarios please let us know!
Next: Data Dri·en \eb Ser·ice 1esting
1 . 1 2 U S A G E S C E N A R I O S
3
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.12.1
Data Driven Testing
......................................................................................................................................
Data Driven Web Service Testing in soapUI
Data Dri·en testing is useíul ií vou want to pro·ide input íor a test írom an external source. íor example
írom a database or properties íile. 1his document will outline a standard approach with a complete
example.
A simple approach to Data-Dri·en 1esting in a 1est(ase is the íollowing:
· (reate the Request steps vou want to be data dri·en
· (reate a Properties Step and deíine the properties vou will read írom some external source
· (reate a Propertv 1ransíer Step that transíers these properties to their destination steps
· Now vou need to speciív the actual reading oí the external properties. the easiest is to speciív in the
"Properties Step" which source properties íile to read írom. A more ílexible approach is to create a
proceeding Groo·v Step that reads the properties írom some source and assigns them to the
Properties Step. Both these approaches will be shown below
Below íollows a complete example oí the abo·e using the Amazon Search Ser·ice and speciíving the
author and subscriptionId externallv íor a book search. \ou need to create a project and import the
Amazon \SDL
http:´´webser·ices.amazon.com´A\SL(ommerceSer·ice´A\SL(ommerceSer·ice.wsdl, beíore
digging in..
Create The TestCase and TestRequest
(reate a new 1est(ase and add a new Request Step containing the íollowing request:
<soapenv:Envelope
xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2006-02-15"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:ItemSearch>
<ns:SubscriptionId>?</ns:SubscriptionId>
<ns:Request>
<ns:SearchIndex>Books</ns:SearchIndex>
<ns:Author>?</ns:Author>
</ns:Request>
</ns:ItemSearch>
</soapenv:Body>
</soapenv:Envelope>
Add a "Schema (ompliance" Assertion to ·alidate the response and a "SOAP lault" Assertion to catch
unexpected errors.
1 . 1 2 . 1 D A T A D R I V E N T E S T I N G
4
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Create Properties and Property Transfer
Insert a "Propertv Step" and add 2 properties named "SubscriptionID" and "Author" and gi·e them
some deíault ·alue. Aíter that insert a "Propertv 1ransíer" step and deíine 2 transíers each transíerring
the respecti·e propertv to the target request. \ou should now ha·e something like the íollowing setup:
Ií vou select the "Run" button in the Propertv 1ransíer Lditor and open the Request editor íor the search
request vou should see something like the íollowing:
1 . 1 2 . 1 D A T A D R I V E N T E S T I N G
5
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
the deíault ·alues oí the properties ha·e been transíerred to the request,
Reading the properties from an external properties file
Ií vou ha·e a standard properties íile containing the input vou want to use. speciív its name in the
Propertv Step Lditors source íile íield. In this example we will create a íile in the current directorv
containing the íollowing:
SubscriptionID=.. your subscription id ..
Author=Douglas Coupland
Sa·e this to a "test-input.properties" íile and speciív that íile in the Propertv Step Lditor:
\ou're all set! Open the 1est(ase editor and run the 1est(ase and open the Request Lditor to see the
1 . 1 2 . 1 D A T A D R I V E N T E S T I N G
6
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
results:
Setting the properties with Groovy
Instead oí reading the properties írom a properties íile we mav need to get them "somewhere else". íor
example írom a database. 1he Groo·v Script step will pro·ide anv ílexibilitv vou mav need in this regard..
here we will just create a Groo·v Step that "manuallv" reads the same properties íile as created abo·e.
Begin bv inserting a Groo·v Script step in the beginning oí the 1est(ase and opening the Groo·v Script
Lditor. Lnter the íollowing script:
// init properties
def props = new Properties();
props.load( new FileInputStream( "test-input.properties" ));
// get target step
def step = testRunner.testCase.getTestStepByName( "Properties" );
// assign all properties
def names = props.propertyNames();
while( names.hasMoreElements() )
{
def name = names.nextElement();
step.setPropertyValue( name, props.getProperty( name ));
}
1he script reads the properties íile and assigns all its contained properties to the target "Properties" Step.
\hen running this vou should get the exact same result as abo·e:
1 . 1 2 . 1 D A T A D R I V E N T E S T I N G
7
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: 1emplate Dri·en \eb Ser·ice 1esting
1 . 1 2 . 1 D A T A D R I V E N T E S T I N G
8
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.12.2
Template Driven Testing
......................................................................................................................................
Template Driven Testing
1emplate Dri·en testing is an extension to Data Dri·en testing where the same 1est(ase is run íor a
·ariable number oí input ·alues read írom some external source. 1he example gi·en here extends the
Data Dri·en 1esting example to read a list oí authors and their expected minimum books írom a text íile
and then run the 1est(ase íor each author and ·alidate the number oí books íound.
1o achie·e this. we need to extend and modiív the Data Dri·en example as íollows:
· (reate an initial Groo·v step that reads the external ·alues and stores them in the current
1estRun(ontext together with an index telling which author is currentlv tested
· (reate another Groo·v step that assigns a set oí ·alues to the Properties Step íor each 1est(ase run
· (reate a Groo·v step at the end oí the 1est(ase that checks the number oí hits and loops back to the
beginning ií there are more test ·alues to test
lere we go!
Read external values
1he íollowing example script reads all lines oí the "testdata.txt" íile into a list stored in the
1estRun(ontext. Lach line contains an author name and a number oí minimum hits separated bv a
comma. íor example "King.230"
def list = []
new File( "testdata.txt" ).eachLine { line -> list.add( line ) }
log.info( "Read " + list.size() + " test values.." )
context.setProperty( "values", list )
context.setProperty( "index", 0 )
Aíter reading the íile into the list. it is stored in the 1estRun(ontext together with an index telling which
"row" is currentlv tested
Init properties with test values
1his script reads the current row and assigns that rows author to the Properties Steps "Author" propertv
def values = context.getProperty( "values" )
def index = context.getProperty( "index" );
def str = values[index]
1 . 1 2 . 2 T E M P L A T E D R I V E N T E S T I N G
9
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
def ix = str.indexOf( "," )
def author = str.substring( 0, ix )
def props = testRunner.testCase.getTestStepByName( "Properties" )
props.setPropertyValue( "Author", author )
log.info( "set author to [" + author + "]" )
Aíter this. the pre·iouslv a·ailable Propertv 1ransíers and Requests are run as coníigured:
· 1he íirst transíer copies the author and subscription id to the search request
· 1he request períorms the book search
· 1he second transíer copies the number oí hits to the "Result(ount" propertv
Validate and move to next
1his step checks the number oí hits against the pro·ided text ·alue and íails ií the number oí hits is not
suííicient. Otherwise. the script ad·ances the test index to the next row and loops back ií that row exists
def values = context.getProperty( "values" )
def index = context.getProperty( "index" );
def str = values[index]
def ix = str.indexOf( "," )
def props = testRunner.testCase.getTestStepByName( "Properties" )
def resultCount = props.getPropertyValue( "ResultCount" )
def count = str.substring( ix+1 )
def author = props.getPropertyValue( "Author" )
if( count > resultCount )
{
throw new Exception( "not enough hits for author [" + author +
"], expected " + count + ", got " + resultCount )
}
else
{
log.info "got " + resultCount + " hits for [" + author + "], required " + count
if( ++index < values.size() )
{
context.setProperty( "index", index )
testRunner.gotoStepByName( "Init Run" )
}
else
{
log.info "Finished TestCase, tested " + values.size() + " values"
}
}
Running the TestCase
1 . 1 2 . 2 T E M P L A T E D R I V E N T E S T I N G
10
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
and running it with the íollowing
testdata.txt
coupland,150
king,150
shakespeare,150
shows the íollowing result in the Groo·v log:
1 . 1 2 . 2 T E M P L A T E D R I V E N T E S T I N G
11
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he íollowing image shows a simple Load1est which ran the 1est(ase 5 times. as vou can see each step
in the loop was called 15 times in total. i.e. once íor each test ·alue
Next: Interacti·e \eb Ser·ice 1esting
1 . 1 2 . 2 T E M P L A T E D R I V E N T E S T I N G
12
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.12.2 TEMPLATE DRIVEN TESTING
13
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.12.3
Interactive Testing
......................................................................................................................................
Interactive Web Service Testing
Using the Groo·v 1estStep. it is possible to create both input and output dialogs. which can be useíul ií
vou íor example want to make it easv to run vour tests with user-supplied in data or ií vou want to
pro·ide a soapUI project containing 1est(ases as demonstrations oí vour web ser·ices íor vour clients.
In this example we will create a 1est(ase that períorms an Amazon Book search on Author and displavs
the number oí hits. \e need the íollowing 1estSteps:
· A Properties Step to hold global properties
· A Groo·v Step íor showing an input dialog
· A Propertv 1ransíer that transíers the input ·alue to the search request
· A Request Step that períorms the search
· A Propertv 1ransíer that gets the result to a global propertv
· A Groo·v Step íor displaving the result
Properties
1he íollowing properties will be deíined:
· Author : holds the author entered bv the user
· SubscriptionID : holds the Amazon subscription id
· ResultCount : holds the result count íor displav
1 . 1 2 . 3 I N T E R A C T I V E T E S T I N G
14
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Groovy Input
1he íollowing script will be used to ask the user íor the author to search on:
// create dialog
def dialog = com.eviware.soapui.support.UISupport.createConfigurationDialog( "Amazon
Query" );
dialog.addTextField( "Author", "The Author to search on" );
// init values and show
def map = new java.util.HashMap();
map.put( "Author", "" );
if( dialog.show( map ))
{
// get target step
def step = testRunner.testCase.getTestStepByName( "Properties" );
// assign
step.setPropertyValue( "Author", map.get( "Author" ));
}
else testRunner.cancel( "No author to search on!" );
\hen running the script. the user will be prompted with a dialog and the entered ·alue will be set in the
Global Properties Step.
Search Args Transfer
1he Search Args 1ransíer contains 2 propertv transíers. one íor the SubscriptionID and one íor the
Author propertv. Lach is transíerred írom the Global Properties step to the Search Request using an
XPath expression. lor the SubscriptionID this is:
declare namespace ns='http://webservices.amazon.com/AWSECommerceService/2006-03-08';
//ns:SubscriptionId/text()
1 . 1 2 . 3 I N T E R A C T I V E T E S T I N G
15
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
and íor the Author it is
declare namespace ns='http://webservices.amazon.com/AWSECommerceService/2006-03-08';
//ns:Author/text()
See the íollowing Request Step to see the target XML,
Using Property Replacement
As oí soapUI 1.6. it is possible to use the common ${propertyName} to expand properties as
described in Propertv Lxpansion . Using this íeature we can remo·e the "Search Args 1ransíer" step and
instead use the íollowing request:
<ns:ItemSearch>
<ns:SubscriptionId>${SubscriptionId}</ns:SubscriptionId>
<ns:Request>
<ns:SearchIndex>Books</ns:SearchIndex>
<ns:Author>${Author}</ns:Author>
</ns:Request>
</ns:ItemSearch>
1his will result in the ·alues íor SubscriptionId and Author being copies into the request just beíore it is
sent the inserted ·alues will not be written into the request seen in the editor,.
Search Request
1he íollowing search request will be used:
<soapenv:Envelope
xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2006-03-08"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:ItemSearch>
<ns:SubscriptionId>?</ns:SubscriptionId>
1 . 1 2 . 3 I N T E R A C T I V E T E S T I N G
16
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
<ns:Request>
<ns:SearchIndex>Books</ns:SearchIndex>
<ns:Author>?</ns:Author>
</ns:Request>
</ns:ItemSearch>
</soapenv:Body>
</soapenv:Envelope>
Result Transfer
1his step extracts the number oí hits in the result and transíers it to the Global Properties "Result(ount"
propertv using the íollowing XPath expression:
declare namespace
ns1='http://webservices.amazon.com/AWSECommerceService/2006-03-08';
//ns1:TotalResults/text()
Groovy Display Result
1he íollowing script will be used to displav the result:
// get target step
def step = testRunner.testCase.getTestStepByName( "Properties" );
com.eviware.soapui.support.UISupport.showInfoMessage(
"Got " + step.getPropertyValue( "ResultCount" ) + " hits for author [" +
step.getPropertyValue( "Author" ) + "]" );
Running the TestCase
Running the 1est(ase produces the íollowing input dialog:
1 . 1 2 . 3 I N T E R A C T I V E T E S T I N G
17
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
and shows the íollowing result:
1 . 1 2 . 3 I N T E R A C T I V E T E S T I N G
18
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Summary
1he example abo·e is ·erv simple but shows the possibilities. creating more complex UI's and ílows is
deíinitelv possible. but mavbe questionable as soapUI is not vet·, a BPLL tool and has been created íor
other purposes. But then again... ií it works and helps vou out... :-,
Next: \eb Ser·ice Sur·eillance 1esting
1 . 1 2 . 3 I N T E R A C T I V E T E S T I N G
19
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.12.4
Surveillance Testing
......................................................................................................................................
Surveillance Testing for Web Services
Sur·eillance testing is here used to describe a setup where a number oí both íunctional and load tests are
run using some kind oí scheduling tool to continuouslv ·alidate the a·ailabilitv to some web ser·ice. I this
example. we will use the Open Source LuntBuild tool íor setting up both íunctional and load test to be
run regularlv and ·alidated. A notiíication will be sent ií anv oí the tests íail.
Creating the tests
1he tests used in the sample will test one oí the apps included in with JBoss\S the JBoss web-ser·ice
stack,. 1hev consist oí:
· A "get(ontactInío" 1est(ase which ·alidates that the response returned bv a random input ·alue
contains that ·alue back. 1he ·alue is generated and ·alidated using 2 Groo·v steps.
· A number oí Load1ests named Load1estXX. where XX is the number oí threads. each ·alidating
that the 1PS ·alue ne·er goes under 100. 1he Load1ests use the Simple Strategv with no delav and
both run íor 5000 requests.
1he image to the right shows this setup in the na·igator
1 . 1 2 . 4 S U R V E I L L A N C E T E S T I N G
20
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Running Surveillance Test from the command line
Beíore we automate the running oí the tests using LuntBuild. let's just check that thev run ok írom the
command line. \e will use the command-line runners in this example. let's start bv running the
íunctional 1est(ase írom within the íolder where the soapUI project íile is located:
testrunner.bat "C:\Documents and Settings\ole.matzura\My
Documents\jbossws-soapui-project.xml"
-s"Organization Tests" -c"getContactInfo Test" -r
1his produces the íollowing output:
SoapUI SNAPSHOT TestCase Runner
10:47:36,703 INFO [SoapUITestCaseRunner] setting projectFile to [C:\Documents and
Settings\ole.matzura\My Documents\jbossws-soapui-project.xml]
10:47:36,703 INFO [SoapUITestCaseRunner] setting testSuite to [Organization Tests]
10:47:36,703 INFO [SoapUITestCaseRunner] setting testCase to [getContactInfo Test]
10:47:37,284 INFO [WsdlProject] Loaded project from [C:\Documents and
Settings\ole.matzura\My Documents\jbossws-soapui-project.xml]
10:47:38,616 INFO [SoapUITestCaseRunner] Running soapui tests in project [jbossws]
10:47:38,616 INFO [SoapUITestCaseRunner] Running soapui suite [Organization Tests],
runType = SEQUENTIAL
10:47:38,626 INFO [SoapUITestCaseRunner] Running soapui testcase [getContactInfo
Test]
10:47:38,636 INFO [SoapUITestCaseRunner] runing step [Groovy Script - init boss]
1 . 1 2 . 4 S U R V E I L L A N C E T E S T I N G
21
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
10:47:39,176 INFO [SoapUITestCaseRunner] runing step [Properties]
10:47:39,176 INFO [SoapUITestCaseRunner] runing step [Transfer Values - set boss]
10:47:39,557 INFO [SoapUITestCaseRunner] runing step [request step]
Retrieving document at
'http://lpt-olma:8080/ws4ee-samples-server-ejb/Organization?wsdl'.
10:47:40,398 INFO [SchemaUtils] Loading schema types from
[http://lpt-olma:8080/ws4ee-samples-server-ejb/Organization?wsdl]
10:47:40,398 INFO [SchemaUtils] Getting schema
http://lpt-olma:8080/ws4ee-samples-server-ejb/Organization?wsdl
10:47:40,568 INFO [SoapUITestCaseRunner] Assertion [Schema Compliance] has status
VALID
10:47:40,568 INFO [SoapUITestCaseRunner] runing step [Groovy Script]
10:47:40,689 INFO [log] boss name matched [testsd1143708459106]
10:47:40,689 INFO [SoapUITestCaseRunner] Finished running soapui testcase
[getContactInfo Test], time taken: 1065ms, status: FINISHED
10:47:40,689 INFO [SoapUITestCaseRunner] Skipping testcase [getContactInfo
LoadTests], filter is [getContactInfo Test]
10:47:40,689 INFO [SoapUITestCaseRunner] soapui suite [Organization Tests] finished
in 2073ms
SoapUI SNAPSHOT TestCaseRunner Summary
-----------------------------
Time Taken: 2070ms
Total TestSuites: 1
Total TestCases: 1
Total TestSteps: 5
Total Request Assertions: 1
Total Failed Assertions: 0
Total Exported Results: 0
Likewise. running the Load1ests is done as íollows:
loadtestrunner.bat "C:\Documents and Settings\ole.matzura\My
Documents\jbossws-soapui-project.xml"
-s"Organization Tests" -c"getContactInfo LoadTests" -r
Producing the íollowing:
SoapUI 1.5beta2 LoadTestRunner
21:16:07,912 INFO [SoapUILoadTestRunner] setting projectFile to [C:\Documents and
Settings\ole.matzura\My Documents\j..
21:16:07,932 INFO [SoapUILoadTestRunner] setting testSuite to [Organization Tests]
21:16:07,942 INFO [SoapUILoadTestRunner] setting testCase to [getContactInfo
LoadTests]
21:16:09,134 INFO [WsdlProject] Loaded project from [C:\Documents and
Settings\ole.matzura\My Documents\jbossws-soapu
21:16:11,458 INFO [SoapUILoadTestRunner] Skipping testcase [getContactInfo Test],
filter is [getContactInfo LoadTests
21:16:11,458 INFO [SoapUILoadTestRunner] Running LoadTest [LoadTest10]
21:16:11,848 INFO [SoapUILoadTestRunner] LoadTest [LoadTest10] progress: 0.0
21:16:12,850 INFO [SoapUILoadTestRunner] LoadTest [LoadTest10] progress: 0.0144
.. etc ..
21:16:54,399 INFO [SoapUILoadTestRunner] LoadTest [LoadTest10] progress: 0.9452
21:16:55,391 INFO [SoapUILoadTestRunner] LoadTest [LoadTest10] progress: 0.9744
21:16:56,392 INFO [SoapUILoadTestRunner] LoadTest [LoadTest10] finished with status
FINISHED
21:16:56,392 INFO [SoapUILoadTestRunner] Exporting log and statistics for LoadTest
1 . 1 2 . 4 S U R V E I L L A N C E T E S T I N G
22
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
[LoadTest10]
21:16:56,512 INFO [SoapUILoadTestRunner] Exported 1 log items to
[LoadTest10-log.txt]
21:16:56,512 INFO [SoapUILoadTestRunner] Exported 0 error results
21:16:56,512 INFO [SoapUILoadTestRunner] Exported 2 statistics to
[LoadTest10-statistics.txt]
21:16:56,602 INFO [SoapUILoadTestRunner] Running LoadTest [LoadTest25]
21:16:57,113 INFO [SoapUILoadTestRunner] LoadTest [LoadTest25] progress: 0.0046
21:16:58,135 INFO [SoapUILoadTestRunner] LoadTest [LoadTest25] progress: 0.0348
.. etc ..
21:17:37,742 INFO [SoapUILoadTestRunner] LoadTest [LoadTest25] progress: 0.9506
21:17:38,773 INFO [SoapUILoadTestRunner] LoadTest [LoadTest25] progress: 0.9748
21:17:39,845 INFO [SoapUILoadTestRunner] LoadTest [LoadTest25] finished with status
FINISHED
21:17:39,865 INFO [SoapUILoadTestRunner] Exporting log and statistics for LoadTest
[LoadTest25]
21:17:40,095 INFO [SoapUILoadTestRunner] Exported 1 log items to
[LoadTest25-log.txt]
21:17:40,095 INFO [SoapUILoadTestRunner] Exported 0 error results
21:17:40,095 INFO [SoapUILoadTestRunner] Exported 2 statistics to
[LoadTest25-statistics.txt]
21:17:40,105 INFO [SoapUILoadTestRunner] soapui suite [Organization Tests] finished
in 88647ms
Setting up the Luntbuild Project
Download and install luntbuild írom the Sourcelorge site. Once vou ha·e it "íigured out" and running.
do the íollowing:
Login to luntbuild and create a new project:
(reate an emptv V(S lile Svstem Adapter we will host the soapUI project íile íor our tests locallv in this
example. better would oí course be to ha·e them in a ·ersion-control svstem,:
1 . 1 2 . 4 S U R V E I L L A N C E T E S T I N G
23
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
(reate one builder íor each testRunner. set the build command to the entire command line in·ocation oí
one oí the soapUI testRunners preíixed with "cmd.exe ´(". Remember to set the directorv to the
soapui´bin directorv.
(reate one schedule íor each builder and schedule accordinglv in the example below the trigger is set to
manual but should be set to some more repetiti·e timing,
1 . 1 2 . 4 S U R V E I L L A N C E T E S T I N G
24
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Run the Surveillance Tests
Go back to the main page and run the íirst schedule press the green arrow to the right oí the schedule
and select "Sa·e" at the bottom oí the run page,:
1 . 1 2 . 4 S U R V E I L L A N C E T E S T I N G
25
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
(lick on the schedules Latest Build and into the 1estSteps directorv since we added the -í option in our
builder the output 1estStep results are written to that íolder,:
1o ·iew the entire output written to svstem.out select the "build log" link on the top right:
Go back to the main page and run the second schedule and click on its Latest Build. the created statistics
will be in the output íolder:
1 . 1 2 . 4 S U R V E I L L A N C E T E S T I N G
26
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
(lick on one oí the statistics íiles to see its contents:
Request Step,min,max,avg,last,cnt,tps,bytes,bps,err
request step,3,1189,95.25,76,5000,262.45,2160000,84454,0
Total:,3,1189,95.25,76,5000,262.45,2160000,84454,0
Summary
1he abo·e shows rather quicklv how to set up a complete (ontinuous 1esting en·ironment which can be
used íor sur·eillance testing oí \eb Ser·ices... plav around with the abo·e and add schedules. more tests.
notiíications. etc to get the setup that vou want.
Next: \eb Ser·ice (ode 1ool Integrations
1 . 1 2 . 4 S U R V E I L L A N C E T E S T I N G
27
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.13
Tool Integrations
......................................................................................................................................
Tool Integrations
soapUI pro·ides integrated support íor a number oí Open Source \eb Ser·ice 1ool Kits and utilities.
including:
1. Code Generation 1ools allow generation oí client or implementation artiíacts írom an existing
\SDL deíinition in a soapUI project.
2. WS-I 1ools integrates \S-I Basic Proíile ·alidation tools into soapUI
3. Apache 1cpMon pro·ides 1(P traííic monitoring íunctionalitv
Ií vou would like us to integrate anv other tools AJAX. PlP. etc...,. don`t hesitate to send us a link to the
documentation íor the command line utilitv that should be in·oked together with some examples and we
will consider integrating the tool íor vou.
Configuration
Beíore anv oí the integrations can be used. the respecti·e tools need to be installed separatelv thev are
not bundled with soapUI, and their location coníigured on the "Integrated 1ools" tab in the soapUI
preíerences:
1 . 1 3 T O O L I N T E G R A T I O N S
28
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
the image shows possible coníiguration ·alues íor all integrations,
Next: (ode Generation 1ools íor \eb Ser·ices
1 . 1 3 T O O L I N T E G R A T I O N S
29
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.13.1
Code Generation
......................................................................................................................................
Code Generation Tools for Web Services
1he íollowing code generation tools ha·e currentlv been integrated and are a·ailable írom the main 1ools
menu or íorm the Interíace right-button menu: JBoss\S \S1ools . JBoss\S \S(onsume . JAX-RP( .
JAX-\S . Axis 1.X . Axis 2 . (Xl 2.X . Xlire 1.X . Oracle wsa . XmlBeans 2.X . JAXB 2.X . GSoap 2.X
and .NL1 2.0 .
Lach integration has a number oí tabs íor coníiguring the corresponding tools options and adding
arbitrarv command line arguments. Ií the tool is in·oked írom the Interíace menu. rele·ant ·alues will be
pre entered into the dialogs \SDL URL. Namespaces. etc., and the integrations remember their
settings. making it easv to rerun the desired tools ií changes are made to the external sources or \SDLs.
Ií the \SDL íor the current interíace has been cached. an option will be a·ailable íor using either the
cached \SDL or the "online" \SDL. Ií selecting to use the cached \SDL. soapUI will íirst export the
\SDL to a temporarv directorv and speciív this location as the \SDL path.
1 . 1 3 . 1 C O D E G E N E R A T I O N
30
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Custom Arguments for Code Generation
All integrations ha·e a "(ustom args" tab allowing the speciíication oí custom arguments to the in·oked
tools,. íor example those that are not supported bv soapUI in intermediate ·ersions beíore we catch up
:-,. 1he íollowing dialog íor the Xlire integration allows both custom args to ja·a and to the \sGen tool
itselí:
Running a tool
Once the tool is coníigured as required bv its dialog. a "Generate" option will open a separate window
showing the input or output oí the in·oked tools process. During the process execution a "(ancel"
button will be a·ailable íor canceling the ongoing process. otherwise a success´error message will be
shown when the tool is íinished. 1he log window will be a·ailable until it is closed allowing detailed
·iewing oí the process output íor debugging purposes...,. 1he íollowing image shows the process runner
window aíter a successíul in·ocation to the J\SDP \S(ompile tool:
1 . 1 3 . 1 C O D E G E N E R A T I O N
31
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
JBossWS WSTools Integration
Tool Version(s) Documentation Installation / Usage
JBossWS wstools versions 1.0.X JBossWS User Guide Install the latest JBossWS stack
and install/configure as required.
Specify the directory containing
the wstools script in the Tool
Integrations settings dialog. The
dialog has a "Show Config"
button that displays the wstools
config file generated for the
current settings.
JBossWS WSConsume Integration
Tool Version(s) Documentation Installation / Usage
JBossWS wstools versions 1.0.X JBossWS User Guide Install the latest JBossWS 1.2 or
newer stack and install/configure
as required. Specify the directory
containing the WSTools script in
the Tool Integrations settings
dialog. The dialog has a "Show
Config" button that displays the
WSTools config file generated for
the current settings.
JWSDP JAX-RPC/wscompile Integration
1 . 1 3 . 1 C O D E G E N E R A T I O N
32
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Tool Version(s) Documentation Installation / Usage
JWSDP JAX-RPC / WSCompile ,
tested with versions 1.6 and 2.0
tested with versions 1.6 and 2.0 WSCompile Install the desired JWSDP
version and install/configure as
required. Specify the directory
containing the WSCompile script
in the Tool Integrations settings
dialog.
JWSDP JAX-WS WSImport
Tool Version(s) Documentation Installation / Usage
JWSDP JAX-WS / WSImport ,
tested with versions 1.6 and 2.0
tested with versions 1.6 and 2.0 WSImport Install the desired JWSDP
version and specify the jaxWS /
bin directory in the soapUI Tool
Integrations settings
Apache Axis 1.X
Tool Version(s) Documentation Installation / Usage
Apache Axis 1.X tested with versions 1.2.1, 1.3
and 1.4
wsdl2java Install Axis 1.X and specify the
installation directory in the
soapUI Tool Integrations settings
Apache Axis 2
Tool Version(s) Documentation Installation / Usage
Apache Axis 2 tested with 0.9X and 1.0 wsdl2java Install Axis 2 and specify the
installation directory in the
soapUI Tool Integrations settings
Apache CXF 2.X
Tool Version(s) Documentation Installation / Usage
Apache CXF 2.0 tested with 2.0.1 wsdl2java Install CXF and specify the
installation directory in the
soapUI Tool Integrations settings
XFire 1.X
1 . 1 3 . 1 C O D E G E N E R A T I O N
33
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Tool Version(s) Documentation Installation / Usage
XFire 1.X WsGen tested with 1.X WsGen Install XFire 1.X and specify the
installation directory in the
soapUI Tool Integrations settings
Oracle wsa
Tool Version(s) Documentation Installation / Usage
Oracle wsa.jar tested with latest JDeveloper
release
Oracle Web Services (PDF) Install JDeveloper and specify
<jdeveloper-root>/webservices/lib
in soapUI Tool Integrations
settings
XMLBeans 2.x
Tool Version(s) Documentation Installation / Usage
XMLBeans 2.X tested with 2.2.0 scomp Install XmlBeans 2.X and specify
the installation directory in the
soapUI Tool Integrations settings
JAXB 2.x
Tool Version(s) Documentation Installation / Usage
JWSDP JAXB 2.0 tested with JWSDP 2.0 xjc Install JWSDP as required and
specify the jaxb\bin installation
directory in the soapUI Tool
Integrations settings
GSoap 2.X
Tool Version(s) Documentation Installation / Usage
GSoap 2.X tested with GSoap 2.7 on win32 wsdl2h , soapcpp2 Install GSoap as required and
specify the installation directory in
the soapUI Tool Integrations
settings
.NET 2.0
1 . 1 3 . 1 C O D E G E N E R A T I O N
34
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Tool Version(s) Documentation Installation / Usage
.NET 2.0 .NET 2.0 wsdl.exe Install Visual Studio and .NET 2.0
and specify the directory
containing wsdl.exe in the soapUI
Tool Integrations settings
Next: Apache 1(PMon
1 . 1 3 . 1 C O D E G E N E R A T I O N
35
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.13.2
Apache TCPMon
......................................................................................................................................
Apache TcpMon Integration for testing Web Services
1he Apache 1cpMon utilitv can be used to "listen in" on anv l11P traííic. including oí course SOAP
request or response messages. Download and install 1cpMon as described on their site and speciív the
installation directorv in the soapUI Integrated 1ools Settings.
soapUI pro·ides 2 simple integrations with this useíul tool:
1. lrom the main 1ools menu which will just start 1cpMon in a separate process
2. lrom the Interíace Menu which can be used to create a local proxv íor the designated ser·ice. 1his
will bring up the íollowing dialog:
1he dialog contains the íollowing options:
· Lndpoint - the target endpoint that 1cpMon should in·oke
· Local Port - the local port to that 1cpMon should listen on
· Add Local Lndpoint - adds an endpoint to the current ser·ice pointing at the created 1cpMon
proxv
Launching with the abo·e settings will start 1cpMon with the íollowing monitor:
1 . 1 3 . 2 A P A C H E T C P M O N
36
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
In soapUI. an endpoint has been added to the current ser·ice that can be used to in·oke 1cpMon instead
oí the ser·ice directlv this endpoint must be remo·ed manuallv,:
Using this endpoint results in the SOAP request being "proxied" through 1cpMon which will be shown
as íollows:
1 . 1 3 . 2 A P A C H E T C P M O N
37
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: (ommand Line 1ools
1 . 1 3 . 2 A P A C H E T C P M O N
38
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.14
CommandLine Tools
......................................................................................................................................
soapUI CommandLine tools
soapUI currentlv comes with the íollowing command line tools íor running 1est(ases and Load1ests
Tool Description
SoapUITestCaseRunner Runs specified TestCases and reports/exports results as configured
...........................................................................................................................................................................................
SoapUILoadTestRunner Runs specified LoadTests and reports/exports results as configured
...........................................................................................................................................................................................
SoapUIMockServiceRunner Runs specified MockServices
...........................................................................................................................................................................................
SoapUIToolRunner Runs any of the configured Code Generation tools for specified
project and interface
...........................................................................................................................................................................................
soapUI Maven 1.X/2.X plug-ins Allows execution of the above two from within a Maven 1.X/2.X build
environment
Next: SoapUI1est(aseRunner íor íunctional testing
1 . 1 4 C O M M A N D L I N E T O O L S
39
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.14.1
TestCase Runner
......................................................................................................................................
SoapUITestCaseRunner
1he runner is deíined in the com.eviware.soapui.tools.SoapUITestCaseRunner class and
takes the path to the soapUI project íile containing the tests and a number oí options:
switch description
e The endpoint to use when invoking test-requests, overrides the
endpoint set in the project file
...........................................................................................................................................................................................
h The host:port to use when invoking test-requests, overrides only the
host part of the endpoint set in the project file
...........................................................................................................................................................................................
s The TestSuite to run, used to narrow down the tests to run
...........................................................................................................................................................................................
c The TestCase to run, used to narrow down the tests to run
...........................................................................................................................................................................................
u The username to use in any authentications, overrides any username
set for any TestRequests
...........................................................................................................................................................................................
p The password to use in any authentications, overrides any password
set for any TestRequests
...........................................................................................................................................................................................
w Sets the WSS password type, either 'Text' or 'Digest'
...........................................................................................................................................................................................
d The domain to use in any authentications, overrides any domain set
for any TestRequests
...........................................................................................................................................................................................
r Turns on printing of a small summary report (see below)
...........................................................................................................................................................................................
f Specifies the root folder to which test results should be exported (see
below)
...........................................................................................................................................................................................
j Turns on exporting of JUnit-compatible reports, see below
...........................................................................................................................................................................................
a Turns on exporting of all test results, not only errors
...........................................................................................................................................................................................
o Opens the generated report in a browser (soapUI Pro only)
...........................................................................................................................................................................................
i Enables soapUI UI-related components.
...........................................................................................................................................................................................
t Sets the soapui-settings.xml file to use
...........................................................................................................................................................................................
x Sets project password for decryption if project is encrypted
...........................................................................................................................................................................................
v Sets password for soapui-settings.xml file
...........................................................................................................................................................................................
D Sets system property with name=value
...........................................................................................................................................................................................
G Sets global property with name=value
...........................................................................................................................................................................................
P Sets project property with name=value
...........................................................................................................................................................................................
g Sets the output to include Coverage HTML reports ( soapUI Pro only )
1 . 1 4 . 1 T E S T C A S E R U N N E R
40
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he distribution contains a testrunner.bat script íor running tests in the bin directorv. íor example:
testrunner.bat -hlocalhost:8080 -a -fresults c:\projects\my-soapui-project.xml
will run all the tests deíined in the mv-soapui-project.xml íile against the speciíied host and export all test
results to the "results" íolder will be created ií not a·ailable,.
Launch Dialog
lor getting started with the command line testrunner. soapUI includes a "Launch Load1estRunner"
action a·ailable írom Project. 1estSuite or 1est(ase popup menus:
1he options a·ailable include those described abo·e and also add options to set ií the project should be
sa·ed. the path to the runner lea·e emptv íor same as installation,. etc. \hen launching the speciíied
1estRunner will be launched írom the command line as coníigured and the output can be íollowed:
1 . 1 4 . 1 T E S T C A S E R U N N E R
41
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he output contains the actual command line command used íor launching the runner. which can easilv
be copied or pasted íor external reuse
JUnit Integration
It is íairlv easv to in·oke the testrunner írom vour own JUnit-tests:
public void testRunner() throws Exception
{
SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setProjectFile( "src/dist/sample-soapui-project.xml" );
runner.run();
}
1he runner.run() call will throw an exception ií an error occurs. Ií vou want more control o·er vour
integration ´ error-reporting. a speciíic 1est(ase could be run as íollows:
public void testTestCaseRunner() throws Exception
{
WsdlProject project = new WsdlProject( "src/dist/sample-soapui-project.xml"
);
1 . 1 4 . 1 T E S T C A S E R U N N E R
42
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
TestSuite testSuite = project.getTestSuiteByName( "Test Suite" );
TestCase testCase = testSuite.getTestCaseByName( "Test Conversions" );
// create empty properties and run synchronously
TestRunner runner = testCase.run( new PropertiesMap(), false );
assertEquals( Status.FINISHED, runner.getStatus() );
}
Reporting and Exporting Functional Web Service Tests
1he SoapUI1est(aseRunner has basic reporting íunctionalities. including the possibilitv to create
JUnit-compatible xml-reports using the -j switch. Also. it will during execution print diagnostic
iníormation and ií the -r switch was speciíied print a small summarv:
testrunner.bat jbossws-soapui-project.xml -stest -ctesting -r -a -fmyresults
produced the íollowing output:
SoapUI 1.5beta2 TestCase Runner
12:33:10,042 INFO [SoapUITestCaseRunner] setting projectFile to
[jbossws-soapui-project.xml]
12:33:10,042 INFO [SoapUITestCaseRunner] setting testSuite to [test]
12:33:10,042 INFO [SoapUITestCaseRunner] setting testCase to [testing]
12:33:10,583 INFO [WsdlProject] Loaded project from [jbossws-soapui-project.xml]
12:33:11,915 INFO [SoapUITestCaseRunner] Running soapui tests in project [jbossws]
12:33:11,915 INFO [SoapUITestCaseRunner] Running soapui suite [test], runType =
SEQUENTIAL
12:33:11,925 INFO [SoapUITestCaseRunner] Running soapui testcase [testing]
12:33:11,935 INFO [SoapUITestCaseRunner] runing step [Groovy Script - init boss]
12:33:12,335 INFO [SoapUITestCaseRunner] runing step [Properties]
12:33:12,335 INFO [SoapUITestCaseRunner] runing step [Transfer Values - set boss]
12:33:12,716 ERROR [SoapUITestCaseRunner] Transfer Values - set boss failed,
exporting to [myresults\test\testing\Transfer-FAILED.txt]
12:33:12,716 INFO [SoapUITestCaseRunner] runing step [request step] Retrieving
document at 'http://lpt-olma:8080/ws4ee-samples-server-ejb/Organization?wsdl'.
12:33:13,407 INFO [SchemaUtils] Loading schema types from
[http://lpt-olma:8080/ws4ee-samples-server-ejb/Organization?wsdl]
12:33:13,407 INFO [SchemaUtils] Getting schema
http://lpt-olma:8080/ws4ee-samples-server-ejb/Organization?wsdl
12:33:13,787 INFO [SoapUITestCaseRunner] Assertion [Schema Compliance] has status
VALID
12:33:13,807 INFO [SoapUITestCaseRunner] Finished running soapui testcase [testing],
time taken = 1882ms
12:33:13,807 INFO [SoapUITestCaseRunner] Skipping testcase [testcase2], filter is
[testing]
12:33:13,807 INFO [SoapUITestCaseRunner] Skipping testcase [Copy of testing], filter
is [testing]
12:33:13,807 INFO [SoapUITestCaseRunner] Skipping testcase [Copy of Copy of
testing], filter is [testing]
12:33:13,807 INFO [SoapUITestCaseRunner] soapui suite [test] finished in 1892ms
SoapUI 1.5beta2 TestCaseRunner Summary
-----------------------------
Time Taken: 1895ms
Total TestSuites: 1
1 . 1 4 . 1 T E S T C A S E R U N N E R
43
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Total TestCases: 1
Total TestSteps: 4
Total Request Assertions: 1
Total Failed Assertions: 0
Total Exported Results: 4
Bv deíault. the testrunner exports onlv íailed results to a text íile. the -a option will export all results
instead. lor example the íile íor a Request 1estStep will be as íollows slightlv modiíied to íit,:
Status: OK
Time Taken: 55
Size: 448
Timestamp: Sun Mar 12 12:45:57 CET 2006
TestStep: request step
----------------------------------------------------
Encoding: UTF-8
Endpoint: http://lpt-olma:8080/ws4ee-samples-server-ejb/Organization
Username: asd
Password: dfsdfdsf
Domain: asdasd
---------------- Request ---------------------------
<soapenv:Envelope xmlns:sam="http://org.jboss.test.webservice/samples"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<sam:getContactInfo>
<String_1>testsd1141581163341</String_1>
</sam:getContactInfo>
</soapenv:Body>
</soapenv:Envelope>
---------------- Response --------------------------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getContactInfoResponse
xmlns:ns1="http://org.jboss.test.webservice/samples">
<result>The 'testsd1141581163341' boss is currently out of office, please
call again.</result>
</ns1:getContactInfoResponse>
</soapenv:Body>
</soapenv:Envelope>
Lxported íiles are written to a íile named ·1estSuite·-·1est(ase·-·1estStep
Name·-·(ount·-·Status·.txt in the current or speciíied íolder. An example íilename is "1estSuite
1-1est(ase 1-Request Step 1-0-OK.txt" the count is added since a 1estStep can be in·oked se·eral times
within the run oí a 1est(ase,. As oí soapUI 1.¯.5. response attachments are also exported. named
·1estSuite·-·1est(ase·-·1estStep Name·-·(ount·-attachment-·Attachment(ount·.·Lxtension·.
where the extension is created írom the attachments content-tvpe ií possible otherwise .dat will be used,.
JUnit Reports
Adding the -j switch produces xml-reports in the same íormat that are exported bv the JUnit ant task
with the xml-report íormat. (urrentlv. soapUI maps 1estSuites to report-packages and 1est(ases to
1 . 1 4 . 1 T E S T C A S E R U N N E R
44
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
report 1est(ases. lor example running the íollowing:
testrunner.bat -j -ftestresults sample-soapui-project.xml
produces a "1LS1-1est Suite.xml" íile in the speciíied test results íolder. 1his result can be íurther
transíormed using the ant junitreport task:
<junitreport todir="./testresults">
<fileset dir="./testresults">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./testresults/html"/>
</junitreport>
\hich produces an output as íollows:
Lrrors are shown as íollows:
1 . 1 4 . 1 T E S T C A S E R U N N E R
45
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
\rapping e·ervthing into one ant-target íor win32 would be as íollows:
<target name="soapui-report">
<exec dir="C:\\Program Files\\eviware\\soapUI-1.7.5\\bin"
executable="cmd.exe">
<arg line="/c testrunner.bat -j -fg:\\reports
g:\\projects\\sample-soapui-project.xml"/>
</exec>
<junitreport todir="g:\\reports">
<fileset dir="g:\\reports">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="g:\\reports\\html"/>
</junitreport>
</target>
Next: SoapUILoad1estRunner íor \eb Ser·ice Load 1esting
1 . 1 4 . 1 T E S T C A S E R U N N E R
46
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.14.2
LoadTest Runner
......................................................................................................................................
SoapUILoadTestRunner
1he SoapUILoad1estRunner can be used to run Load1ests írom the command line. which can be used
íor sur·eillance testing and maximizing local testing. 1he runner will run each speciíied Load1est in turn.
be careíul not to run Load1ests with an indeíinite test limit.
1he runner is deíined in the com.eviware.soapui.tools.SoapUILoadTestRunner class and
takes the path to the soapUI project íile containing the Load1ests to run and a number oí options:
switch description
e The endpoint to use when invoking test requests, overrides the
endpoint set in the project file
...........................................................................................................................................................................................
h The host:port to use when invoking test requests, overrides only the
host part of the endpoint set in the project file
...........................................................................................................................................................................................
s The TestSuite to run, used to narrow down the tests to run
...........................................................................................................................................................................................
c The TestCase to run, used to narrow down the tests to run
...........................................................................................................................................................................................
l The LoadTest to run, used to narrow down which LoadTests to run
...........................................................................................................................................................................................
m Overrides the limit value set for the specified LoadTest(s)
...........................................................................................................................................................................................
n Overrides the thread-count value set for the specified LoadTest(s)
...........................................................................................................................................................................................
u The username to use in any authentications, overrides any username
set for any TestRequests
...........................................................................................................................................................................................
p The password to use in any authentications, overrides any password
set for any TestRequests
...........................................................................................................................................................................................
d The domain to use in any authentications, overrides any domain set
for any TestRequests
...........................................................................................................................................................................................
r Turns on exporting of a LoadTest statistics summary report (see
below)
...........................................................................................................................................................................................
f Specifies the root folder to which test results should be exported (see
below)
...........................................................................................................................................................................................
w Sets the WSS password type, either Text or Digest
...........................................................................................................................................................................................
t Sets the soapui-settings.xml file to use
...........................................................................................................................................................................................
x Sets project password for decryption if project is encrypted
...........................................................................................................................................................................................
v Sets password for soapui-settings.xml file
...........................................................................................................................................................................................
D Sets system property with name=value
...........................................................................................................................................................................................
G Sets global property with name=value
...........................................................................................................................................................................................
1 . 1 4 . 2 L O A D T E S T R U N N E R
47
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
switch description
P Sets project property with name=value
1he distribution contains a loadtestrunner.bat script íor running tests írom within the bin directorv. íor
example:
loadtestrunner.bat -ehttp://localhost:8080/services/MyService
c:\projects\my-soapui-project.xml
will run all the Load1ests deíined in the mv-soapui-project.xml íile against the speciíied ser·ice-endpoint.
Launch Load Test Dialog
lor getting started with the command-line Load1estRunner. soapUI includes a "Launch Dialog" action
a·ailable írom Project´Load1est popup menus:
1he options a·ailable include those described abo·e and also add options to set ií the project should be
sa·ed. the path to the runner lea·e emptv íor same as installation,. etc. \hen launching the speciíied
1 . 1 4 . 2 L O A D T E S T R U N N E R
48
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Load1estRunner will be launched írom the command-line as coníigured and the output can be íollowed:
1he output contains the actual command line command used íor launching the runner. which can easilv
be copied or pasted íor external reuse
Reporting and Exporting load tests
1he SoapUILoad1estRunner has limited reporting íunctionalitv. it will during execution print diagnostic
and progress iníormation and ií the -r switch was speciíied write the Load1est statistics and Load1est
Log to a íile aíter execution. Lrror Result in the Load1est Log will be exported likewise. in the same
manner as íor the 1est(ase runner.
loadtestrunner -stest -ctestcase4 -l"LoadTest 1" -r "C:\Documents and
Settings\ole.matzura\My Documents\jbossws-soapui-project.xml"
produced the íollowing output:
SoapUI 1.5beta2 LoadTestRunner
15:31:50,397 INFO [SoapUILoadTestRunner] setting projectFile to [C:\Documents and
Settings\ole.matzura\
My Documents\jbossws-soapui-project.xml]
15:31:50,517 INFO [SoapUILoadTestRunner] setting testSuite to [test]
15:31:50,517 INFO [SoapUILoadTestRunner] setting testCase to [testcase3]
15:31:52,901 INFO [WsdlProject] Loaded project from [C:\Documents and
Settings\ole.matzura\My Documents\
jbossws-soapui-project.xml]
15:31:59,941 INFO [SoapUILoadTestRunner] Skipping testcase [testing], filter is
[testcase3]
15:31:59,941 INFO [SoapUILoadTestRunner] Skipping testcase [testcase2], filter is
1 . 1 4 . 2 L O A D T E S T R U N N E R
49
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
[testcase3]
15:31:59,941 INFO [SoapUILoadTestRunner] Running LoadTest [LoadTest1]
15:32:00,141 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress: 0.0025
15:32:01,153 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress: 0.019533332
15:32:02,154 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress: 0.036383335
15:32:03,155 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress: 0.053066667
..etc..
15:32:57,944 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress: 0.9662167
15:32:58,956 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress: 0.9830833
15:32:59,977 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress: 1.0001
15:33:00,979 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] finished with status
FINISHED
15:33:00,979 INFO [SoapUILoadTestRunner] Exporting log and statistics for LoadTest
[LoadTest1]
15:33:01,039 INFO [SoapUILoadTestRunner] Exported 2 log items to [LoadTest
1-log.txt]
15:33:01,039 INFO [SoapUILoadTestRunner] Exported 0 error results
15:33:01,119 INFO [SoapUILoadTestRunner] Exported 2 statistics to [LoadTest
1-statistics.txt]
15:33:01,119 INFO [SoapUILoadTestRunner] Skipping testcase [Copy of Copy of
testing], filter is [testcase3]
15:33:01,119 INFO [SoapUILoadTestRunner] soapui suite [test] finished in 61178ms
1he exported statistics íile is the same as exported írom within the Load1est Lditor and looks as íollows:
Request Step,min,max,avg,last,cnt,tps,bytes,bps,err
request step,1,407,17.63,26,11591,283.49,5192768,86696,0
Total:,1,407,17.63,26,11591,283.49,5192768,86696,0
Next: SoapUIMockRunner íor \eb Ser·ice Simulation
1 . 1 4 . 2 L O A D T E S T R U N N E R
50
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.14.3
MockService Runner
......................................................................................................................................
SoapUIMockServiceRunner
1he runner is deíined in the com.eviware.soapui.tools.SoapUIMockServiceRunner class
and takes the path to the soapUI project íile containing the MockSer·ice and a number oí options:
switch description
m The name of the MockService to run
...........................................................................................................................................................................................
p The local port to listen on, overrides the port configured for the
MockService
...........................................................................................................................................................................................
a The local path to listen on, overrides the path configured for the
MockService
...........................................................................................................................................................................................
b Turns off blocking when mockRunner has been started, which is
required when wanting to run the MockServiceRunner with (for
example) nohup or as a Windows Service
...........................................................................................................................................................................................
s The soapui-settings.xml file to use
...........................................................................................................................................................................................
x Sets project password for decryption if project is encrypted
...........................................................................................................................................................................................
v Sets password for soapui-settings.xml file
...........................................................................................................................................................................................
D Sets system property with name=value
...........................................................................................................................................................................................
G Sets global property with name=value
...........................................................................................................................................................................................
P Sets project property with name=value
...........................................................................................................................................................................................
f Sets the output folder to export results to ( soapUI Pro only )
...........................................................................................................................................................................................
o Opens the Coverage Report in a browser (with the -g option) ( soapUI
Pro only )
...........................................................................................................................................................................................
g Sets the output to include Coverage HTML reports ( soapUI Pro only )
1he distribution contains a mockser·icerunner.bat script íor running MockSer·ices in the bin directorv.
íor example:
mockservicerunner.bat -m"IOrderService MockService" "C:\Documents and Settings\Ole
Matzura\My Documents\demo2-soapui-project.xml"
will start the speciíied MockSer·ice as íollows:
SoapUI SNAPSHOT MockService Runner
15:08:15,515 INFO [SoapUI] Added
[file:/C:/workspace/core/ext/mysql-connector-java-5.0.4-bin.jar] to classpath
1 . 1 4 . 3 M O C K S E R V I C E R U N N E R
51
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
15:08:16,375 INFO [SoapUI] initialized soapui-settings from [soapui-settings.xml]
15:08:16,406 INFO [WsdlProject] Loaded project from [C:\Documents and Settings\Ole
Matzura\My Documents\demo2-soapui-project.xml]
15:08:17,609 INFO [SoapUIMockServiceRunner] Running MockService [IOrderService
MockService] in project [demo]
15:08:17,609 INFO [SoapUIMockServiceRunner] Press any key to terminate
15:08:17,953 INFO [MockEngine] Started mockService [IOrderService MockService] on
port [8081] at path [/mockIOrderService]
15:08:17,953 INFO [SoapUIMockServiceRunner] MockService started on port 8081 at
path [/mockIOrderService]
Progress: 1 - Loading definition from cache
15:09:18,625 DEBUG [WsdlContext] Loading definition from cache
15:09:18,640 DEBUG [WsdlLoader] Returning baseInputSource
[http://evitop:8080/OrderServiceImpl?wsdl]
15:09:18,687 DEBUG [WsdlLoader] Returning baseURI
[http://evitop:8080/OrderServiceImpl?wsdl]
Retrieving document at 'http://evitop:8080/OrderServiceImpl?wsdl'.
15:09:18,796 DEBUG [WsdlContext] Loaded definition: ok
15:09:18,812 INFO [SchemaUtils] Added default schema from
/C:/workspace/core/target/classes/xop.xsd with targetNamespace
http://www.w3.org/2004/08/xop/include
15:09:18,890 INFO [SchemaUtils] Added default schema from
/C:/workspace/core/target/classes/XMLSchema.xsd with targetNamespace
http://www.w3.org/2001/XMLSchema
15:09:18,890 INFO [SchemaUtils] Added default schema from
/C:/workspace/core/target/classes/xml.xsd with targetNamespace
http://www.w3.org/XML/1998/namespace
15:09:18,890 INFO [SchemaUtils] Added default schema from
/C:/workspace/core/target/classes/swaref.xsd with targetNamespace
http://ws-i.org/profiles/basic/1.1/xsd
15:09:18,890 INFO [SchemaUtils] Added default schema from
/C:/workspace/core/target/classes/xmime200505.xsd with targetNamespace
http://www.w3.org/2005/05/xmlmime
15:09:18,890 INFO [SchemaUtils] Added default schema from
/C:/workspace/core/target/classes/xmime200411.xsd with targetNamespace
http://www.w3.org/2004/11/xmlmime
15:09:18,890 WARN [SchemaUtils] Failed to open schemaDirectory
[C:\workspace\soapui-pro\schemas]
15:09:18,890 INFO [SchemaUtils] Loading schema types from
[http://evitop:8080/OrderServiceImpl?wsdl]
15:09:18,890 INFO [SchemaUtils] Getting schema
http://evitop:8080/OrderServiceImpl?wsdl
15:09:18,906 INFO [SchemaUtils] schema for [http://www.example.org/OrderService/]
contained [{}] namespaces
15:09:19,359 INFO [SoapUIMockServiceRunner] Handled request 1; [purchase] with
[MockResponse 1] in [9ms] at [2007-04-03 15:09:17.968]
15:09:20,734 INFO [SoapUIMockServiceRunner] Handled request 2; [purchase] with
[MockResponse 2] in [0ms] at [2007-04-03 15:09:20.734]
15:09:21,296 INFO [SoapUIMockServiceRunner] Handled request 3; [purchase] with
[MockResponse 1] in [0ms] at [2007-04-03 15:09:21.296]
15:09:21,937 INFO [SoapUIMockServiceRunner] Handled request 4; [purchase] with
[MockResponse 2] in [0ms] at [2007-04-03 15:09:21.937]
15:09:22,343 INFO [SoapUIMockServiceRunner] Handled request 5; [purchase] with
[MockResponse 1] in [0ms] at [2007-04-03 15:09:22.343]
\hich can now be in·oked írom soapUI or anv other client. 1erminate the runner bv pressing the return
kev in the console. which will shutdown as íollows:
15:20:30,703 INFO [MockEngine] Stopping connector on port 8081
1 . 1 4 . 3 M O C K S E R V I C E R U N N E R
52
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
15:20:30,703 INFO [MockEngine] No more connectors.. stopping server
15:20:30,703 INFO [SoapUIMockServiceRunner] MockService stopped, handled 7 requests
15:20:30,703 INFO [SoapUIMockServiceRunner] time taken: 733117ms
Next: SoapUI1oolRunner íor generating code írom \SDL
1 . 1 4 . 3 M O C K S E R V I C E R U N N E R
53
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.14.4
Tool Runner
......................................................................................................................................
SoapUIToolRunner
1he SoapUI1oolRunner can be used to anv oí the integrated (ode Generation tools írom the command
line as thev ha·e been coníigured in soapUI.
1he runner is deíined in the com.eviware.soapui.tools.SoapUIToolRunner class and takes the
path to the soapUI project íile containing the interíace and tool-coníiguration to run. It has the íollowing
options:
switch description
i the interface for which the tool should be run
...........................................................................................................................................................................................
t the tool(s) to run, a comma-separated list with the following tokens;
axis1, axis2, dotnet, gsoap, jaxb, wstools, wsconsume, ora, wsi,
wscompile, wsimport, cxf, xfire or xmlbeans
...........................................................................................................................................................................................
s the soapui-settings.xml file to use (usually the one in the soapUI bin
directory)
...........................................................................................................................................................................................
x Sets project password for decryption if project is encrypted
...........................................................................................................................................................................................
v Sets password for soapui-settings.xml file
...........................................................................................................................................................................................
D Sets system property with name=value
...........................................................................................................................................................................................
G Sets global property with name=value
1he distribution contains a toolrunner.bat script íor running tools írom within the bin directorv. íor
example:
toolrunner.bat -iAWSECommerceServicePortType -taxis1
G:\test\Amazon-soapui-project.xml
will run all the axis 1.X code-generation as pre·iouslv deíined within soapUI and produce the íollowing
output:
SoapUI 1.6 beta1 Tool Runner
02:27:02,386 DEBUG [SoapUI] initialized soapui-settings from [soapui-settings.xml]
02:27:02,506 INFO [WsdlProject] Loaded project from
[G:\test\Amazon-soapui-project.xml]
02:27:08,765 INFO [SoapUIToolRunner] Running tools for project [Amazon]
directory: C:\java\axis-1_4\lib
command: java -cp
activation.jar;axis-ant.jar;axis.jar;bsf.jar;castor-0.9.5.2.jar;commons-codec-1.2.jar;
commons-discovery-0.2.jar;commons-httpclient-3.0-rc2.jar;commons-logging-1.0.4.jar;commons-net-1.0.0-dev.jar;
httpunit.jar;ibmjsse.jar;javax.jms.jar;jaxrpc.jar;JimiProClasses.jar;junit-3.8.1.jar;log4j-1.2.8.jar;
1 . 1 4 . 4 T O O L R U N N E R
54
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
mailapi_1_3_1.jar;saaj.jar;servlet.jar;wsdl4j-1.5.1.jar
org.apache.axis.wsdl.WSDL2Java -v -W -s -a
-H -T 1.2 -o g:\test\amazon
C:\DOCUME~1\OLE~1.MAT\LOCALS~1\Temp\tempdir8304.tmp\AWSECommerceService.wsdl
Parsing XML file:
C:\DOCUME~1\OLE~1.MAT\LOCALS~1\Temp\tempdir8304.tmp\AWSECommerceService.wsdl
Generating
g:\test\amazon\com\amazon\webservices\AWSECommerceService\_2006_05_17\CartGetRequest.java
...
Generating
g:\test\amazon\com\amazon\webservices\AWSECommerceService\_2006_05_17\deploy.wsdd
Generating
g:\test\amazon\com\amazon\webservices\AWSECommerceService\_2006_05_17\undeploy.wsdd
SoapUIToolRunner: Execution finished successfully
02:27:14,593 INFO [SoapUIToolRunner] time taken: 5814ms
1he abo·e axis 1.X generation had been pre·iouslv coníigured in soapUI as shown below:
Next: soapUI Kevboard shortcuts
1 . 1 4 . 4 T O O L R U N N E R
55
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15
IDE/Tool Plugins
......................................................................................................................................
soapUI IDE and Tool Plugins
soapUI comes with plug-ins íor the íollowing tools ´ IDL's
Tool or IDE Functionality
Maven 1.X/2.X Provides goals/properties corresponding to each of the soapUI
command-line tools and its arguments
...........................................................................................................................................................................................
NetBeans 5.5/6.0 Provides full soapUI functionality from within the NetBeans IDE
...........................................................................................................................................................................................
IntelliJ IDEA 6+ Provides full soapUI functionality from within IntelliJ IDEA
...........................................................................................................................................................................................
Eclipse 3.2+ Provides full soapUI functionality from within Eclipse plus a soapUI
Project Nature for integrated browsing/viewing of eclipse/soapUI
projects in the Project Explorer.
...........................................................................................................................................................................................
JBossWS/JBossIDE 2.0.0+ Provides the same functionality as the standard Eclipse plug-in plus a
number of JBossWS-related wizards/dialogs/actions.
Since the IDL's all ha·e their own window´desktop management. some options in the soapUI
Preíerences ´ UI Settings will not be a·ailable.
1 . 1 5 I D E / T O O L P L U G I N S
56
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.1
Maven Plugins
......................................................................................................................................
soapUI maven plugins
soapUI includes plugins íor running \eb Ser·ice tests in both ma·en 1.x and ma·en 2.x allowing one to
automate lunctional test in 1estSuites ´ 1est(ases . \eb Ser·ice Load1ests and code generation
pre·iouslv created or coníigured in soapUI. Ií anv oí the plugin tasks íail. an error message will be
printed to the console and the execution will exit with an error.
Read more:
· ma·en 1.X plugin
· ma·en 2.X plugin
Next: ma·en 1.X plugin
1 . 1 5 . 1 M A V E N P L U G I N S
57
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.1.1
Maven 1.X Plugin
......................................................................................................................................
soapUI maven 1.X plugin
Download soapUI Maven Plugin
Prior to installing a new ·ersion oí the plugin. vou should delete anv old ·ersions írom vou local cache.
repositorv. ma·en installation.
Download the latest ·ersion oí the plugin írom sourceíorge soapUI Downloads or install it directlv írom
the command line:
maven plugin:download -DgroupId=eviware -DartifactId=maven-soapui-plugin
-Dversion=1.6 -Dmaven.repo.remote=http://www.soapui.org/repository
Alternati·elv vou can speciív a dependencv directlv in vour project.xml:
<dependency>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>1.7.6</version>
<type>plugin</type>
</dependency>
In this case. don't íorget to add the soapUI repositorv to vour repositorv list in project.properties:
maven.repo.remote=http://www.ibiblio.org/maven,http://www.soapui.org/repository
soapUI Maven Plugin Usage
Download and install the plugin as described abo·e. Bv deíault. it will look íor a soapUI project íile
named ${pom.artifactId}-soapui-project.xml. vou can o·erride this bv setting with the
maven.soapui.project propertv.
Run íunctional tests with
maven soapui:test
and load tests with
1 . 1 5 . 1 . 1 M A V E N 1 . X P L U G I N
58
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
maven soapui:loadtest
1he plugin will load the speciíied project íile and run all 1est(ases a·ailable in all 1estSuites. Ií vou want
to narrow down which 1estSuites´1est(ases´Load1est to run. use the
maven.soapui.test.testsuite. maven.soapui.test.testcase and
maven.soapui.test.loadtest properties íor that purpose.
Ií vou want to change the ser·ice endpoint. host. username. password or domain used bv the
1estRequests in the executed 1est(ases. set this with one oí the maven.soapui.test.XX properties .
íor example
maven soapui:test
-Dmaven.soapui.test.endpoint=http://somehost.com:8080/services/MyService
Be aware that this will set the endpoint íor att 1estRequests executed. vou might need to narrow down
which 1est(ase to run ií vou ha·e multiple 1est(ases testing multiple ser·ices.
lor example ií vou ha·e 2 1estSuites. each testing its own ser·ice in vour project. vou could run these as
íollows:
maven soapui:test -Dmaven.soapui.test.testsuite=TestSuite1
-Dmaven.soapui.test.endpoint=http://somehost.com:8080/services/MyService1
íollowed bv
maven soapui:test -Dmaven.soapui.test.testsuite=TestSuite2
-Dmaven.soapui.test.endpoint=http://someotherhost.com:8080/services/MyService2
1urn on creation oí simple reports as described íor the command line SoapUI1est(aseRunner and
SoapUI1est(aseRunner runners with the maven.soapui.report.XX properties.
Sample Outputs from the Maven plugin
lere comes an example output when running soapUI íunctional tests through ma·en as described abo·e
using the sample project included in the oííline distribution:
maven soapui:test -Dmaven.soapui.project=sample-soapui-project.xml
__ __
| \/ |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \ ~ intelligent projects ~
|_| |_\__,_|\_/\___|_||_| v. 1.0.2
build:start:
soapui:test:
[echo] Running soapUI project sample-soapui-project.xml with endpoint []
[java] SoapUI 2.5.1 TestRunner
1 . 1 5 . 1 . 1 M A V E N 1 . X P L U G I N
59
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
[java] 23:57:56,258 INFO [SoapUITestCaseRunner] setting projectFile to
[sample-soapui-project.xml]
[java] 23:57:56,838 INFO [WsdlProject] Loaded project from
[sample-soapui-project.xml]
[java] 23:57:57,219 INFO [SoapUITestCaseRunner] Running soapui tests in project
[Sample Project]
[java] 23:57:57,219 INFO [SoapUITestCaseRunner] Running soapui suite [Test
Suite]
[java] 23:57:57,219 INFO [SoapUITestCaseRunner] Running soapui testcase [Test
Conversions]
[java] 23:57:57,219 INFO [SoapUITestCaseRunner] runing step [SEK to USD Test]
[java] Retrieving document at
'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL'.
[java] 23:57:59,893 INFO [SchemaUtils] Loading schema types from
[http://www.webservicex.net/CurrencyConvertor.asmx?WSDL]
[java] 23:57:59,893 INFO [SchemaUtils] loading schema types from
http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
[java] Assertion [Schema Compliance] has status VALID
[java] Assertion [XPath Match - check for less than 0.2] has status VALID
[java] Assertion [XPath Match - check for more than 0.1] has status VALID
[java] Assertion [SOAP Fault Assertion] has status VALID
[java] 23:58:01,025 INFO [SoapUITestCaseRunner] runing step [USD to SEK Test]
[java] Assertion [Schema Compliance] has status VALID
[java] Assertion [XPath Match - check for less than 8] has status VALID
[java] Assertion [XPath Match - check for more than 7] has status VALID
[java] Assertion [SOAP Fault Assertion] has status VALID
[java] 23:58:01,495 INFO [SoapUITestCaseRunner] Finished running soapui
testcase [Test Conversions], time taken = 4276ms
[java] 23:58:01,505 INFO [SoapUITestCaseRunner] Running soapui testcase [Test
XMethods Query]
[java] 23:58:01,505 INFO [SoapUITestCaseRunner] runing step [Test
getAllServiceNames]
[java] Assertion [XPath Match - check for Anagram Service] has status VALID
[java] 23:58:03,488 INFO [SoapUITestCaseRunner] runing step [Transfer values]
[java] 23:58:03,688 INFO [SoapUITestCaseRunner] runing step [Test
getServiceDetail]
[java] Assertion [XPath Match] has status VALID
[java] 23:58:03,949 INFO [SoapUITestCaseRunner] Finished running soapui
testcase [Test XMethods Query], time taken = 2444ms
[java] 23:58:03,959 INFO [SoapUITestCaseRunner] soapui suite [Test Suite]
finished in 6740ms
BUILD SUCCESSFUL
Total time: 10 seconds
Finished at: Sun Oct 02 23:58:04 CEST 2005
Another sample with a íailed loadtest:
maven soapui:loadtest -Dmaven.soapui.test.loadtest=LoadTest1
-Dmaven.soapui.report.folder=results
__ __
| \/ |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \ ~ intelligent projects ~
|_| |_\__,_|\_/\___|_||_| v. 1.0.2
Attempting to download swingx-SNAPSHOT.jar.
build:start:
soapui:loadtest:
[echo] Running soapui project jbossws-soapui-project.xml with endpoint []
1 . 1 5 . 1 . 1 M A V E N 1 . X P L U G I N
60
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
[java] SoapUI 2.5.1 LoadTestRunner
[java] 22:48:13,116 INFO [SoapUILoadTestRunner] setting projectFile to
[jbossws-soapui-project.xml]
[java] 22:48:13,116 INFO [SoapUILoadTestRunner] setting testSuite to [test]
[java] 22:48:13,116 INFO [SoapUILoadTestRunner] setting testCase to [testcase3]
[java] 22:48:13,647 INFO [WsdlProject] Loaded project from
[jbossws-soapui-project.xml]
[java] 22:48:14,818 INFO [SoapUILoadTestRunner] Skipping testcase [testing],
filter is [testcase3]
[java] 22:48:14,818 INFO [SoapUILoadTestRunner] Skipping testcase [testcase2],
filter is [testcase3]
[java] 22:48:14,818 INFO [SoapUILoadTestRunner] Running LoadTest [LoadTest1]
[java] 22:48:14,878 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.0
[java] 22:48:15,870 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.038
[java] 22:48:16,871 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.102
[java] 22:48:17,873 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.14
[java] 22:48:18,884 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.204
[java] 22:48:19,876 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.274
[java] 22:48:20,887 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.35
[java] 22:48:21,889 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.424
[java] 22:48:22,890 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.488
[java] 22:48:23,891 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.564
[java] 22:48:24,893 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] progress:
0.642
[java] 22:48:25,894 INFO [SoapUILoadTestRunner] LoadTest [LoadTest1] finished
with status FAILED
[java] 22:48:25,894 INFO [SoapUILoadTestRunner] Exporting log and statistics
for LoadTest [LoadTest1]
[java] 22:48:25,944 INFO [SoapUILoadTestRunner] Exported 36 log items to
[results\LoadTest1-log.txt]
[java] 22:48:26,265 INFO [SoapUILoadTestRunner] Exported 33 error results
[java] 22:48:26,265 INFO [SoapUILoadTestRunner] Exported 3 statistics to
[results\LoadTest1-statistics.txt]
[java] 22:48:26,265 INFO [SoapUILoadTestRunner] Skipping testcase [testcase4],
filter is [testcase3]
[java] 22:48:26,265 INFO [SoapUILoadTestRunner] soapui suite [test] finished in
11447ms
[java] 22:48:26,265 INFO [SoapUILoadTestRunner] 1 load tests failed:
[java] 22:48:26,265 INFO [SoapUILoadTestRunner] LoadTest1: Maximum number of
errors [30] exceeded for step [Groovy Script]
[java] 22:48:26,265 ERROR [SoapUILoadTestRunner]
com.eviware.soapui.support.SoapUIException: LoadTests failed
BUILD FAILED
File...... C:\Documents and
Settings\ole.matzura\.maven\cache\maven-soapui-plugin-1.5beta1\plugin.jelly
Element... ant:java
Line...... 104
Column.... 105
Java returned: 1
Total time: 18 seconds
Finished at: Sun Mar 12 22:48:26 CET 2006
1 . 1 5 . 1 . 1 M A V E N 1 . X P L U G I N
61
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: ma·en 1.X plugin goals
1 . 1 5 . 1 . 1 M A V E N 1 . X P L U G I N
62
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.1.2
Maven 2.X Plugin
......................................................................................................................................
soapUI maven 2.X plugin
soapUI Maven Plugin Usage
Prior to using the plugin. add the e·iware ma·en 2 repositorv either to vour project or settings.xml:
<pluginRepositories>
<pluginRepository>
<id>eviwarePluginRepository</id>
<url>http://www.eviware.com/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
1hen. add the soapUI plugin to vour pom.xml
<plugins>
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<projectFile>sample-soapui-project.xml</projectFile>
<host>http://127.0.0.1:8181</host>
</configuration>
</plugin>
</plugins>
Run íunctional tests with
mvn eviware:maven-soapui-plugin:test
loadtests with
mvn eviware:maven-soapui-plugin:loadtest
and MockSer·ices with
mvn eviware:maven-soapui-plugin:mock
1 . 1 5 . 1 . 2 M A V E N 2 . X P L U G I N
63
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he plugin will load the speciíied project íile and run all 1est(ases a·ailable in all 1estSuites. Ií vou want
to narrow down which 1estSuites´1est(ases´Load1est to run. use the testSuite. testCase and
loadTest properties íor that purpose.
Integrated Tools
Ií vou coníigure anv oí the integrated code generation tools in soapUI íor an interíace in vour project.
vou can in·oke this code generation íunctionalitv with
mvn eviware:maven-soapui-plugin:tool
which could be coníigured in the ma·en 2 build process as part oí the generate-sources step:
<plugins>
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<projectFile>sample-soapui-project.xml</projectFile>
<testSuite>OleTest</testSuite>
<iface>IOrderService</iface>
<tool>wsi,axis1,axis2</tool>
<settingsFile>C:\workspace\core\soapui-settings.xml</settingsFile>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Se·eral tools can be speciíied in a comma separated list. so the abo·e example would run both \S-I
reports and coníigured code generation íor both Axis1 and Axis2. Also. the soapUI settings íile has been
speciíied since it contains tool paths and global \S-I settings
Next: ma·en 2.X plugin goals
1 . 1 5 . 1 . 2 M A V E N 2 . X P L U G I N
64
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.2
NetBeans Plugin
......................................................................................................................................
soapUI NetBeans Plugin
1he soapUI NetBeans Plugin pro·ides all soapui íunctionalitv directlv írom within NetBeans 5.5´6.0
allowing one integrated de·elopment and testing en·ironment íor \eb Ser·ices in ja·a. Since soapUI 2.0.
the plug-in hosts soapUI projects just as standard NetBeans projects. ie the pre·iouslv a·ailable "soapUI
Na·igator" tab has been remo·ed and soapUI projects are managed like anv other NetBeans projects.
lere are some screenshots:
Getting Started with WS Testing in Netbeans
Download the NBM írom Sourcelorge soapUI Downloads or ·ia the NetBeans Plugin manager. Ií vou
downloaded it írom Sourcelorge. install as described in the soapUI Installation document. See the
soapUI demonstration mo·ies below íor some hands-on tutorials. otherwise the existing Getting Started
with soapUI applies also to the NetBeans Plugin. as does the User Guide . 1he onlv real diííerence is that
the standalone soapUI Desktop has been replaced bv the NetBeans tabbed interíace íor editors.
Creating a soapUI Project
As mentioned abo·e. soapUI projects are managed as standard NetBeans projects. 1o create a new
soapUI project. select the New Project -· SOA -· \eb Ser·ice 1esting Project option:
1 . 1 5 . 2 N E T B E A N S P L U G I N
65
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Aíter selecting "Next". one will be prompted to create the project. together with options íor:
· Speciíving the initial \SDL to import
· Generating a 1estSuites and´or MockSer·ice íor the speciíied \SDL
· Speciíing an existing soapUI Project which will be imported instead
1 . 1 5 . 2 N E T B E A N S P L U G I N
66
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Depending on which options that ha·e been selected. a number oí dialogs will be shown to querv íor
related iníormation. Once the project has been created. it will be ·isible in the standard NetBeans
"Projects" ·iew in the same wav as it is displaved in soapUI Na·igator when running the standalone
·ersion oí soapUI:
1 . 1 5 . 2 N E T B E A N S P L U G I N
67
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Log and Property Views
1he standard soapUI Log tabs are made ·isible ·ia the \indow`soapUI Log menu option which will
open the tabs in a window at the bottom oí the NetBeans desktop:
1he item speciíic properties displaved at the bottom-leít in the standalone ·ersion oí soapUI can be
·iewed or edited bv opening the NetBeans Properties \indow írom the \indow menu.
1 . 1 5 . 2 N E T B E A N S P L U G I N
68
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Demonstration Movies
As oí NetBeans 6.0 M9 ´ OpenLSB 2.0. the soapUI NetBeans plugin is bundled with the OpenLSB add
ons. downloadable írom https:´´open-esb.de·.ja·a.net´Downloads_OpenLSB_Addons_NB6.html . 1he
íollowing demonstration mo·ies are a·ailable that show how to get started with common soapUI tasks in
NetBeans:
· soapUI NetBeans Demo Mo·ie 1 shows how to create a simple \SDL. implement and deplov that
\SDL with a BPLL process. and íinallv test the deploved process with the soapUI module.
· soapUI NetBeans Demo Mo·ie 2 shows how to create a simple \SDL. create a Mock
Implementation oí that \SDL with the soapUI module. create a ja·a application client that calls the
Mock Implementation. and then íinallv how to implement the \SDL with a BPLL process.
· soapUI NetBeans Demo Mo·ie 3 shows how to create a simple JAX-\S \eb Ser·ice and
deplov´test it with the soapUI module.
Next: Installing soapUI NetBeans Plugin
1 . 1 5 . 2 N E T B E A N S P L U G I N
69
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.2 NETBEANS PLUGIN
70
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.2.1
Installation
......................................................................................................................................
Installing the NetBeans Plugin in NetBeans 6.0
lere comes a walk-through oí how to install the soapUI Plugin in NetBeans 6.0:
· Start bv downloading the nbm distribution írom Sourcelorge into a temporarv íolder.
· Be sure to remo·e anv existing installation oí the soapUI plugin and anv associated íiles. lailure to do
so will most likelv cause installation ´ execution problems.
· Start NetBeans and select the "1ools ´ Plugins" menu item
· Switch to the "Downloaded" tab and select the "Add Plugins..." button to browse to the downloaded
nbm íile
· Once the íile has been selected. NetBeans will displav module iníormation as íollows:
1 . 1 5 . 2 . 1 I N S T A L L A T I O N
71
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Now select the "Install" button at the bottom. NetBeans will install the plugin o·er a series oí steps.
including a coníirmation to install an unsigned plugin. Just select "(ontinue" until vou get to the íinal
screen:
1 . 1 5 . 2 . 1 I N S T A L L A T I O N
72
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· 1he plug-in has now been installed and can be seen in the "Installed" tab:
1 . 1 5 . 2 . 1 I N S T A L L A T I O N
73
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
· Aíter select OK to close the dialog. the soapUI installation can íurther be coníirmed ·ia the
1ools´soapUI menu: ií it shows up. the installation seems to ha·e gone ok:
1 . 1 5 . 2 . 1 I N S T A L L A T I O N
74
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.2.1 INSTALLATION
75
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.3
IntelliJ Plugin
......................................................................................................................................
soapUI IntelliJ Plugin
1he soapUI IntelliJ Plugin pro·ides all soapUI íunctionalitv directlv írom within IntelliJ IDLA allowing
one integrated de·elopment and testing en·ironment íor \eb Ser·ices in Ja·a.
Lxisting soapUI desktop components are made a·ailable through two 1ool\indows:
· A "soapUI Na·igator" 1ool\indow at the leít contains the soapUI \orkspace Na·igator and Details
1ab
· A "soapUI Log" 1ool\indow at the bottom contains the same Log 1abs as in soapUI
All soapUI Desktop Panels are made a·ailable as editor tabs in IDLA and will be opened and closed as
usual. lere are some screenshots:
(urrentlv. the plugin can be seen as a "le·el 1" integration. i.e. it is "merelv" a packaging oí soapUI
components in the IntelliJ en·ironment.
soapUI Intellij Plugin Installation
Since IntelliJ 8. a direct link íor installing the soapUI IntelliJ plugin is a·ailable in the 1ools´\eb Ser·ices
menu. Is is also downloadable írom Sourcelorge and through IntelliJ's plugin-manager. Aíter installing.
vou should increase IntelliJ's PermGen space as the plugin requires a íair amount oí memorv: do this bv
altering the idea.exe.·moptions íile in the idea bin directorv to íor example:
-Xms128m
-Xmx512m
-XX:MaxPermSize=128m
-ea
Getting Started soapUI Tutorial
1he existing Getting Started applies also to the IntelliJ Plugin. as does the User Guide . 1he onlv real
diííerence is that the standalone soapUI Desktop has been replaced bv the IntelliJ tabbed interíace íor
editors.
Next: \orking with soapUI NetBeans Plugin
1 . 1 5 . 3 I N T E L L I J P L U G I N
76
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.4
Eclipse Plugin
......................................................................................................................................
soapUI eclipse-plugin
1he soapUI eclipse plugin pro·ides íull soapUI íunctionalitv írom within eclipse. Apart írom "standard"
soapUI 2.5 íunctionalitv. the eclipse plugin contains a soapUI project nature and also adds a new soapUI
perspecti·e which mimics the lavout oí the standalone soapUI ·ersion.1he plugin makes use oí the
S\1_A\1 bridge which greatlv eases our de·elopment eííort but mav result in graphical glitches with
dialogs and some window updates... but all core íunctionalitv should be working OK let us know
otherwise,...
(urrentlv the eclipse plugin can be downloaded írom soapUI Sourcelorge Download Page or through
the update site located at http:´´www.soapui.org´eclipse´update´site.xml see below,
Please ·ote íor this plugin at the eclipse plugin central .
soapUI eclipse Update Site
An eclipse update site is now a·ailable at http:´´www.soapui.org´eclipse´update´site.xml. install the
soapui-eclipse-plugin with the íollowing steps:
1. Select "lelp"´"Soítware Updates"´"lind and Install..."
2. Select the "Search íor new íeatures to install" option
3. Press the "New Remote Site" button and add the iníormation shown in the image to the right
4. Select linish and the íollow the dialogs to install the soapUI íeature
Read the Getting Started with soapUI document and the soapUI User Guide to get going!
The soapUI Perspective
Once installed. open the soapUI Perspecti·e bv using the standard \indow´Open Perspecti·e´Other...
1 . 1 5 . 4 E C L I P S E P L U G I N
77
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
(ommand and selecting "soapUI" írom the list. 1he perspecti·e will open 2 ·iews:
· A "soapUI Na·igator" ·iew to the leít containing the same Na·igator and Details tab as the
standalone soapUI ·ersion.
· A "soapUI Logs" ·iew to the bottom containing the same log tabs as the standalone soapUI ·ersion.
Na·igation´actions work the same as in the standalone ·ersion. windows are opened as tabs on the
eclipse desktop and can be mo·ed´docked around as usual
Oí course. the abo·e mentioned ·iews can be added to anv perspecti·e using the \indow´Show
View´Other... (ommand and selecting either one oí them in the soapUI group.
soapUI Preferences
Most soapUI Settings are a·ailable írom the standard \indow´Preíerences dialog under the soapUI
node:
1 . 1 5 . 4 E C L I P S E P L U G I N
78
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Next: soapUI Nature in the Lclipse Plug in
1 . 1 5 . 4 E C L I P S E P L U G I N
79
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.15.4.1
soapUI Nature
......................................................................................................................................
soapUI Nature
1he soapUI Nature allows integrated access to all soapUI íunctionalitv directlv írom within a Ja·a
project.
1he íollowing example walks through a "top down" scenario:
Step 1: Enable soapUI Nature
Start bv creating an emptv Ja·a project and enabling the soapUI Nature írom the projects popup menu:
Ií enabling goes will. vou will see a "SoapUI \eb Ser·ices" node in the project:
\hen shown in the Lclipse Project Lxplorer View. this node beha·es like a standard soapUI project
node. Its right-click menu includes a "soapUI" menu with a·ailable project actions:
1 . 1 5 . 4 . 1 S O A P U I N A T U R E
80
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Step 2: Create or Import a WSDL or WADL
\ou can either manuallv create a \SDL or \ADL in vour project using íor example the íormidable
\eb 1ools Project \SDL Lditor, or just import one into vour project using one oí the standard "Add
\SDL" or "Add \ADL" actions.
\hen creating the \SDL or \ADL in vour project. right-click on the íile and select "soapUI -· Add to
soapUI Project"
Once imported. the \SDL or \ADL is shown as a "standard" soapUI Interíace node under the
"soapUI \eb Ser·ices" node:
1 . 1 5 . 4 . 1 S O A P U I N A T U R E
81
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Step 3: Generate Code
Now its time to generate some code... select the "Generate -· Axis 1.X Artiíacts" menu option írom the
Interíace nodes popup menu which will show the below dialog
Select the desired options and set the output íolder to a Ja·a source íolder in vour project..
1 . 1 5 . 4 . 1 S O A P U I N A T U R E
82
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Select the "Generate" button which will in·oke Axis as coníigured under "Preíerences -· soapUI -·
Integrated 1ools", and show the output in the console window:
1he generated classes are now ·isible under the Ja·a source node reíresh íirst!,
1 . 1 5 . 4 . 1 S O A P U I N A T U R E
83
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1he classes are marked red abo·e since the axis-libraries are not in the projects classpath. 1hese will be
added automaticallv bv soapUI in a íuture ·ersion,
Step 4: Implement, Deploy and Test your Web Services
Aíter implementing and deploving vour \eb Ser·ice to the desired container. vou can now start sending
web ser·ice requests "as usual"... good luck!
Next: \orking with JBoss \S 1esting
1 . 1 5 . 4 . 1 S O A P U I N A T U R E
84
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
1.16
Keyboard shortcuts
......................................................................................................................................
Keyboard Shortcuts in soapUI
soapUI supports a number oí kevboard shortcuts in order to make vour liíe easier.
Global Actions
1he íollowing shortcuts are a·ailable íor most items in soapUI:
Keyboard Shortcut Functionality
F1 Shows online help.
...........................................................................................................................................................................................
Delete Deletes the selected item.
...........................................................................................................................................................................................
F2 Renames the selected item.
...........................................................................................................................................................................................
F9 Copies or Clones the selected item.
...........................................................................................................................................................................................
Enter Show the associated editor.
Main Menu Actions
1he íollowing shortcuts are a·ailable íor main menu actions:
Keyboard Shortcut Functionality
Ctrl N Creates a new soapUI project in the workspace.
...........................................................................................................................................................................................
Ctrl I Imports an existing project into the workspace.
...........................................................................................................................................................................................
Ctrl Tab Select next. Selects next window in the soapUI desktop.
...........................................................................................................................................................................................
Ctrl Alt P Preferences.
...........................................................................................................................................................................................
Ctrl Q Saves the entire workspace and exits soapUI.
...........................................................................................................................................................................................
Ctrl Alt Q Exits soapUI without saving anything.
Desktop Actions
1he íollowing shortcuts are a·ailable íor working with the soapUI desktop:
1 . 1 6 K E Y B O A R D S H O R T C U T S
85
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Keyboard Shortcut Functionality
Ctrl F4 Close Current. Closes the active window in the soapUI desktop
...........................................................................................................................................................................................
Ctrl Alt O Close Others. Closes all windows but the active window in the soapUI
desktop.
...........................................................................................................................................................................................
Ctrl Alt L Close All. Closes all windows in the soapUI desktop.
...........................................................................................................................................................................................
Ctrl Tab Select next. Selects next window in the soapUI desktop.
Project Actions
1he íollowing actions are a·ailable when an Project node is selected in the Na·igator
Keyboard Shortcut Functionality
Ctrl U Adds a new WSDL from an URL
...........................................................................................................................................................................................
Ctrl F Adds a new WSDL from a local File
...........................................................................................................................................................................................
Ctrl T Creates a new TestSuite
...........................................................................................................................................................................................
Ctrl S Saves the project
...........................................................................................................................................................................................
Ctrl Shift S Prompts to save the project to a new file
Interface Actions
1he íollowing actions are a·ailable when an Interíace node is selected in the Na·igator
Keyboard Shortcut Functionality
Ctrl E Shows the Interface Endpoints dialog.
...........................................................................................................................................................................................
Ctrl W Validate the interface with the WS-I validation tools
...........................................................................................................................................................................................
Ctrl P Saves the entire WSDL and included and imported files to a local
directory
...........................................................................................................................................................................................
F5 Reloads the definition for this interface and its operations
Operation Actions
1he íollowing actions are a·ailable when an Operation node is selected in the Na·igator
Keyboard Shortcut Functionality
Ctrl N Creates a new request for the Operation.
1 . 1 6 K E Y B O A R D S H O R T C U T S
86
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Request Actions
1he íollowing actions are a·ailable when an Request node is selected in the Na·igator
Keyboard Shortcut Functionality
Ctrl Alt A Adds the request to a TestCase
Working with Requests and Responses
1he íollowing shortcuts are general shortcuts when working in the Request Lditor:
Keyboard Shortcut Functionality
Alt Enter Submits the request to the specified endpoint.
...........................................................................................................................................................................................
Alt X Cancels a running submit.
...........................................................................................................................................................................................
Alt left/right arrow Move between element values
...........................................................................................................................................................................................
Alt O Changes the orientation of the request/response splitter
...........................................................................................................................................................................................
Ctrl Alt Tab Shift focus between request/response area.
...........................................................................................................................................................................................
Alt V Validate the contained messages' XML and against its operations
message definition.
...........................................................................................................................................................................................
Alt W (in the response editor) Validate the current request/response messages against the WS-I
Basic Profile (requires a response).
...........................................................................................................................................................................................
Ctrl D Delete line. Deletes the current Line in the XML Editor.
...........................................................................................................................................................................................
F3 Shows the Find/Replace Dialog.
...........................................................................................................................................................................................
Alt F Pretty-Prints the current XML
...........................................................................................................................................................................................
Ctrl S Prompts to save the contents of the editor to a file.
TestSuite Actions
1he íollowing actions are a·ailable when a 1estSuite node is selected in the Na·igator
Keyboard Shortcut Functionality
Ctrl N Creates a new TestCase.
TestCase Actions
1he íollowing actions are a·ailable when a 1est(ase node is selected in the Na·igator
1 . 1 6 K E Y B O A R D S H O R T C U T S
87
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D
Keyboard Shortcut Functionality
Ctrl N Creates a new LoadTest.
...........................................................................................................................................................................................
Ctrl Shift O Shows the LoadTest Options.
Working with TestCases
1he íollowing shortcuts are general shortcuts when working in the 1est(ase Lditor:
Keyboard Shortcut Functionality
Ctrl Up/Down Move a TestCase up or down in the TestCase Editor.
Working with Groovy Scripts
1he íollowing shortcuts are general shortcuts when working in the Groo·v Lditor:
Keyboard Shortcut Functionality
Ctrl Enter Executes the current groovy script.
Back to the soapUI O·er·iew
1 . 1 6 K E Y B O A R D S H O R T C U T S
88
© 2 0 0 5 E V I W A R E . C O M • A L L R I G H T S R E S E R V E D

Sign up to vote on this title
UsefulNot useful