Forum Discussion

gregbv's avatar
15 years ago

Passing in Properties to Test Requests with Groovy Script

Hello,

I'm new to SoapUI and have to perform a task that is a bit more complicated than most typical use cases I'd imagine. The project I'm working on needs to read data from a CSV file and replace a Property in a Test Request with this data.

Getting the data from the CSV is no problem. What I am having trouble with is the scripting code for getting the data into the Test Request Property.

The second screenshot on http://soapui.org/Functional-Testing/working-with-scripts.html looks like it might have an example of what I'm trying to do, but I can't see all the code, nor does that example project appear to be in either the regular or Pro example projects.

Is there anywhere I can find this project? Or can anyone point me to to a tutorial or code somewhere for this?

Thanks.

Greg
  • kamahade's avatar
    kamahade
    Regular Contributor
    Check if following helps you ...

    if you are setting value at testsuite level... do following ...

    testRunner.testCase.testSuite.setPropertyValue("abc",yourValue);


    if you want to set property at testcase level....

    testRunner.testCase.testSuite.getTestCaseByName("TESTCASE_NAME").setPropertyValue("PRO_NAME","ITS_VALUE")