All project-related artifacts (projects, requests, test suites, and so on) are ModelItems .
You can find interface definitions in the following packages:
For example, for Interface/Operation/Request related classes), see the com.eviware.soapui.model.iface package.
For more information, see JavaDocs.
The project structure is hierarchical, and is similar to the one visible in the Navigator.
Common top level for all tools
(tool levels, see below)
ReadyAPI Test levels
ReadyAPI Test security tests levels
ReadyAPI Performance levels
ReadyAPI Virtualization levels
MockServices (virtual services)
MockOperation (virtual operation)
MockResponse (virtual response)
A modelItem name, description, icon, and so on, can be accessed through the corresponding getters.
Here are some getter examples:
It would print the name of the project variable.
Obviously, different properties and methods for accessing children are available depending on the type of ModelItem.
The general model for accessing children of a certain type for
ModelItem is as follows
(XX = the type of child):
getXXByName( String name )
getXXAt( int index )
For example, to get a certain virtual service in a project, you could use one of the following:
def mockService = project.getMockAt( 0 )
And so on.
For iterating through all LoadTests in a TestCase, you could use:
Parent objects are generally available through the name of their type, for example:
Navigates "upward" in the object model using the testSuite and project properties.
You will often want to manipulate properties within your scripts, either those that are built on or those that are custom properties, the later can be set on the following objects, projects, test suites, test cases, virtual services and the PropertiesTestStep (these all inherit from MutableTestPropertyHolder ).
Setting/getting properties is straightforward
object.setPropertyValue( "name", "value" )
object.properties["name"].value = "value"
// get property value log.info object.getPropertValue( "name" ) log.info object.properties["name"].value log.info object.properties."name".value
A context variable is always available inside different runs. This allows you to get and set context-specific variables.
|SubmitContext||Submit a request|
|LoadTestRunContext||LoadTest setUp/tearDown scripts, in TestCase context via the LoadTestContext context variable|
|MockRunContext||Virtaul service startup/shutdown scripts and Operation/VirtResponse dispatch scripts|
All these contexts inherit from the PropertyExpansionContext interface.
This interface has methods for setting/getting properties and an expand method which can be used to expand arbitrary strings containing Property Expansions.
A standard log4j Logger is available. The variable
log appends to the Log at the bottom of the window and can be used for diagnostic purposes.