Forum Discussion

tscheik's avatar
tscheik
New Contributor
14 years ago

Property Expansion - TestSuite, TestCase and TestStep names

I am able to return the name of the project using property expansion and this string, ... ${#Project#ProjectName}. Is there similar conventions for returning the names for the suite, case and step?
Thanks!

3 Replies

  • MartinSpamer's avatar
    MartinSpamer
    Frequent Contributor
    It is Property expansion, so the required item must exist as a custom property in the first place.

    You can use the following scope to access custom properties.

    #System#
    #Global#
    #Project#
    #TestSuite#
    #TestCase#
    #TestStep#

    ${#SCOPE#CustomPropertyName}

    However do you really need property expansion? You can access the Names and properties from Groovy as shown below.

    This should also answer ChristianB's question, there are two easy ways.

    // get properties from testCase, testSuite and project
    log.info testRunner.testCase.name + "=" + testRunner.testCase.getPropertyValue( "PropertyName" )
    log.info testRunner.testCase.testSuite.name + "=" + testRunner.testCase.testSuite.getPropertyValue( "PropertyName" )
    log.info testRunner.testCase.testSuite.project.name + "=" + testRunner.testCase.testSuite.project.getPropertyValue( "PropertyName" )
    log.info com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "PropertyName" )



    context.expand( '${#Project#PropertyName}' )
    context.expand( '${#TestSuite#PropertyName}' )
    context.expand( '${#TestCase#PropertyName}' )
    context.expand( '${#TestStep#PropertyName}' )
  • tscheik's avatar
    tscheik
    New Contributor
    Since I have not had a reply, I assume there is no was to accomplish this. I have been able to use a groovy script to get everything but the test step name. It would be cleaner if the I could access the name property w/out having to use groovy.

    Still hoping there is a better way to do this.

    Thanks
  • Hi,

    Could you please share how to access these properties using Groovy?

    Thanks!