Forum Discussion

richardn's avatar
richardn
New Contributor
17 years ago

Re: Can't retrieve project properties with Groovy script

I'm trying to set end points with Groovy. The way i'm trying to do this is setting project properties as follows:


  • Set a project propery to the end point I want when running the UI (Interactive mode)

  • Override the project property at command line using the -P switch

  • Have a Groovy script take the project property and set the end point of the test step as the first step


I'm struggling with step 2 and 3 and can't manage to get it working. I've attached the initial file just for step 2.

Can anyone help me with this?

3 Replies

  • richardn's avatar
    richardn
    New Contributor
    Okay I found my problem. I was using double-quotation marks and GroovyUtils.expand. I changed it to single-quotation marks and used the context object and it worked. e.g.:

    def test = context.expand( '${#Project#TestMe}' )
    log.info(test)

    Now onto overriding it from the command line. This is what I'm using to try and override the properties:

    C:\RnD\UseProperty>"\Program Files\eviware\soapUI-2.5.1\bin\testrunner.bat" useproperty.xml -sTestSuite -PTestMe=It_worked
  • richardn's avatar
    richardn
    New Contributor
    Okay. Fixed the command line property by using global properties instead. The -G option works. Now to work out how to get groovy to update an endpoint.
  • richardn's avatar
    richardn
    New Contributor
    Got the last part. context.setProperty("MyRequest#Endpoint", result) does the trick.