Ask a Question

Groovy Scripting- TestRunner Property

SOLVED
sumit0609
Occasional Contributor

Groovy Scripting- TestRunner Property

I am reading column value from data source(.csv) and using string split function to capture a sub string value.

This substring value is  stored in a property using :

testRunner.testCase.setPropertyValue("card_number", cardNum)

and then is passed to the request using ${#TestCase#card_number}

 

It works fine when there is only 1 loop in the test case. However in mine there are multiple test rows being run in loop and the property value is not getting reset  instead value read first time from the property is being passed on to requests in subsequent loops.

I tried testRunner.testCase.setPropertyValue("card_number",null ) as well as testRunner.testCase.setPropertyValue("card_number","" ) but no luck..Need help from experts.

 

 

@richie @ChrisA  @PrathapR 

5 REPLIES 5
PrathapR
Frequent Contributor

@sumit0609 

 

are there any other columns except "cardNum" in your sheet?, if yes, are they updating when loop iterates to next record?

 

sumit0609
Occasional Contributor

@PrathapR  There are several columns in the datasource. Somehow what ever i do the value is nt getting reset to empty instead value fetched first time is always being fed to susbsequent request.

Hey @sumit0609,

Can you provide a screenshot of the testcase so we can see the test step items in your test object hierarchy please?
Also, can you provide the groovy (and script assertions if used), so we have a better idea of whats going on with the flow?

Cheers,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
ChrisA
Contributor

Just to echo @richie 's comment.  Screenshots would be useful so we can see the steps and where the loop is within your test.

sonya_m
SmartBear Alumni (Retired)

Hi @sumit0609 ! Were you able to solve this issue? If not, please provide more info the Community is requiring and the community members will do their best to help!

 

Otherwise, you can raise a support ticket with our Customer Care team by this link


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: