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

soapUI v.2.0.2
Project Documentation
......................................................................................................................................
eviware 28 January 2008
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.1.5 WSDL Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.2 Workspaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.3 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.3.1 Project View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.3.2 Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
1.3.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
1.3.4 WS-Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.4 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
1.4.1 Interface View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
1.4.2 Service Endpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
1.4.3 WSDL Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
1.4.4 WS-I Complicance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
1.4.5 WSDL Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
1.5 Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
1.6 Working with Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
1.6.1 Form Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
1.6.2 Overview View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
1.6.3 Outline Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
1.6.4 Message Inspectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
1.6.5 Attachments/Inline Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
1.7 Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
1.7.1 Script Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
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.8 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
1.8.1 Property Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
1.9 Functional Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
1.9.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
1.9.2 TestSuites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
1.9.3 TestCases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
1.9.3.1 Test Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
1.9.3.2 Property Transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
1.9.3.3 Conditional Gotos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
1.9.3.4 Groovy Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
1.9.3.5 Properties Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
1.9.3.6 Delay Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
1.9.3.7 Run TestCase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
1.9.3.8 Mock Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
1.9.3.9 DataSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
1.9.3.10 DataSource Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
1.9.3.11 DataSink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
1.10 Load Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
1.10.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
1.10.2 Limit & Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
1.10.3 Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
1.10.4 Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
1.10.5 Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
1.10.6 JMeter comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
1.11 Mocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.11.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.11.2 Mock Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.11.2.1 Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.11.3 Mock Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.11.4 Mock Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.12 SOAP Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.12.1 Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
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.13 Usage Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.13.1 Data-Driven Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.13.2 Template-Driven Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
1.13.3 Interactive Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
1.13.4 Surveillance Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
1.14 Tool Integrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
1.14.1 Code Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
1.14.2 Apache Tcp-Mon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
1.15 CommandLine Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
1.15.1 TestCaseRunner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
1.15.2 LoadTestRunner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
1.15.3 MockServiceRunner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
1.15.4 ToolRunner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
1.16 Keyboard shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
1.17 IDE/Tool Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
1.17.1 Maven Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
1.17.1.1 Maven 1.X Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
1.17.1.2 Maven 2.X Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
1.17.2 NetBeans Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
1.17.2.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
1.17.3 IntelliJ Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
1.17.4 Eclipse Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
1.17.4.1 soapUI Nature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
1.18 Keyboard shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
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 will need to ha·e a good grasp oí the íollowing
concepts´technologies to get the most out oí soapUI's íunctionalitv.
· \SDL - basic concepts ser·ices. ports. bindings. port tvpes,. relation to xml-schema
· SOAP - basic concepts. relation to \SDL bindings. etc,. diííerent encoding tvpes
soap-encoded´literal, and message stvles document´rpc,
· XML and related technologies - 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 ui-concepts as a·ailable in íor example
eclipse. IDLA. etc,. 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´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
One 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 nodes, : íor each interíace in the project
·
Operation nodes, : íor each operation in the interíace
·
Request nodes, : íor each request created íor the operation
·
1estSuite nodes, : íor each 1estSuite in the project
·
1est(ase nodes, : íor each 1est(ase in the testsuite
·
1estSteps node. contains the 1est(ases'
·
1estStep nodes, : íor each 1est(ase-step. together with a colored icon indicating
the status oí that step.
·
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
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 "Propertv-Mode". 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 and´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 "Properties" child node 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´dropping items in the Na·igator. resulting in
corresponding (lone´Mo·e operations. alternati·elv add´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´drop within´between the 1estSuite and 1est(ase editors and the Na·igator to
rearrange´mo·e´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´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
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
currentlv selected Desktop.
· Switch Windows - opens a "Switch \indow" dialog íor switching to another open editor
· Maximize Desktop - hides´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
Help Menu - general iníormation and soapUI Pro
speciíic actions
· 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 - Opens http:´´www.soapui.org
· About soapUI - Shows a ·ersion iníormation dialog
System Properties
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
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´securitv settings. etc.
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´disable the log and to
copv selected rows to the clipboard. Also. log-entries can be selected´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,
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
· 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
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´ser·ice is not a·ailable. a
socket connection error will be shown here. which mav well be due to "natural" causes.
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 Preíerences
1 . 1 O V E R V I E W
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´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´arranged into multiple tab groups. Lach tab-group has a top-right menu íor tab-group
related actions.
· docked´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" and´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:
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 corresponding pages 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´IDL plug-ins will
be released in pro-enabled ·ersions shortlv aíter the standalone soapUI Pro release.
Next: 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
...........................................................................................................................................................................................
soapUI Pro Settings Sets soapUI-Pro specific settings
...........................................................................................................................................................................................
Coverage Settings Coverate related 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 Pro, installation íolder
· Import Preferences/Libraries/Scripts/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´extension
inconsistencies with the pre·ious installation.
HTTP Settings
Setting Description
User-Agent Header Sets the HTTP User-Agent Header. If none is specified the default
HttpClient header is used
...........................................................................................................................................................................................
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
...........................................................................................................................................................................................
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
...........................................................................................................................................................................................
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
...........................................................................................................................................................................................
Preencoded Endpoints Do not URL-encode endpoints, set this if your endpoint URLs are
already URL-encoded (containing for example %20 or %3A)
...........................................................................................................................................................................................
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
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.
...........................................................................................................................................................................................
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.
...........................................................................................................................................................................................
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)
Proxy Settings
Setting Description
Proxy Host The HTTP Proxy host to use
...........................................................................................................................................................................................
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
Setting Description
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.
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
(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
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
WSDL Settings
Setting Description
Cache WSDLs Turns on/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/validating wsdl/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.
...........................................................................................................................................................................................
Excluded Types A list of XML-Schema types/global-elements in the form of
name@namespace which will be used when generating sample
requests/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!.
...........................................................................................................................................................................................
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
Setting Description
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/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/XSDs will be pretty-printed.
UI Settings
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.
...........................................................................................................................................................................................
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
Order TestSuites Sorts TestSuites in alphabetical order in the navigator.
...........................................................................................................................................................................................
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.
Editor 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
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.
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 .
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
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 wsi 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 globl 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 other
propertv reíerences see Properties íor more iníormation,.
soapUI Pro Settings
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
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
...........................................................................................................................................................................................
Table Inspector Columns Sets the maximum number of columns displayed by the Table
Inspector (due to performance reasons).
...........................................................................................................................................................................................
Form Editor Limit Defines the maximum size of messages to handle in the form editor;
since the outline editor consumes a large amount of memory, setting
a limit related to one’s own memory settings is encouraged
...........................................................................................................................................................................................
Script Library Sets the location for the local Script Library .
Coverage Settings
1hese settings are related to soapUI Pro speciíic \SDL (o·erage íunctionalitv.
Setting Description
Count Empty Values Sets empty elements/attributes to count as covered
...........................................................................................................................................................................................
Count ? Values Sets elements/attributes containing ? to count as covered
...........................................................................................................................................................................................
Auto Prepare Automatically prepares for Coverage calculation when opening a
window containing Coverage content.
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
Next: XPath Selection
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
1.1.4
XPath Selection
......................................................................................................................................
soapUI Pro XPath Selection Dialog
soapUI Pro includes a XPath \izard´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´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
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
Next: Script Librarv
1 . 1 . 4 X P A T H S E L E C T I O N
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
1.1.5
WSDL Coverage
......................................................................................................................................
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´\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!
Coverage for Web Services
1raditionallv in íor example, a Ja·a en·ironment. 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-tests,. 1he returned
·alue tries to gi·e an estimate oí how much oí the code-base that is actualitv being used´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´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´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´response "Message (o·erage", or the actual Message (ontent íor the selected
request´response in the tree.
1 . 1 . 5 W S D L C O V E R A G E
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
· 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
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
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
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
Coverage Options
1he (o·erage Options dialog a·ailable írom the toolbar allows vou to set the íollowing options:
· (ount Lmptv Values - select ií emptv elements´attributes should be regarded as co·ered
· (ount · Values - select ií elements´attributes containing '·' should be regarded as co·ered
1 . 1 . 5 W S D L C O V E R A G E
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
Coverage Measurement Points
soapUI allows vou to measure co·erage in 3 distinct scenarios:
1. lor lunctional 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. lor MockSer·ices - í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. lor SOAP Monitors - íor measuring how much oí vour \SDL is being used in a real-liíe scenario.
Next:
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
1.2
Workspaces
......................................................................................................................................
Workspaces
In soapUI a \orkspace is a collection or 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´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´created and remo·ed írom the workspace using the corresponding actions on
the \orkspace´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/Closed 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´memorv consumption and A projects open´close state is remembered in the
workspace when restarting´switching workspaces and a global UI Setting is a·ailable see Preíerences ,
íor alwavs closing all projects when loading a new workspace.
1 . 2 W O R K S P A C E S
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
Workspace Actions
1he íollowing actions are a·ailable írom the workspace-nodes right-button menu and írom the main
"lile" menu,:
· New WSDL Project : Prompts to create a new \SDL 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.
· 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
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
1 . 2 W O R K S P A C E S
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
· 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
Next: Projects
1 . 2 W O R K S P A C E S
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
1.3
Projects
......................................................................................................................................
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í Interíaces each corresponding to a SOAP´l11P Binding íor a deíined Port1vpe
· 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. It onlv has íile-svstem reíerences ií an
interíace´\SDL has been imported írom a local íile not recommended due to this limitation, and´or ií
reíerenced attachments ´ inline íiles are used see Attachments ,. \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.
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´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 Projects
Selecting the New \SDL Project option írom the \orkspace Menu opens this dialog which prompts
íor:
· A name íor the project is required
· An optional inital \SDL to import into the project either íile or URL,
· An option to optionalv create deíault requests when speciíving an initial \SDL
· An option to sa·e the emptv project to a íile unsa·ed projects will be prompted íor a project-íile on
exit,.
1 . 3 P R O J E C T S
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
Once speciíied. soapUI will prompt íor a íilename to which the project is to be sa·ed deíaults to
<project-name>-soapui-project.xml,. Put this íile anvwhere vou want. te íile is a regular XML
íile and can be checked into S(M svstems and edited with anv XML editor.
Remote Projects
soapUI 1.¯.6 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´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 testrunners 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´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.
1 . 3 P R O J E C T 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
Project Actions
1he íollowing actions are a·ailable írom the project nodes' right-button menu:
· Add WSDL from URL - Prompts íor a \SDL URL that will be parsed and imported accordinglv
· Add WSDL from file - Prompts íor a local \SDL íile that will be parsed and imported accordinglv
· Launch 1estRunner - Opens the dialog íor launching the command-line 1estRunner
· Launch Load1estRunner - Opens the dialog íor launching the command-line Load1estRunner
· 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
· 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
· Online Help - Displavs this page in an external browser
1 . 3 P R O J E C T 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
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
· 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 View
\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
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
Next: Project O·e·iew
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
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
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
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
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
Next: Project (o·erage
1 . 3 . 1 P R O J E C T V I E W
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.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:
1 . 3 . 2 C O V E R A G E
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
1.3.3
Requirements
......................................................................................................................................
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.
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
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
· 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"
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 standalone 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
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
· 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
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.4
WS-Security
......................................................................................................................................
WS-Security
1his document will gi·e an o·er·iew on how to coníigure \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 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´·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´·eriíving incoming messages containing
\S-Securitv tokens: responses. mock-requests or monitored requests´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
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
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
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
· Source : the source íile oí the kevstore´certiíicate Read Onlv,
· Status : the load-status oí the kevstore´certiícate Read Onlv
· Password : the kevstore password ií required
· Deíault Alias : the deíault alias in a kevstore to use íor ·alidation´decrvption
· Deíault Password : the password íor deíault alias
· Securitv Pro·ider : the J SSL Securitv Pro·ider to use íor handling certiíicates
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´·alidate a message.
the onlv coníiguration needed bv soapUI is which kevstores that contain reíerenced kevs´certiíicates íor
decrvption and signature ·alidation.
1 . 3 . 4 W S - S E C U R I T Y
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
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´·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:
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
1.4
Interfaces
......................................................................................................................................
Interfaces
In the current implementation oí the internal soapUI object model. Interíaces in soapUI correspond to
SOAP´l11P Bindings íor a Port1vpe. Once imported using one oí the "Import \SDL írom.." actions.
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:
· Open Interface Viewer : Opens the Interíace Viewer window
· Generate -> : In·okes one oí the integrated tools as described under 1ool Integrations
· Check WS-I 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 below,
· Generate MockService : Generates a complete MockSer·ice íor this interíace see below,
· 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
1 . 4 I N T E R F A C E S
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
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.
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:
1 . 4 I N T E R F A C E S
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
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.
· 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.
1 . 4 I N T E R F A C E S
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
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 Detail 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
1 . 4 I N T E R F A C E S
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
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 I N T E R F A C E S
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.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.
Next: Ser·ice Lndpoints
1 . 4 . 1 I N T E R F A C E V I E W
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
1.4.2
Service Endpoints
......................................................................................................................................
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. 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.
1 . 4 . 2 S E R V I C E E N D P O I N T S
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
\hen closing the dialog with the "Ok" button. the a·ailable endpoints will be selectable in associated
operations requests´test-requests editor panes.
Next: \SDL (ontent
1 . 4 . 2 S E R V I C E E N D P O I N T S
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.4.3
WSDL Content
......................................................................................................................................
WSDL Content
1he Interíace ·iewer allows relati·elv easv na·igation´inspection oí the entire contract íor an imported
\SDL. including all imported´included \SDL´XSD íiles and their contained tvpes. deíinitions. etc.
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
· lorward - na·igates to the next selected node aíter na·igating back..,
· Update Deíinition - updates the \SDL-contract as described under Updating the Interíace
Deíinition
· Lxport \SDL - prompts to export the entire sadlv and all imported´included íiles to a local íolder.
Import´Includes are replaced with ·alid relati·e ones.
1he íollowing screenshot shows the ·iewer íor the PavPal API:
1 . 4 . 3 W S D L C O N T E N T
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
Next: \S-I (ompliance.
1 . 4 . 3 W S D L C O N T E N T
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
1.4.4
WS-I Complicance
......................................................................................................................................
WS-I Tools Integration
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:
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.
A generated report looks as íollows:
1 . 4 . 4 W S - I C O M P L I C A N C E
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
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 Tool Output
Selecting the "Show Log" option in the \SI Settings 1ab will displav ongoing output írom the
command-line tools which can be useíul íor debugging purposes:
1 . 4 . 4 W S - I C O M P L I C A N C E
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
Next: \SDL Reíactoring
1 . 4 . 4 W S - I C O M P L I C A N C E
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
1.4.5
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
\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. 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 . 5 W S D L R E F A C T O R I N G
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
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.
Press Next to mo·e on the message reíactoring:
1 . 4 . 5 W S D L R E F A C T O R I N G
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
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 leít-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 . 5 W S D L R E F A C T O R I N G
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
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 lilter checkbox can be selected to hide the nodes that were not changed and íocus on the changes.
\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:
1 . 4 . 5 W S D L R E F A C T O R I N G
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
1.5
Operations
......................................................................................................................................
Operations
\hen adding an interíace as described abo·e. each oí that interíaces operations is added as a node in the
na·igator named aíter the operation in the underlving Port1vpe.
1he íollowing actions are a·ailable írom the operation nodes' right-button menu:
· Add to MockService - prompts to create a 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
· 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
1 . 5 O P E R A T I O N S
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
· Receives Attachments read-onlv,: Signals that the operation is deíined to recei·e Mime
Attachments
· One-Way read-onlv,: Shows that this is a one-wav operation i.e. request onlv,
Next: \orking with Requests
1 . 5 O P E R A T I O N S
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
1.6
Working with 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 (soapUI Pro only) - 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
1 . 6 W O R K I N G W I T H R E Q U E S T S
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
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
· Bind Address : 1he local IP Address to bind to when sending the 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´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,
1 . 6 W O R K I N G W I T H R E Q U E S T S
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
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.
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.
1 . 6 W O R K I N G W I T H R E Q U E S T S
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
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´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
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 . 6 W O R K I N G W I T H R E Q U E S T S
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
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 . 6 W O R K I N G W I T H R E Q U E S T S
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
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 . 6 W O R K I N G W I T H R E Q U E S T S
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
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.
1 . 6 W O R K I N G W I T H R E Q U E S T S
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
XML Source Editor
1he request´response xml-editors support svntax-highlighting. undo´redo. copv´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´response message, 1he íollowing actions
are a·ailable írom the request´response editors` right-button menu:
· Validate - ·alidates the editors' content against its message deíinition as described below
· 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
· 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
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
1 . 6 W O R K I N G W I T H R E Q U E S T S
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
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 . 6 W O R K I N G W I T H R E Q U E S T 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
Authentication
Ií the ser·ice requires authentication. soapUI will attempt to authenticate using the speciíied
username´password´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 J SSLaccordinglv.
Ií one oí the \SS-Password 1vpe options and´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 http 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 . 6 W O R K I N G W I T H 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
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´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:
1 . 6 W O R K I N G W I T H 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
1he options are:
· Mode - the copv mode. see below
· 1estRequests - the 1estRequests to copv´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´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: Attachments and Inline liles
1 . 6 W O R K I N G W I T H 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
1.6.1
Form Editor
......................................................................................................................................
soapUI Pro Form Editor
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 . 6 . 1 F O R M E D I T O R
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
Bv deíault. the editor creates íields íor all elements´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,
· Mandatorv - 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
· Mandatorv 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 . 6 . 1 F O R M E D I T O R
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
1his setting will be remembered between editing sessions.
Datatype Support
Since soapUI Pro 1.¯.6. the 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 . 6 . 1 F O R M E D I T O R
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
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 lorm Lditor supports most commons XML-Schema constructs but mav ha·e trouble
displaving´editing´·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´remo·e buttons will be
shown
· Lnumerations´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´All complex tvpes - (hoice will be displaved with a combo-box in the
1 . 6 . 1 F O R M E D I T O R
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
section header írom which the desired choice should be selected.
· Multiple occurrences oí an complex element will be displaved as a list with add´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
· SOAP-Lncoding Arravs should work ok since 1.¯.6
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
1 . 6 . 1 F O R M E D I T O R
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
1.6.2
Overview View
......................................................................................................................................
Overview View
soapUI Pro includes an "O·er·iew" ·iew íor ·isualizing response´mock-request messages in a
íorm-editor íashion.
Lach section contains links íar right, to the corresponding nodes in the XML´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: Outline Lditor
1 . 6 . 2 O V E R V I E W V I E W
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
1.6.3
Outline Editor
......................................................................................................................................
soapUI Pro Outline Editor
1he soapUI Pro Outline Lditor is a·ailable íor all request´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 and´or
schema restrictions. Node ·alues in the center column are editable bv selecting´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-(,
· Lxpands all sibling nodes ií possible AL1-(1RL-L,
1 . 6 . 3 O U T L I N E E D I T O R
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
· 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 . 6 . 3 O U T L I N E E D I T O R
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
1.6.4
Message Inspectors
......................................................................................................................................
Message Inspectors
soapUI Pro adds a number oí context-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
· (o·erage - displavs Message (o·erage iníormation íor the selected node
Lach tab is enabled´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 . 6 . 4 M E S S A G E I N S P E C T O R 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
In the image abo·e. the inspector shows red íor the searchstring 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 . 6 . 4 M E S S A G E I N S P E C T O R S
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
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 . 6 . 4 M E S S A G E I N S P E C T O R S
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
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:
1 . 6 . 4 M E S S A G E I N S P E C T O R S
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.6.5
Attachments/Inline Files
......................................................................................................................................
Working with Attachments / 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 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´response editors contain tabs íor adding´accessing attachments íor the current
request´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 . 6 . 5 A T T A C H M E N T S / I N L I N E F I L E 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
1he attachment-table contains the íollowing columns:
· Name read-onlv, - 1he íilename oí the attachment
· Content-1ype - 1he mime 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 mime-part deíinition in the
corresponding \SDL
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 web-browser.
Attaching files
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 mime-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 mime 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
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 Mime-Part as
described abo·e. lor example. ií the request operations' binding deíines the íollowing:
1 . 6 . 5 A T T A C H M E N T S / I N L I N E F I L E 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
<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 . 6 . 5 A T T A C H M E N T S / I N L I N E F I L E 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
this would result in the íollowing option in the Part combo-box:
MTOM Attachments
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 xmime data tvpes
soapUI 1.¯.6 remo·es this requirement: all binarv content will be M1OM encoded ií M1OM is enabled,.
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 . 6 . 5 A T T A C H M E N T S / I N L I N E F I L E 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
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 . 6 . 5 A T T A C H M E N T S / I N L I N E F I L E S
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
Next: lunctional 1esting
1 . 6 . 5 A T T A C H M E N T S / I N L I N E F I L E 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
1.7
Scripting
......................................................................................................................................
soapUI Scripting
soapUI pro·ides extensi·e options íor scripting. using Groo·v as its scripting language vou can get more
iníormation. tutorials. etc on the Groo·v \eb Site ,. Scripts can be used at the íollowing places in
soapUI:
· As part oí a 1est(ase with the Groo·v Script 1estStep . allowing vour tests to períorm ·irtuallv anv
desired íunctionalitv
· Beíore and aíter running a 1est(ase or 1estSuite íor initializing´cleaning up beíore´aíter running
vour tests.
· \hen starting´stopping a MockSer·ice to intializing´cleaning-up MockSer·ice state
· \hen opening´closing a Project . íor initializing´cleaning-up Project related settings
· As a dvnamic DataSource or DataSink with the corresponding DataSource´DataSink test steps
· lor pro·iding dvnamic MockOperation dispatching .
· lor creating dvnamic MockResponse content
· lor creating arbitrarv assertions with the Script Assertion
· 1o extend soapUI itselí see Lxtending soapUI ,. íor adding arbitrarv íunctionalitv to the soapUI
core
All scripts ha·e access to a number oí situation-speciíic ·ariables. alwavs including a log object íor
logging to the Groo·v Log and a context object íor períorm context-speciíic PropertvLxpansions
and´or propertv handling ií applicable,. A context-speciíic ·ariable is alwavs a·ailable íor directlv
accessing the soapUI object model.
Script Editors
Script editors are generallv a·ailable as inspectors at the bottom oí the corresponding objects editor. each
ha·ing a run button. a drop-down edit menu same as the right-click popup,. an iníormation label. and a
help button:
1 . 7 S C R I P T I N G
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
1he popup-menu as shown abo·e, contains standard edit-related actions and will in soapUI Pro contain
a "Get Data" menu option that expands to show all properties a·ailable within the current scope.
Selecting a propertv or the option to create a new one, will e·entuallv create a script to get the ·ariable.
íor example
def test = context.expand( '${#Project#test}' )
\hich gets the Project-le·el "test" propertv.
It is also possible to drag a propertv írom the na·igator tree when it is in Propertv-Mode into the script: ií
the dragged propertv is "within scope" ie can be accessed ·ia propertv-expansion,. the corresponding
access script will be created at the caret location
Groovy Script Library
soapUI Pro adds the possibilitv to ha·e a central librarv oí Groo·v (lasses that can be accessed írom anv
script within soapUI. which can be useíul íor centralizing common tasks´íunctionalitv and íor creating
soapUI extensions . Use as íollows:
· Speciív which íolder to use in the soapUI Pro Preíerences tab deíault is ·working
directorv·´scripts,. soapUI Pro will check this íolder íor íiles with the "Groo·v" extension and
compile these upon startup. 1he íolder is then checked periodicallv e·erv 5 seconds, íor updates and
new´existing scripts are re,compiled ií necessarv.
· Scripts should be placed in íolders named aíter their containing package. ie a script in the package
soapui.demo should be in a soapui/demo íolder under the speciíied scripts íolder.
· 1he compiled classes are added to the parent class loader oí all groo·v-scripts. vou can access them as
standard ja·a classes.
Remember that the script íiles must be ·alid classes. not just arbitrarv scripts... see example below.
1 . 7 S C R I P T I N G
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
Example
1he íollowing example is included with the soapUI Pro distribution. it consists oí the íollowing
Greet.groo·v íile that is located in the deíault scripts íolder:
package soapui.demo
class Greet
{
def name
def log
Greet(who, log)
{
name = who;
this.log = log
}
def salute() { log.info "Hello $name" }
def static salute( who, log ) { log.info "Hello again $who!" }
}
Ií we create a Groo·v Script Step in a 1est(ase. we can use the abo·e class with the íollowing:
def greet = new soapui.demo.Greet( "Ole", log )
greet.salute()
Running this írom within the Groo·v Lditor will show roughlv, the íollowing in the Groo·v Lditors log:
Wed Jun 27 01:36:14 CEST 2007:INFO:Hello Ole
\e can also call the static salute method:
soapui.demo.Greet.salute( "Ole", log )
\hich will produce the íollowing output:
Wed Jun 27 01:36:14 CEST 2007:INFO:Hello again Ole!
Ií we now modiív the abo·e Greet.groo·v íile and change the íirst salute method to include an
exclamation mark at the end. soapUI will pick up the modiíied íile once it has been sa·ed,. which is seen
in the soapUI log:
Wed Jun 27 01:39:20 CEST 2007:INFO:C:\workspace\soapui-pro\scripts\Greet.groovy is
new or has changed, reloading...
1 . 7 S C R I P T I N G
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
And now when we rerun our initial script we get:
Wed Jun 27 01:40:16 CEST 2007:INFO:Hello Ole!
Next: \orkspaces
1 . 7 S C R I P T I N G
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
1.7.1
Script Library
......................................................................................................................................
soapUI Scripting
soapUI pro·ides extensi·e options íor scripting. using Groo·v as its scripting language vou can get more
iníormation. tutorials. etc on the Groo·v \eb Site ,. Scripts can be used at the íollowing places in
soapUI:
· As part oí a 1est(ase with the Groo·v Script 1estStep . allowing vour tests to períorm ·irtuallv anv
desired íunctionalitv
· Beíore and aíter running a 1est(ase or 1estSuite íor initializing´cleaning up beíore´aíter running
vour tests.
· \hen starting´stopping a MockSer·ice to intializing´cleaning-up MockSer·ice state
· \hen opening´closing a Project . íor initializing´cleaning-up Project related settings
· As a dvnamic DataSource or DataSink with the corresponding DataSource´DataSink test steps
· lor pro·iding dvnamic MockOperation dispatching .
· lor creating dvnamic MockResponse content
· lor creating arbitrarv assertions with the Script Assertion
· 1o extend soapUI itselí see Lxtending soapUI ,. íor adding arbitrarv íunctionalitv to the soapUI
core
All scripts ha·e access to a number oí situation-speciíic ·ariables. alwavs including a log object íor
logging to the Groo·v Log and a context object íor períorm context-speciíic PropertvLxpansions
and´or propertv handling ií applicable,. A context-speciíic ·ariable is alwavs a·ailable íor directlv
accessing the soapUI object model.
Script Editors
Script editors are generallv a·ailable as inspectors at the bottom oí the corresponding objects editor. each
ha·ing a run button. a drop-down edit menu same as the right-click popup,. an iníormation label. and a
help button:
1 . 7 . 1 S C R I P T L I B R A R Y
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
1he popup-menu as shown abo·e, contains standard edit-related actions and will in soapUI Pro contain
a "Get Data" menu option that expands to show all properties a·ailable within the current scope.
Selecting a propertv or the option to create a new one, will e·entuallv create a script to get the ·ariable.
íor example
def test = context.expand( '${#Project#test}' )
\hich gets the Project-le·el "test" propertv.
It is also possible to drag a propertv írom the na·igator tree when it is in Propertv-Mode into the script: ií
the dragged propertv is "within scope" ie can be accessed ·ia propertv-expansion,. the corresponding
access script will be created at the caret location
Groovy Script Library
soapUI Pro adds the possibilitv to ha·e a central librarv oí Groo·v (lasses that can be accessed írom anv
script within soapUI. which can be useíul íor centralizing common tasks´íunctionalitv and íor creating
soapUI extensions . Use as íollows:
· Speciív which íolder to use in the soapUI Pro Preíerences tab deíault is ·working
directorv·´scripts,. soapUI Pro will check this íolder íor íiles with the "Groo·v" extension and
compile these upon startup. 1he íolder is then checked periodicallv e·erv 5 seconds, íor updates and
new´existing scripts are re,compiled ií necessarv.
· Scripts should be placed in íolders named aíter their containing package. ie a script in the package
soapui.demo should be in a soapui/demo íolder under the speciíied scripts íolder.
· 1he compiled classes are added to the parent class loader oí all groo·v-scripts. vou can access them as
standard ja·a classes.
Remember that the script íiles must be ·alid classes. not just arbitrarv scripts... see example below.
1 . 7 . 1 S C R I P T L I B R A R Y
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
Example
1he íollowing example is included with the soapUI Pro distribution. it consists oí the íollowing
Greet.groo·v íile that is located in the deíault scripts íolder:
package soapui.demo
class Greet
{
def name
def log
Greet(who, log)
{
name = who;
this.log = log
}
def salute() { log.info "Hello $name" }
def static salute( who, log ) { log.info "Hello again $who!" }
}
Ií we create a Groo·v Script Step in a 1est(ase. we can use the abo·e class with the íollowing:
def greet = new soapui.demo.Greet( "Ole", log )
greet.salute()
Running this írom within the Groo·v Lditor will show roughlv, the íollowing in the Groo·v Lditors log:
Wed Jun 27 01:36:14 CEST 2007:INFO:Hello Ole
\e can also call the static salute method:
soapui.demo.Greet.salute( "Ole", log )
\hich will produce the íollowing output:
Wed Jun 27 01:36:14 CEST 2007:INFO:Hello again Ole!
Ií we now modiív the abo·e Greet.groo·v íile and change the íirst salute method to include an
exclamation mark at the end. soapUI will pick up the modiíied íile once it has been sa·ed,. which is seen
in the soapUI log:
Wed Jun 27 01:39:20 CEST 2007:INFO:C:\workspace\soapui-pro\scripts\Greet.groovy is
new or has changed, reloading...
1 . 7 . 1 S C R I P T L I B R A R Y
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
And now when we rerun our initial script we get:
Wed Jun 27 01:40:16 CEST 2007:INFO:Hello Ole!
Next: \orkspaces
1 . 7 . 1 S C R I P T L I B R A R Y
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
1.8
Properties
......................................................................................................................................
Properties
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 subsription ID
· 1estSuite : íor handling 1estSuite scoped ·alues. can be seen as "arguments" to a 1estSuite
· 1est(ases : í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
· MockSer·ices : í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´(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
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 . 8 P R O P E R T I 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
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´authentication settings.
just speciív the corresponding expansions in the endpoint´authentications properties and thev will get
expanded when used
Property Expansion
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,
· [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. ie 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. (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
1 . 8 P R O P E R T I 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
í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. ie 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.
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-expansion is supported in manv places in soapUI:
1 . 8 P R O P E R T I 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
· request messages
· mock response messages írom the MockRun(ontext see Response Scripts ,. testStepName is
ignored.
· XPath´XOuerv assertions and their matching ·alues
· (ontains´Not-(ontains content assertions
· Request endpoints and authentication settings
· custom request´mock-response l11P leaders
· Propertv-1ransíer source´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´password ·alues
· SAML Assertions
· etc.. etc..
Ií the speciíied propertv in an expansion is not a·ailable during processing. an emptv string will be output
instead. Ií vou are missingt 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)
1 . 8 P R O P E R T I 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
<any defined property> the properties' value (read-only)
...........................................................................................................................................................................................
DataSink Step (soapUI Pro only)
<any defined property> the properties' value
...........................................................................................................................................................................................
MockResponse Step (soapUI Pro only)
Request The last request message (read-only)
...........................................................................................................................................................................................
Response The configured response message
Next: Load1esting
1 . 8 P R O P E R T I 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
1.8.1
Property Expansion
......................................................................................................................................
Properties
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 subsription ID
· 1estSuite : íor handling 1estSuite scoped ·alues. can be seen as "arguments" to a 1estSuite
· 1est(ases : í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
· MockSer·ices : í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´(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
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 . 8 . 1 P R O P E R T Y E X P A N S I O N
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
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´authentication settings.
just speciív the corresponding expansions in the endpoint´authentications properties and thev will get
expanded when used
Property Expansion
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,
· [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. ie 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. (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
1 . 8 . 1 P R O P E R T Y E X P A N S I O N
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
í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. ie 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.
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-expansion is supported in manv places in soapUI:
1 . 8 . 1 P R O P E R T Y E X P A N S I O N
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
· request messages
· mock response messages írom the MockRun(ontext see Response Scripts ,. testStepName is
ignored.
· XPath´XOuerv assertions and their matching ·alues
· (ontains´Not-(ontains content assertions
· Request endpoints and authentication settings
· custom request´mock-response l11P leaders
· Propertv-1ransíer source´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´password ·alues
· SAML Assertions
· etc.. etc..
Ií the speciíied propertv in an expansion is not a·ailable during processing. an emptv string will be output
instead. Ií vou are missingt 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)
1 . 8 . 1 P R O P E R T Y E X P A N S I O N
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
<any defined property> the properties' value (read-only)
...........................................................................................................................................................................................
DataSink Step (soapUI Pro only)
<any defined property> the properties' value
...........................................................................................................................................................................................
MockResponse Step (soapUI Pro only)
Request The last request message (read-only)
...........................................................................................................................................................................................
Response The configured response message
Next: Load1esting
1 . 8 . 1 P R O P E R T Y E X P A N S I O N
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
1.9
Functional Testing
......................................................................................................................................
Functional Testing
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 six 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 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: 1estSuites
1 . 9 F U N C T I O N A L T E S T I N G
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
1.9.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 TestCase from some request
Once vou ha·e some requests working as vou want. vou can create a 1est(ase that ·eriíies their
beha·iour
· Select the second toolbar button in the request editor window "Add this request to a test-case",.
· Ií there are no 1estSuites´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 in the User Guide
1 . 9 . 1 G E T T I N G S T A R T E D
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
Add Assertions
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
Read more about assertions in the User Guide
1 . 9 . 1 G E T T I N G S T A R T E D
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
Now run your 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 command line tools a·ailable.
Next: Getting Started with Load1esting
1 . 9 . 1 G E T T I N G S T A R T E D
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
1.9.2
TestSuites
......................................................................................................................................
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!
1 . 9 . 2 T E S T S U I T 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
· 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
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.
· 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
1 . 9 . 2 T E S T S U I T E 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
Bar displavs this and the 1est(ase will not be run during 1estSuite execution.
1he a·ailable toolbar buttons are leít to right,:
· 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
1he 1estSuite log window at the bottom shows all step´run results íor the last 1estSuite run
1 . 9 . 2 T E S T S U I T E 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
Generating Reports
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.
1 . 9 . 2 T E S T S U I T E 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
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
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.
1 . 9 . 2 T E S T S U I T E 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
Next: 1est(ases
1 . 9 . 2 T E S T S U I T E 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
1.9.3
TestCases
......................................................................................................................................
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.
Lach 1estStep in a 1est(ase exposes a number oí properties which can be read´written´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.
TestStep Types
(urrentlv the í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.
...........................................................................................................................................................................................
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
...........................................................................................................................................................................................
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
...........................................................................................................................................................................................
MockResponse Step Waits/Listens for an incoming SOAP Request that can be validated
and return a mock response - soapUI pro only
1 . 9 . 3 T E S T C A S E 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
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´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
· Online Help - Displavs this page in an external browser
1 . 9 . 3 T E S T C A S E 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
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 . 9 . 3 T E S T C A S E S
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
Ií selecting to clone to another project. soapUI will prompt to clone required interíaces to that project as
well.
Clone TestSteps (soapUI Pro only)
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(ase 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 . 9 . 3 T E S T C A S E S
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
The TestCase Editor
Double-clicking a 1est(ase node in the na·igator or selecting its Open 1estCase Lditor menu option
opens the 1est(ase editor´runner. 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´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
· 1earDown Script : A Groo·v script to run when the 1est(ase íinishes
1 . 9 . 3 T E S T C A S 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
· 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 . 9 . 3 T E S T C A S 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
The main 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
· 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´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
· Append Step -> - shows a list oí appendable 1estStep tvpes íor the 1est(ase
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 ,.
1 . 9 . 3 T E S T C A S 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
TestCase Options
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 cancelled 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 testcases 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 cancelling´íailing a running
1est(ase
1 . 9 . 3 T E S T C A S 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
Clone TestStep
Selecting to clone a 1estStep írom a 1estSteps menu displavs the íollowing dialog:
1 . 9 . 3 T E S T C A S 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
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 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:
TestCase Coverage
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
1 . 9 . 3 T E S T C A S 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
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.
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 . 9 . 3 T E S T C A S 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
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: \orking with 1estRequests
1 . 9 . 3 T E S T C A S E S
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
1.9.3 TESTCASES
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.9.3.1
Test Requests
......................................................................................................................................
TestRequests
1est-Requests extend standard requests with the possibilitv to add anv number oí "Assertions" that will
be applied to the response recei·ed íor the request.
1est-Requests are either created írom standard requests using their "Add to 1estcase" action or írom the
1est(ase Lditors popup menu with the "Insert Step -· 1est Request" option shown to the right,. which
will prompt íor which Interíace´Operation the request should be create íor.
In either case. a dialog will also prompt to add certain standard assertions so this must not be done
manuallv íor each request:
1est-Requests are submitted either manuallv through their editors submit actions or when running the
1est(ase containing the request. 1he requests response is ·alidated against a requests assertions and the
requests icon changes to reílect the result oí the ·alidations: green~all ·alidations ok. red~some
·alidations, íailed. A grev background icon indicates that the request has not vet been submitted íor
·alidation. a white background indicates that the 1estRequest lacks assertions
TestRequest Actions
1he íollowing actions are a·ailable írom the test-request nodes' right-button menu:
· Open Lditor - opens the associated 1estStep editor ií a·ailable,
· Disable/Lnable 1estStep - disables´enables the 1estStep íor execution
1 . 9 . 3 . 1 T E S T R E Q U E S T S
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
· 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,
· Change Operation - prompts to change the operation íor this 1estRequest see below,
· Select Operation - selects this 1estRequests operation in the Na·igator
· Clone Assertions (soapUI Pro only) - promps to clone assertions írom this 1estRequest to other
1estRequests see below,
· Online Help - displavs this page in a browser
TestRequest Details Tab
1he "Details" tab shown in the bottom-leít shows the same properties when a 1estRequest node is
selected in the na·igation tree as íor a standard request see the Request Details 1ab íor more detailed
iníormation, and adds two read-onlv properties:
· Interface : the name oí the Interíace íor this 1estRequest
· Operation : the name oí the Operation íor this 1estRequest
1 . 9 . 3 . 1 T E S T R E Q U E S T S
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
Change Operation
Selecting to change the operation íor a 1estRequest opens the íollowing dialog:
1he list oí Interíaces displavs those a·ailable in the current project. the list oí Operations is updated
accordinglv.
The TestRequest Editor
Double-clicking a 1estRequest in either the na·igator or the 1est(ase Lditor Pane opens the requests
editor which is more or less a copv oí the standard Request Lditor with the íollowing exception:
· 1he second toolbar-button "Add to 1estcase" has been replaced with "Add Assertion" which
prompts to add an assertion to the 1estRequest
· 1he clone action now clones the 1estRequest and appends the cloned request to the containing
1est(ase
· Under the request´response panes there is a now a tabbed pane containing 2 tabs: the "Assertions"
tab and the "Request Log" tab both described below,.
All other editing´submittal´·alidation íunctionalitv is the same as in the request editor
The Assertions Tab
1 . 9 . 3 . 1 T E S T R E Q U E S T S
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
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.
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.
1he toolbar contains corresponding actions and a "(lone Assertions" action íor cloning a number oí
assertions to other 1estRequests see below,
Clone Assertions
soapUI Pro contains a right-button´assertion-toolbar action íor cloning an arbitrarv number oí assertions
to other 1estRequests. 1he dialog shown is as íollows:
1 . 9 . 3 . 1 T E S T R E Q U E S T S
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
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 corrsponding assertions exist in
the target 1estSteps,. thev will be ignored.
· Open List - opens a seperate 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.
1 . 9 . 3 . 1 T E S T R E Q U E S T S
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
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´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 . 9 . 3 . 1 T E S T R E Q U E S T S
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
Next: Assertions
1 . 9 . 3 . 1 T E S T R E Q U E S T S
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.9.3.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´propertv to be transíerred. the target´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´to. soapUI Pro adds an XPath
Selector button to the right oí these combo boxes íor easilv selecting the source´target XPath expression
írom the selected source´target propertv.
1 . 9 . 3 . 2 P R O P E R T Y T R A N S F E R 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 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 . 9 . 3 . 2 P R O P E R T Y T R A N S F E R 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
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 . 9 . 3 . 2 P R O P E R T Y T R A N S F E R 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
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 . 9 . 3 . 2 P R O P E R T Y T R A N S F E R 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
1arget XPath:
declare namespace ns='http://webservices.amazon.com/AWSECommerceService/2006-02-15';
(//ns:Author)[1]
Next: (onditional Goto Steps
1 . 9 . 3 . 2 P R O P E R T Y T R A N S F E R 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.9.3.3
Conditional Gotos
......................................................................................................................................
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 examples below,
The 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 . 9 . 3 . 3 C O N D I T I O N A L G O T O 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
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
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 . 9 . 3 . 3 C O N D I T I O N A L G O T O 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
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: Groo·v Script Steps
1 . 9 . 3 . 3 C O N D I T I O N A L G O T O 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
1.9.3.4
Groovy Scripts
......................................................................................................................................
Groovy Scripts
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 . 9 . 3 . 4 G R O O V Y S C R I P T 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
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 1estRunner running the current 1est(ase. this will íor now alwavs be an instance
oí \sdl1est(aseRunner
· context : the 1estRun(ontext running the current 1est(ase. this will íor now alwavs be an instance
oí \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
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 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" );
1 . 9 . 3 . 4 G R O O V Y S C R I P T 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
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 )
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();
1 . 9 . 3 . 4 G R O O V Y S C R I P T 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
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 )
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" ))
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:
1 . 9 . 3 . 4 G R O O V Y S C R I P T 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
· 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
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 )
1 . 9 . 3 . 4 G R O O V Y S C R I P T 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
// 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 )
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: Propertv Steps
1 . 9 . 3 . 4 G R O O V Y S C R I P T 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
1.9.3.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´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´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
· 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
1 . 9 . 3 . 5 P R O P E R T I E S S T E P
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
and names can be changed bv standard editing.
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
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: Delav 1estStep
1 . 9 . 3 . 5 P R O P E R T I E S S T E P
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.9.3.6
Delay Step
......................................................................................................................................
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: MockResponse Step
1 . 9 . 3 . 6 D E L A Y S T E P
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
1.9.3.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´í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
· A table containing the same properties as the target 1est(ase. Onlv the propertv-·alues are editable
1 . 9 . 3 . 7 R U N T E S T C A S E
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
· 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 . 9 . 3 . 7 R U N T E S T C A S E
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
Next:
1 . 9 . 3 . 7 R U N T E S T C A S E
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
1.9.3.8
Mock Response
......................................................................................................................................
soapUI Pro MockResponse Step
soapUI Pro includes a MockResponse step that listens´waits íor a SOAP Request and returns a
preconí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´incorrect responses to test a
client`s beha·iour
· 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´1estStep
Insert´Add operations:
1he dialog contains the íollowing options:
1 . 9 . 3 . 8 M O C K R E S P O N S E
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
· 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 . 9 . 3 . 8 M O C K R E S P O N S E
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
· lrom a MockResponse Nodes' right-click menu to add it to a 1est(ase. using the existing
MockResponse content ií a·ailable,.
The MockResponse Step Editor
1he MockResponse Step is the basicallv the same as the standard 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
1 . 9 . 3 . 8 M O C K R E S P O N S E
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
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.
MockResponse Step Execution
\hen the execution oí a 1est(ase reaches a MockResponse Step. the step will start 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:
· A MockSer·ice is started and stopped íor each time the MockResponse step executes. Ií the request
to the temporarv MockSer·ice comes in beíore it has time to start. it will get a standard 404 error
message back.
1 . 9 . 3 . 8 M O C K R E S P O N S E
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
· Ií there are se·eral threads running´waiting íor a request. in which order should soapUI dispatch
incoming requests to these· (urrentlv soapUI onlv starts one MockSer·ice at a time. the íirst thread
to get to the MockResponse step gets to wait íirst. Subsequent steps will need to wait until "their
turn".
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: DataSource Step
1 . 9 . 3 . 8 M O C K R E S P O N S E
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
1.9.3.9
DataSource
......................................................................................................................................
soapUI Pro DataSource Steps
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( datasource
· Lxcel DataSource - extracts data írom an Lxcel xls, íile
· Grid DataSource - allows entrv´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 . 9 . 3 . 9 D A T A S O U R C E
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
1he list oí Properties must contain the properties that will be "exposed" bv the DataSource step. thev are
added´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 . 9 . 3 . 9 D A T A S O U R C E
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
1he íollowing settings are a·ailable:
· Shared - controls whether this DataSource should be shared between threads in a Load1est see
below,
· 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
· 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
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.
1 . 9 . 3 . 9 D A T A S O U R C E
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
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
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
1 . 9 . 3 . 9 D A T A S O U R C E
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
· 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:
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:
· 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:
1 . 9 . 3 . 9 D A T A S O U R C E
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
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:
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
1 . 9 . 3 . 9 D A T A S O U R C E
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
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:
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: DataSourceLoop Step
1 . 9 . 3 . 9 D A T A S O U R C E
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
1.9.3.10
DataSource Loop
......................................................................................................................................
soapUI Pro DataSourceLoop Step
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: Propertv Lxpansion
1 . 9 . 3 . 1 0 D A T A S O U R C E L O O P
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
1.9.3.11
DataSink
......................................................................................................................................
soapUI Pro DataSink Step
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
The 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 . 9 . 3 . 1 1 D A T A S I N K
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
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
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,
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.
JDBC DataSink
1he JDB( DataSink has the íollowing coníiguration panel:
1 . 9 . 3 . 1 1 D A T A S I N K
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
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
Excel DataSink
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
1 . 9 . 3 . 1 1 D A T A S I N K
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
· 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.
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
Groovy DataSink
1he Groo·v DataSink has the íollowing coníiguration panel:
1 . 9 . 3 . 1 1 D A T A S I N K
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
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
Next: Load 1esting
1 . 9 . 3 . 1 1 D A T A S I N K
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.10
Load Testing
......................................................................................................................................
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 command
line execution
· Requirements-Dri·en Load1esting : deíine períormance requirements and continuouslv ·alidate
using load-test 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
· (oníiguration : describes limits and strategies
· Lxecution : describes the execution oí Load1ests
· Assertions : speciíies the a·ailable Load1est assertions and how thev are used
· 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 web ser·ice ´ 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 . 1 0 L O A D T E S T I N G
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
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 . 1 0 L O A D T E S T I N G
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
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 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 . 1 0 L O A D T E S T I N G
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
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 . 1 0 L O A D T E S T I N G
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
· 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 . 1 0 L O A D T E S T I N G
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
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: Load1est (oníiguration
1 . 1 0 L O A D T E S T I N G
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.10.1
Getting Started
......................................................................................................................................
Getting Started with Load Testing
soapUI 1.5 introduces íairlv poweríul 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 preconíigured to run íor 60 seconds top right, with 5 threads using the Simple
LoadStrategv. Modiív these ·alues as desired read more about 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
1 . 1 0 . 1 G E T T I N G S T A R T E D
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
íinished Load1est as íollows read more about Load1est Lxecution ,:
Add Assertions
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 ms
· Max Lrrors - the maximum number oí errors to allow beíore cancelling 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 . 1 0 . 1 G E T T I N G S T A R T E D
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
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.
1 . 1 0 . 1 G E T T I N G S T A R T E D
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
\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:
1 . 1 0 . 1 G E T T I N G S T A R T E D
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
Now What?
1rv plaving around with the diííerent Load1est Strategies. Diagrams . etc..
Next: Getting Started with Mocking
1 . 1 0 . 1 G E T T I N G S T A R T E D
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
1.10.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
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
1 . 1 0 . 2 L I M I T & S T R A T E G I E S
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
strategv to monitor how base períormance is aííected when running both Load1ests simultaneouslv
within soapUI or írom the command-line.
Simple
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
Variance
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.
Burst
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.
1hread
1he 1hreads Strategv has the íollowing settings:
1 . 1 0 . 2 L I M I T & S T R A T E G I E S
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
· 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.
Next: Load1est Lxecution
1 . 1 0 . 2 L I M I T & S T R A T E G I E S
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
1.10.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 limit
· It has been cancelled bv the user with the "(ancel" button on the Load1est toolbar
· It has been cancelled 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´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í.
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 . 1 0 . 3 E X E C U T I O N
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
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 . 1 0 . 3 E X E C U T I O N
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
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 . 1 0 . 3 E X E C U T I O N
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
Next: Load1est Assertions
1 . 1 0 . 3 E X E C U T I O N
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
1.10.4
Assertions
......................................................................................................................................
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 . 1 0 . 4 A S S E R T I O N S
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
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 . 1 0 . 4 A S S E R T I O N S
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
· 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 . 1 0 . 4 A S S E R T I O N S
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
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 . 1 0 . 4 A S S E R T I O N S
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
Next: Load1est Diagrams
1 . 1 0 . 4 A S S E R T I O N S
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
1.10.5
Diagrams
......................................................................................................................................
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 Statistics Diagram
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 . 1 0 . 5 D I A G R A M S
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
The Statistics History Diagram
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 (omparison
1 . 1 0 . 5 D I A G R A M S
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
1.10.6
JMeter comparison
......................................................................................................................................
JMeter 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´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-testing web 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 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"
listener is coníigured íor collecting the results.
1 . 1 0 . 6 J M E T E R C O M P A R I S O N
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
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 . 1 0 . 6 J M E T E R C O M P A R I S O N
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
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 . 1 0 . 6 J M E T E R C O M P A R I S O 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
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 . 1 0 . 6 J M E T E R C O M P A R I S O 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
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 comparison-íiles.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 . 1 0 . 6 J M E T E R C O M P A R I S O 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
1.11
Mocking
......................................................................................................................................
Web Service Mocking
soapUI 1.¯ introduces the possibilitv to create Mock Implementations 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:
· (lient de·elopment ´ 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 Dri·en de·elopment írom \SDL contract both ser·er 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.
· \eb Ser·ice rapid prototvping : 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: Mock Ser·ices
1 . 1 1 M O C K 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
1.11 MOCKING
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.11.1
Getting Started
......................................................................................................................................
Getting Started with Mocking
soapUI 1.¯ introduces 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 Prototvping oí \eb Ser·ices: 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´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´1est(ases against MockSer·ices beíore´during
the actual ser·ices ha·e been´are 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 publicallv 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:
1 . 1 1 . 1 G E T T I N G S T A R T E D
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
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´resizing around vou should be able to arri·e at the íollowing:
1 . 1 1 . 1 G E T T I N G S T A R T E D
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
1he MockSer·ice editor top leít, contains a toolbar. a list oí all operations íor the ser·ice and a
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
1 . 1 1 . 1 G E T T I N G S T A R T E D
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
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:
1 . 1 1 . 1 G E T T I N G S T A R T E D
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
(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
1 . 1 1 . 1 G E T T I N G S T A R T E D
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
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:
· Add 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·iour database´íile access. input processing. etc..,. attachments.
custom response http headers. etc..
· 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: soapUI User Guide
1 . 1 1 . 1 G E T T I N G S T A R T E D
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
1.11.2
Mock Services
......................................................................................................................................
Mock 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´Schema
deíinition in the same manor as when importing interíaces and creating requests.
1 . 1 1 . 2 M O C K S E R V I 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
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,
1 . 1 1 . 2 M O C K S E R V I 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
· Require 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.
· 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:
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
1 . 1 1 . 2 M O C K S E R V I 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
· 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 1 . 2 M O C K S E R V I 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
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
1 . 1 1 . 2 M O C K S E R V I 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
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
MockSer·ices MockOperation:
1 . 1 1 . 2 M O C K S E R V I 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
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 1 . 2 M O C K S E R V I 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
... 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..
Next: Mock Operations
1 . 1 1 . 2 M O C K S E R V I 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
1.11.2.1
Coverage
......................................................................................................................................
MockService Coverage
\hen enabling (o·erage íor a MockSer·ice. soapUI will continuouslv accumulate and analvze mock
requests´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.
Next:
1 . 1 1 . 2 . 1 C O V E R A G E
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
1.11.3
Mock Operations
......................................................................................................................................
Mock Operations
A MockOperation corresponds to 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
1 . 1 1 . 3 M O C K O P E R A T I O N 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
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:
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
1 . 1 1 . 3 M O C K O P E R A T I O N 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
· 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
A Dispatch 1oolbar and coníiguration are below whose content depends on the selected dispatch stvle
see below,
1 . 1 1 . 3 M O C K O P E R A T I O N 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
Request Dispatching
Incoming requests to a MockOperation can be dispatched in one oí 4 wavs using the dispatch combo
box:
· Sequence - dispatches to the coníigured responses in sequence. starting írom the beginning when
the last has been reached.
· Random - dispatches randomlv between existing MockResponses
· XPath - dispatches based on a speciíied XPath expression that will be used to select the name oí the
MockResponse step to dispatch to.
· Script - allows a Groo·v script íor dispatching based on anv arbitrarv criteria
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
XPath Selector .
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
· 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 Responses
1 . 1 1 . 3 M O C K O P E R A T I O N 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.11.4
Mock Responses
......................................................................................................................................
Mock Responses
A MockResponse holds an actual response to returned írom a MockOperation. 1he response can be
coníigured in regard 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
· Add to 1estCase - prompts to add a corresponding MockResponse Step to a 1est(ase
· Open Request - prompts to open the editor íor an existing request íor this MockResponses
MockOperation with the correct local endpoint.
· 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:
1 . 1 1 . 4 M O C K R E S P O N S E S
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
· 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.
· 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
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.
· Response Delay : \aits the speciíied number oí milliseconds beíore returning the response.
The MockResponse Editor
Double-clicking a MockResponse in the na·igator or MockOperation editor opens the MockResponse
editor as seen below:
1 . 1 1 . 4 M O C K R E S P O N S E S
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
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
1he toolbar at the top oí the MockResponse editor contains the íollowing actions leít to right,:
· Open Request - Opens a new´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
1 . 1 1 . 4 M O C K R E S P O N S E S
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
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.
· 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>
1 . 1 1 . 4 M O C K R E S P O N S E S
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
Next: Usage Scenarios
1 . 1 1 . 4 M O C K R E S P O N S E S
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
1.12
SOAP Monitoring
......................................................................................................................................
SOAP Monitor
soapUI 2.0 adds poweríul SOAP Monitoring possibilities ie tcpmon,. allowing vou to capture and
analvze ongoing SOAP-traííic 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:
· Proxv : 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.
· 1unnel : starts the monitor as a 1(P-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.
1he Incomging Request´Response \SS settings are used to select the Incoming \SS coníigurations to
use íor decrvpting´·alidating monitored messages. which can be useíul íor ·iewing encrvpted content
1 . 1 2 S O A P M O N I T O R 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
and ·alidating securitv
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ííig Log" and "(o·erage" in soapUI Pro,
· A traííic-log toolbar with actions to create requests. testcases. 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 2 S O A P M O N I T O R 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
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:
· (reate Requests : creates requests under their corresponding operations íor each selected request in
the traííic log
· (reate 1est(ase : 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
· (reate MockSer·ice : prompts to create a MockSer·ice or add to an existing one,. bv creating
MockOperations´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:
1 . 1 2 S O A P M O N I T O R 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.12.1
Coverage
......................................................................................................................................
SOAP Monitor Coverage
\hen enabling (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:
1 . 1 2 . 1 C O V E R A G E
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.13
Usage Scenarios
......................................................................................................................................
Usage Scenarios
1his section describes some more "complete" soapUI usage scenarios. currentlv the íollowing are
described:
Scenario Description
Data-Driven Testing Shows how to use a combination of TestSteps and/or Groovy Scripts
to allow test-data (query parameters, username/password, etc) to be
provided from an external source
...........................................................................................................................................................................................
Template-Driven 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 1esting
1 . 1 3 U S A G E S C E N A R I O 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
Data-Driven Testing
......................................................................................................................................
Data-Driven Testing
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 3 . 1 D A T A - D R I V E N T E S T I N G
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
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 3 . 1 D A T A - D R I V E N T E S T I N G
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
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 3 . 1 D A T A - D R I V E N T E S T I N G
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
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 3 . 1 D A T A - D R I V E N T E S T I N G
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
Next: 1emplate-Dri·en 1esting
1 . 1 3 . 1 D A T A - D R I V E N T E S T I N G
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
1.13.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´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 3 . 2 T E M P L A T E - D R I V E N T E S T I N G
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
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 3 . 2 T E M P L A T E - D R I V E N T E S T I N G
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
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 3 . 2 T E M P L A T E - D R I V E N T E S T I N G
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
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 1esting
1 . 1 3 . 2 T E M P L A T E - D R I V E N T E S T I N G
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.13.2 TEMPLATE-DRIVEN TESTING
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.13.3
Interactive Testing
......................................................................................................................................
Interactive 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 3 . 3 I N T E R A C T I V E T E S T I N G
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
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 3 . 3 I N T E R A C T I V E T E S T I N G
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
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 3 . 3 I N T E R A C T I V E T E S T I N G
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
<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 3 . 3 I N T E R A C T I V E T E S T I N G
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
and shows the íollowing result:
1 . 1 3 . 3 I N T E R A C T I V E T E S T I N G
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
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: Sur·eillance 1esting
1 . 1 3 . 3 I N T E R A C T I V E T E S T I N G
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.13.4
Surveillance Testing
......................................................................................................................................
Surveillance Testing
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 3 . 4 S U R V E I L L A N C E T E S T I N G
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
Running 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 3 . 4 S U R V E I L L A N C E T E S T I N G
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
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 3 . 4 S U R V E I L L A N C E T E S T I N G
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
[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 3 . 4 S U R V E I L L A N C E T E S T I N G
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
(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 3 . 4 S U R V E I L L A N C E T E S T I N G
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
Run the 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 3 . 4 S U R V E I L L A N C E T E S T I N G
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
(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 3 . 4 S U R V E I L L A N C E T E S T I N G
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
(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: 1ool Integrations
1 . 1 3 . 4 S U R V E I L L A N C E T E S T 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.14
Tool Integrations
......................................................................................................................................
Tool Integrations
soapUI pro·ides integrated support íor a number oí open-source web ser·ice toolkits and utilities.
including:
1. Code Generation 1ools allow generation oí client´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 1cp-Mon 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 4 T O O L I N T E G R A T I O N 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
the image shows possible coníiguration ·alues íor all integrations,
Next: (ode Generation 1ools
1 . 1 4 T O O L I N T E G R A T I O N 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
1.14.1
Code Generation
......................................................................................................................................
Code Generation Tools
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 wstools . JBoss\S wsconsume . 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 4 . 1 C O D E G E N E R A T I O N
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
Custom Arguments
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´output oí the in·oked tools process. During the process execution a "(ancel" button
will be a·ailable íor cancelling 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 wscompile tool:
1 . 1 4 . 1 C O D E G E N E R A T I O N
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
JBossWS wstools
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
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
1 . 1 4 . 1 C O D E G E N E R A T I O 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
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 4 . 1 C O D E G E N E R A T I O 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
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 4 . 1 C O D E G E N E R A T I O 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
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(P-Mon
1 . 1 4 . 1 C O D E G E N E R A T I O 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
1.14.2
Apache Tcp-Mon
......................................................................................................................................
Apache Tcp-Mon Integration
1he Apache 1cp-Mon utilitv can be used to "listen in" on anv http-traííic. including oí course SOAP
request´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 4 . 2 A P A C H E T C P - M O 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
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 4 . 2 A P A C H E T C P - M O 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
Next: (ommand-Line 1ools
1 . 1 4 . 2 A P A C H E T C P - M O 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
CommandLine Tools
......................................................................................................................................
soapUI CommandLine tools
soapUI currentlv comes with the íollowing commandline 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
1 . 1 5 C O M M A N D L I N E T O O L S
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
1.15.1
TestCaseRunner
......................................................................................................................................
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.
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,.
1 . 1 5 . 1 T E S T C A S E R U N N E R
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
Launch Dialog
lor getting started with the command-line testrunner. soapUI includes a "Launch Load1estRunner"
action a·ailable írom Project´1estSuite´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
testrunner will be launched írom the command-line as coníigured and the output can be íollowed:
1 . 1 5 . 1 T E S T C A S E R U N N E R
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
1he output contains the actual command-line command used íor launching the runner. which can easilv
be copv´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"
);
TestSuite testSuite = project.getTestSuiteByName( "Test Suite" );
1 . 1 5 . 1 T E S T C A S E R U N N E R
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
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
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
-----------------------------
1 . 1 5 . 1 T E S T C A S E R U N N E R
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
Time Taken: 1895ms
Total TestSuites: 1
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
1 . 1 5 . 1 T E S T C A S E R U N N E R
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
with the xml-report íormat. (urrentlv. soapUI maps 1estSuites to report-packages and 1est(ases to
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 5 . 1 T E S T C A S E R U N N E R
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
\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
1 . 1 5 . 1 T E S T C A S E R U N N E R
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
1.15.2
LoadTestRunner
......................................................................................................................................
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)
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.
1 . 1 5 . 2 L O A D T E S T R U N N E R
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
Launch 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
Load1estRunner will be launched írom the command-line as coníigured and the output can be íollowed:
1 . 1 5 . 2 L O A D T E S T R U N N E R
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
1he output contains the actual command-line command used íor launching the runner. which can easilv
be copv´pasted íor external reuse
Reporting and Exporting
1he SoapUILoad1estRunner has limited reporting íunctionalities. 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
[testcase3]
15:31:59,941 INFO [SoapUILoadTestRunner] Running LoadTest [LoadTest1]
1 . 1 5 . 2 L O A D T E S T R U N N E R
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
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
1 . 1 5 . 2 L O A D T E S T R U N N E R
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.3
MockServiceRunner
......................................................................................................................................
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
...........................................................................................................................................................................................
s The soapui-settings.xml file to use
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
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
1 . 1 5 . 3 M O C K S E R V I C E R U N N E R
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
/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
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
1 . 1 5 . 3 M O C K S E R V I C E R U N N E R
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
1.15.4
ToolRunner
......................................................................................................................................
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)
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;
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
1 . 1 5 . 4 T O O L R U N N E R
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
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: Kevboard shortcuts
1 . 1 5 . 4 T O O L R U N N E R
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
1.16
Keyboard shortcuts
......................................................................................................................................
Keyboard Shortcuts
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/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
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
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/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
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
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
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
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 O·er·iew
1 . 1 6 K E Y B O A R D S H O R T C U T S
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.17
IDE/Tool Plugins
......................................................................................................................................
IDE / Tool Plugins
soapUI comes with plug-ins íor the íollowing tools ´ IDL's
Tool/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 7 I D E / T O O L P L U G I N 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
1.17.1
Maven Plugins
......................................................................................................................................
soapUI maven plugins
soapUI includes plugins íor both ma·en 1.x and ma·en 2.x allowing one to automate 1estSuites ´
1est(ases . Load1ests and code generation pre·iouslv created´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 7 . 1 M A V E N P L U G I N 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
1.17.1.1
Maven 1.X Plugin
......................................................................................................................................
soapUI maven 1.X plugin
Download
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 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
Usage
Download´install the plugin as described abo·e. Bv deíault. the plugin 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
maven soapui:loadtest
1 . 1 7 . 1 . 1 M A V E N 1 . X P L U G I N
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
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
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 1.6 TestRunner
[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
1 . 1 7 . 1 . 1 M A V E N 1 . X P L U G I N
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
[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 []
[java] SoapUI 1.6 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]
1 . 1 7 . 1 . 1 M A V E N 1 . X P L U G I N
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
[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
Next: ma·en 1.X plugin goals
1 . 1 7 . 1 . 1 M A V E N 1 . X P L U G I N
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
1.17.1.1 MAVEN 1.X PLUGIN
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
1.17.1.2
Maven 2.X Plugin
......................................................................................................................................
soapUI maven 2.X 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>1.7.6</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 7 . 1 . 2 M A V E N 2 . X P L U G I N
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
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>1.7</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 7 . 1 . 2 M A V E N 2 . X P L U G I N
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.17.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
Download the NBM írom Sourcelorge or ·ia the NetBeans Plugin manager. Ií vou downloaded it írom
Sourcelorge. install as described in the Installation document. See the demonstration mo·ies below íor
some hands-on tutorials. otherwise the existing Getting Started 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 7 . 2 N E T B E A N S P L U G I N
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
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 7 . 2 N E T B E A N S P L U G I N
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
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 7 . 2 N E T B E A N S P L U G I N
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
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´edited bv opening the NetBeans Properties \indow írom the \indow menu.
1 . 1 7 . 2 N E T B E A N S P L U G I N
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
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:
· 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.
· 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.
· 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 7 . 2 N E T B E A N S P L U G I N
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
1.17.2 NETBEANS PLUGIN
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.17.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 7 . 2 . 1 I N S T A L L A T I O N
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
· 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 7 . 2 . 1 I N S T A L L A T I O N
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
· 1he plug-in has now been installed and can be seen in the "Installed" tab:
1 . 1 7 . 2 . 1 I N S T A L L A T I O N
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
· 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 7 . 2 . 1 I N S T A L L A T I O N
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
1.17.2.1 INSTALLATION
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
1.17.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 \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´closed as usual.
lere are some screenshots:
(urrentlv. the plugin can be seen as a "le·el-1" integration. ie it is "merelv" a packaging oí soapUI
components in the IntelliJ en·ironment.
Installation
1he plugin is 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
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 NetBeans
1 . 1 7 . 3 I N T E L L I J P L U G I N
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
1.17.4
Eclipse Plugin
......................................................................................................................................
soapUI eclipse-plugin
1he soapUI eclipse plugin pro·ides íull soapUI íunctionalitv írom within eclipse. Apart írom "standard"
soapUI 1.¯ í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 Sourcelorge or through the update site located at
http:´´www.soapui.org´eclipse´update see below,
Please ·ote íor this plugin at the eclipse plugin central .
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 document and the 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 7 . 4 E C L I P S E P L U G I N
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
(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 7 . 4 E C L I P S E P L U G I N
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
Next: soapUI Nature
1 . 1 7 . 4 E C L I P S E P L U G I N
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
1.17.4.1
soapUI Nature
......................................................................................................................................
soapUI Nature
1he soapUI Nature allows integrated access to all soapUI-íunctionalitv directlv írom within a
Ja·a-project. It is not complete but has been released to gi·e an idea oí how we en·ision working with
web-ser·ices in a eclipse 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 common project actions:
Step 2: Create or Import a WSDL
\ou can either manuallv create a \SDL 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 írom
... " actions.
1 . 1 7 . 4 . 1 S O A P U I N A T U R E
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
\hen creating the \SDL in vour project. right click on the \SDL íile and select "soapUI -· Add to
soapUI Project"
Once imported. the \SDL is shown as a "standard" soapUI Interíace node under the "soapUI \eb
Ser·ices" node:
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 7 . 4 . 1 S O A P U I N A T U R E
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
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 7 . 4 . 1 S O A P U I N A T U R E
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
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
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
1 . 1 7 . 4 . 1 S O A P U I N A T U R E
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
1.18
Keyboard shortcuts
......................................................................................................................................
Keyboard Shortcuts
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/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 8 K E Y B O A R D S H O R T C U T 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
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/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 8 K E Y B O A R D S H O R T C U 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
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 8 K E Y B O A R D S H O R T C U 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
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 O·er·iew
1 . 1 8 K E Y B O A R D S H O R T C U 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

Sign up to vote on this title
UsefulNot useful