Service Virtualization

Expand all | Collapse all

Reloading Data Set

Jump to Best Answer
  • 1.  Reloading Data Set

    Posted 01-23-2017 04:22 AM

    Hi,

     

    Am trying to implement fail over and rerun concept in devtest. I have designed the test case as below.

    The issue is the data set getAccountBalanceWidget is not reloading after the single counter. At the end of the data set i have directed to Do-Nothing Step. But the data set is not reading for the first row during the second iteration. Both the data set are set has local only.

    Kindly let me know the right solution to get this fixed.

     

    Thanks in Advance.

    ...

    Sriram MK 



  • 2.  Re: Reloading Data Set

    Posted 01-23-2017 11:29 AM

    Create  a subprocess step where you add the 'Start' step with 'getAccountBalanceWidget' dataset in a loop and select "local" check box . Then call  this subprocess step from the main test case.  That way, when the subprocess has ended, then it will clean up the subprocess, and will cause the dataset to be reset for the next time the subprocess is launched.

     

    hope this answers your question. 

     

    Thanks

     

    Shiney. 



  • 3.  Re: Reloading Data Set

    Posted 01-24-2017 12:04 AM

    Hi Shiney, 

     

    Thanks a lot for you response. I have already tired that way and was able to successfully reload that data set. The challenge that i have in the current frame work is, we have N number of test cases with multiple components. So the sub-process creation will end up in creating two test cases for each test cases currently available in the bed. I have around 147 individual test cases across 67 components. So creating sub-process will be more complex and adding the test case to suite files will lead to multiple issues.    

     

    If there is some better way to achieve the reload within the same test cases it would be helpful. Also, if by chance we would require the to reload data set based on some condition, for such a situation, we are not able to reload the data set. 

     

    Kindly help in finding a way to reload the data set with in the same Test cases.

     

    Thanks a lot..

     

    Thank you !!!

    Sriram MK



  • 4.  Re: Reloading Data Set

    Posted 01-24-2017 09:07 AM

    Please try this and report back.  No guarantees...

    In the Do Nothing Step (which seems to be where you want to reset the counter on the second dataset), add a Scripted Assertion above the Scripted Assertion that is currently in your model above.  

    In this new assertion, name the assertion ResetAccountBalance, set the assertion to fail if the result is FALSE.  Then, try adding the code:

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

    return true;

    Here are a few reference posts that might help:

    https://communities.ca.com/message/241888669?commentID=241888669#comment-241888669 

    https://communities.ca.com/message/241881496?commentID=241881496#comment-241881496 

    The last post, above, seems to have had questionable success -- perhaps, version dependent or a deprecated feature.

    If this were to work, you could add your conditions in the same assertion to determine whether or not you want to reset the dataset counter. 



  • 5.  Re: Reloading Data Set

    Posted 01-25-2017 02:47 AM

    Hi Joel,

     

     

    I tried the way mentioned in the post and still the data set is not 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 for scenario that failed in the first iteration.The expected is that 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



  • 6.  Re: Reloading Data Set
    Best Answer

    Posted 01-25-2017 07:15 AM

    Yes.  My approach was a longshot.  Resetting and controlling dataset counters inside loops within loops is not real easy to solve for.  You may need to consider writing your own custom script in order to control the dataset.



  • 7.  Re: Reloading Data Set

    Posted 03-02-2017 11:12 AM

    Sriram, 

     

    You can use the custom script to reset the Excel dataset current row as below. i have tested the same and its working as expected. 

     

    int rowNum = -1;
    testExec.getLocalDataSet("test").setCurrentRow(rowNum);
    return true;