Forum Discussion

wichitk's avatar
wichitk
Occasional Contributor
5 years ago
Solved

Can I get the operation name at the groovy script?

Hi,

 

Can I get the operation name at the groovy script?

What's command do I use?

 

 

 

 

Regards,

Dan

6 Replies

  • avidCoder's avatar
    avidCoder
    Super Contributor

    With reference to screenshot, I can understand that you want to read the property Value which is "CustomerProfileInq". if it is, then you can use below code:-

    testRunner.testCase.testSteps['RequestName'].getPropertyValue("Name")

    Where you need to create a testStep as "RequestName".

    • wichitk's avatar
      wichitk
      Occasional Contributor

      Hi avidCoder ,

       

      I'm working at the mock service (Mock Response).

      It doesn't work.

      I applied your code and it returns: 

       

      com.eviware.soapui.impl.wsdl.mock.DispatchException: Failed to dispatch using script; groovy.lang.MissingPropertyException: No such property: testRunner for class: Script33

      Is it can be used the testRunner on the MockResponses?

       

      Regards,

      Dan

    • wichitk's avatar
      wichitk
      Occasional Contributor

      Hi,

       

      I changed the code to:

      log.info("Name: "+mockOperation.operation.name)

      It worked!!.

       

      Regards,

      Dan

      • nmrao's avatar
        nmrao
        Champion Level 3
        Appreciate to respect the original answer while marking solution.

        log.info is to show the actual value of the object.