Forum Discussion

ak0032803's avatar
ak0032803
Contributor
15 years ago

How to run data sink test step using groovy

Hi ,

I want to run data sink step using groovy scripts.

The test cases format looks like -
Data source
sendrequest
groovy script for datasink
datasink step
loop .

My data source has values like - Username , DomainName, SMTPDomainNamelist
e.g Admin@test.com,Test.com, ' SMTPDom1.com,SMTPDom2.com'

now in data sink step i want to store values in another excel as -
Username , DomainName, SMTPDomainName
i.e it should store like
Admin@test.com,Test.com, SMTPDom1.com
Admin@test.com,Test.com, SMTPDom2.com

I tried following script but its not storing the value.

Any idea how to achieve it ??

def parentOrgnization_UserName = context.expand( '${Add SMTP Domain_CustomerDataSource_Valid#ParentOrgnization_UserName}' )
def customerDomain = context.expand( '${Add SMTP Domain_CustomerDataSource_Valid#CustomerDomain}' )
def sMTPDomainList = context.expand( '${Add SMTP Domain_CustomerDataSource_Valid#SMTPDomainList}' )
def dataSink = testRunner.testCase.testSteps['InsertDataToDeleteDomain'];

for(key in sMTPDomainList.split(","))
{
dataSink.setPropertyValue('parentOrgnization_UserName', parentOrgnization_UserName);
dataSink.setPropertyValue('customerDomain',customerDomain)
dataSink.setPropertyValue('SMTPDomainName', key)
testRunner.runTestStepByName('InsertDataToDeleteDomain')

}

1 Reply

  • Finally the script ran . But observed some unusual behavior.

    If datasink step is run from script we should disable the datasink step.
    But in this case if I keep the step disable the script doesnt gives the exact output.
    It just sets properties value for datasink .But the data not getting inserted in database.

    Hence I need to enable that step which results in duplication of last value in database.

    Any idea about this behavior?
    I am using soapUI pro 3.5.1 professional version