Service Virtualization

 View Only
Expand all | Collapse all

In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

  • 1.  In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jun 02, 2016 10:19 AM

    In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

     

     

    I tried using some scripts, but not getting a correct logic.

    Please help me



  • 2.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Broadcom Employee
    Posted Jun 02, 2016 10:49 AM

    You can add a Numeric Counting DS to your web service execution test step which goes to the 'different step' at the end

     

    Screen Shot 2016-06-02 at 10.46.56 AM.png



  • 3.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jun 02, 2016 10:50 AM

    try Numeric counting data set like below. once the counter reaches the max value, it will execute the step mentioned. (output log message in this example)

     

     



  • 4.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jun 02, 2016 11:06 AM

    Thanks for your quick response. I need one more clarification.

     

    In my testcase i have the dataset for the complete steps,

     

    In step 1: Parse text as a response I am constructing the request (Having a dataset here(Read rows from excel))

    In step2 : I am hitting the webservice for till i get the expected value -Max 5 times).  If i use the numeric counting dataset here, and I am exceeding 5 and i got to step1 for second row) what happens for this row?



  • 5.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jun 02, 2016 11:16 AM

    you would have something like this

     

     

    parse text as response will read row from excel file < some dataset> and after the request construction, it will execute soap request for 5 times and when the counter reaches 6, it will point back to parse text step (which will read a second row from data set)

     



  • 6.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jun 02, 2016 11:18 AM

    I Tried in my scenario, The problem is when my counter reaches the max in the first iteration, the second fails.



  • 7.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jun 02, 2016 11:21 AM

    Resetting numeric counting dataset Resetting numeric counting dataset---- Refer this post for resetting the counter. you should be resetting the counter after soap request execution and call parse text step for the next row process



  • 8.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jun 02, 2016 12:30 PM

    Exactly the same type of the scenario.

    I am getting error when I give the code in the script step. Please help me in resolving this.ErrorScript.JPG



  • 9.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jun 02, 2016 03:10 PM

    try this ... tested and its working fine..

    testExec.setStateValue("lisa.counterName.reset", true);



  • 10.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.
    Best Answer

    Posted Jun 02, 2016 04:11 PM

    Try the approach shown by Annalakshmi above.  It may be easier to implement and it is pretty clean.

     

    Just recognize that 'counterName' inside "lisa.counterName.reset" is the name Annalaksmi's assigned to the dataset.  You will need to change that value to the name of your count dataset. Based on the code excerpt where you show the exception, you would use lisa.Counter.reset".  Based on Prem's example, the value would be, lisa.Create a Numeric Counting Data Set.reset".   Case sensitivity and blank space applies....

     

    Within DevTest 9.0/9.1, I can see the findDataset static method on DataSetManager using Eclipse.  It takes an instance of TestExec and a String value of the dataset.  If you are using DevTest 8.x or prior, the method may or may not be there although I think the method was available as far back as 8.5 or possibly earlier.  You might also expand the scope to include Test and System Properties but not sure that will help either.



  • 11.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jun 03, 2016 04:58 AM

    Thanks much Annalakshmi for your help and support. I got the logic working now.

     

    Regards,

    Mohan



  • 12.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Mar 15, 2019 02:52 PM

    Hi Annalakshmi,

    I have two loops (one inside another) and both read from an excel data file (different tab - a, b) to dataset (A, B). Use your script to reset the dataset B, I got true in response, but the B_RowNum did not change and when reading the data, it still pointed to the end of the set.

     

    Is the issue related to reading from the same .xlsx file and the tab can not be reset?

     

    thanks,

    Shurong



  • 13.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Posted Jan 25, 2017 02:29 AM

    Hi Anna,

     

    This is regarding the below. 

    Reloading Data Set 

    I tried the way mentioned in the post and still the data set is now getting reset. PFB the details.

    OutPut:

    In the above ITR you can see that the "lisa.getAccountBalanceWidget.reset" is executed in Do-Nothing Step and set to 'true' and moved to the next step Start. But again in the Start step the "lisa.getAccountBalanceWidget.reset" is set to false by default and hence the data set end up by not invoking the "getAccountBalanceWidget" step that failed in the first iteration.

    The expected is the failed scenario would need to be executed again for couple of iterations.

    Expected output:

    Note: Just renamed the scenario with numbers for identification.

     

    Kindly help to get this fixed.

    Thanks in Advance...

     

    Regards!!

    Sriram MK



  • 14.  Re: In one of my testcases, I need to loop a web service execution test step for a particular request 5 times and when it hits 6th time i need to go to different step. Can someone help me in this.

    Broadcom Employee
    Posted Mar 15, 2019 03:01 PM

    Mohan,  I would move  Step 2  to a sub-process step.  once  its done the 5 iteration,   the main test will  complete the next flow.  you do not have to reset anything.  

     

    Thanks

     

    Shiney.