Ask a Question

How to access standard, i.e. non-custom, properties?

Frequent Contributor

How to access standard, i.e. non-custom, properties?

I am trying to get hold of Property values that are NOT Custom Properties


If I define a Customer Property "foo" I can access its value using:

def bar = context.expand('${#Project#foo}')

But how do I access those left-hand standard Properties i.e. those listed on the tabs Project Properties, TestSuite Properties, TestCase Properties, REST TestRequest Properties etc.


Does access to these require some other mechanism?

Valued Contributor



You can access any public scope properties on SoapUI objects e.g. Projects, TestCases using Groovy scripts etc.


Some examples are: 


Accessing the project name from within a Groovy TestStep:


A bit more complicated example again from within a Groovy TestStep:


import com.eviware.soapui.impl.wsdl.WsdlInterface

myInterface = (WsdlInterface) testRunner.testCase.testSuite.project.getInterfaceByName("SampleServiceSoapBinding")
myOperation = myInterface.getOperationByName("login")
myRequest = myOperation.getRequestByName("Request 1")\


These snipets were taken from


You may find the API docs helpful in working out methods/properties that you can call


Is this what you meant?




Author of SoapUI Cookbook

I must be missing something here. I have read through the docs quite intensively and I also tried the suggested code snippets, but when I enter a code-snippet like

def name =

into the script assertion entry field and then execute that I get an error "can not call testCase on a null-object". So, the object "testRunner" seems undefined or null.


The other usage that my question was referrring to:

there is the option to define an assertion by using the "Contains" option and then enter a string that has to be contained in the response into the input fields.


These strings can contain "placeholders" like "...${#Project#some_property}..." or "...${#TestCase#other_property}..." etc.. However, that machanism seems to work only with user definable customer properties. If I enter the project property "${#Project#Name}" here or ${#Project#Service} or ${#Project#Endpoint} or any other default property's name)  I get an error only. What name or prefix do I need to use for the Project/Test Suite/Test Case/Test Step's default properties?



So in terms of why that first snippet deosn't work, what you were missing is that I said to run it from a Groovy script, not a script Assertion, they provide different variables to the script - see the comparison below:

Screen Shot 2015-08-24 at 09.54.53.png

Whereas, the Script Assertion is not run in the context of a test runner hence no testRunner variable (it gets messageExchange instead):

Screen Shot 2015-08-24 at 09.55.48.png


Ok, I think the problem here might be that the syntax for inserting the result of script type expressions is not the same as that for the property expansion syntax that is applied to properties of different scopes - consider the following example:




(also taken from that tricks and tips page, but basically this syntax allows execution of one or more lines of code, can provide more complicated examples if necessary)


Is this what you wanted?

Hope this helps,



Author of SoapUI Cookbook

> Is this what you wanted?


Not quite yet. I would like to find a way to include placeholders representing default properties of test-suite and test-case into the expected content, i.e. into the string that one puts into the "Content"-field of a "Contains Assertion".

Right now, I know how to include project properties there, e.g. using:

some text ${#Project#foobar} some more text


But that only works with Custom Properties! What do I have to write to e.g.  include the name of the TestCase (i.e. the value of the "Name" property from the TestCase's  "TestCase Properties"-tab) into that field?


Hope, I could make myself clear...

Ok, hopefully this is what you mean (ellaborating on the second part of what I said before), see how you find this approach:


1. You'll need to reference the testRunner object prior to the Request and Assertion, so create a Groovy TestStep for this:

Screen Shot 2015-08-25 at 15.33.32.png

2. Use the syntax below to assign the value of the TestStep object's name to a context property (testCaseName):

Screen Shot 2015-08-25 at 15.33.54.png

3. Insert the context property into the constains Assertion using the usual syntax:

Screen Shot 2015-08-25 at 15.35.11.png

4. Run the TestCase and the Assertion should check for the text (including the contents of testCaseName) - Note you need to run the whole TestCase rather than just the Request TestStep, otherwise the context property testCaseName wont be present.


Any good?




Author of SoapUI Cookbook

If I understand right, mmoser18 is looking for way to access the standard properties from script assertion, then here is the way to go:


To access project name from script assertsion


  • To access test case name
  • To access test suite name

Just this is for the information - when you open script assertion, top right corner, the editor shows the available variables where testRunner is not available there which is the reason you could see null. Also if you see groovy script step editor, it shows testRunner on top of it so that is accessible there as Rup mentioned.


Don't be astonished, the same above snippets work from groovy script test step as well.



Hope this helps.



Just went thru the post in detail once again, found that you need to do contains assertion, could not try exactly what you want. But the same can be achieved by using script assertion.


Here is code snippet to make a contains assertion to see if the response contains the value of  Project Property - Script Language i.e Groovy



def stdProjectPropValue = context.testCase.testSuite.project.defaultScriptLanguage
def responseText = messageExchange.responseContent
assert responseText.contains(stdProjectPropValue), "Response does not contain ${stdProjectPropValue}"


Showing results for 
Search instead for 
Did you mean: