Forum Discussion

ABCDEFG's avatar
ABCDEFG
Contributor
14 years ago

Write Values in the DataSink property (soapUI Pro)

Hi,

Help me to write values in to DataSink using Groovy script.

I need to write a sample string (eg: NULL,Hai,123) in to DataSink Property if the property have blank value. Could you please help me in the following Groovy script?

I have Grooved to some extend but since my adequacy of expertise i cannot complete it.


def i=1,j=7;

def exp=new object[15]; //defining an array

for (i=1,j=7;i<16,j<31;i++,j++)
{
exp[i]=testRunner.testCase.getTestStepByName("DataSink").getPropertyAt(j); //Accessing 7th property of the DataSink and assigning in to an Array.

if (exp[i]==' ') //Check against black value
{
testRunner.testCase.getTestStepByName("DataSink").setPropertyValue("NULL",exp[i]); //write to DataSink with NULL value.
}

}


Please find the attached error message with this.

The scenario: I have 15 properties in my DataSink which writes in to MS EXCEL. But while looping with SOAP Responses, some responses won't have 15 properties to DataSink. But some responses will have 15 properties. Hence i am trying to fill blank properties with NULL value and write to EXCEL.



Please let me know, if you have any questions.

Appreciate your help in advance,

^Regards
No RepliesBe the first to reply