Forum Discussion

kimlam8888's avatar
13 years ago

How to use the Groovy Script-Results in the Request

Hi all,

I have a Groovy script to read data from Excel file. After script ran successfully, there is a dialog prompts "Script-Result: 987654321" where 987654321 is my data in Excel file.


Now, I want to use this data in a test request. How can I do this?


I've also tried with the following solution but no result, please correct me if I'm wrong:
+1st way: In the script, I used method "return stringa1", then in the script I call "GroovyScriptName#stringa1" but not successfully
+2nd way: I used "com.eviware.soapui.SoapUI.globalProperties.setPropertyValue" and "testRunner.testCase.setPropertyValue" then call the property in the test request but not successful also.

Please help me resolve this urgent case

Thanks in advanced,
Kim Lam

1 Reply

  • nmrao's avatar
    nmrao
    Community Hero
    Hi,

    From the screen shots, it is noticed that groovy script is setting a property at test case level which good, but this is in last step of the test case. What does not make sense to me is that trying access the value in first step of the test case. I thought you are using the steps sequencially. Is it possible to move groovy script to top? Or may be you are running manually groovy step first and then create step separately.

    You may try replace(for Vehicle serial number) with the following value in your request :
    ${#TestCase#VNumber}