Forum Discussion

sumit0609's avatar
sumit0609
Occasional Contributor
4 years ago
Solved

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 

  • 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

5 Replies

  • 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's avatar
      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

  • PrathapR's avatar
    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's avatar
    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.

    • richie's avatar
      richie
      Community Hero
      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