Handling multiple scenarios in response to a user action

4 posts, 0 answers
  1. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 26 Jul 2011 Link to this post

    Hello,

    We have a scenario where a single user action will result in one of multiple possible behaviors:

    When a user clicks Login button on the login dialog, one of several dialogs can be displayed.  In the most common scenario, a Disclaimer dialog is displayed.  However, other dialogs (such as password expiration and Change Password dialogs) can also be displayed.  Responding to the other dialogs ultimately results in the Disclaimer dialog to be displayed. 

    We don't know in advance which dialog will appear - so I cannot have a Wait for Exists on any of the dialogs (because it would fail if one of the other dialogs shows up). 

    I have currently implemented the following:

    a) User clicks Login button
    b) Delay execution for x seconds (to wait for one of the dialogs to be displayed)
    c) If Disclaimer dialog is not displayed, check if any of the other dialogs is displayed - handle it if it is (this includes waiting for and handling any other dialogs being displayed before the Disclaimer dialog is displayed). 
    d) Wait for Disclaimer dialog and handle it when it is displayed.

    Problem is that the test sometimes fails at step c) - because one of the other dialogs sometimes takes a bit longer than expected to show up.   

    I know one solution is to increase the timeout for step b) to the max value for all the dialogs - however, this slows down the test in all scenarios.  Also, the required delay is different depending on when the test is run - it is slightly longer when the test is run immediately after deployment as opposed to later.  Besides, the login test is called by other tests in the suite as well - which thus are all slowed down as well.

    Does anyone know of a better way to write this test without sacrificing performance?

    Thanks,
    Shashi
  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 28 Jul 2011 Link to this post

    Hello Shashi,

    This sounds like a good use of our While loop feature. The idea is to create test steps like this:

    While (Disclaimer dialog is not displayed)
        If Password Expired dialog displayed
            Handle Password Expired dialog
        if Change Password dialog displayed
            Handle Change Password dialog
        if (any other possible dialogs)
            Handle dialog
    End While

    Put short timeouts on each step and the test will run with minimal delay.

    Best wishes,
    Cody
    the Telerik team
    Check out the Test Studio roadmap to find out more about the new performance testing functionality coming in our R2 2011 release this September!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  3. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 29 Jul 2011 Link to this post

    Hi Cody,

    I am testing your solution - it might work.  However, I have one scenario where the Disclaimer dialog is never displayed.  This results in an infinite loop.  Is there a way to force the test to "break" out of the while loop?

    Shashi
  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 02 Aug 2011 Link to this post

    Hi Shashi,

    No there is no way to force it to break out of the loop. I am thinking we can still take the same approach but modify it just a little. Is there some test that will always appear, eventually, some sort of main header or main menu or something? We can modify the loop to be like this:

    While (main screen/menu/text is not displayed)
        If Disclaimer dialog displayed
            Handle Disclaimer dialog
        If Password Expired dialog displayed
            Handle Password Expired dialog
        if Change Password dialog displayed
            Handle Change Password dialog
        if (any other possible dialogs)
            Handle dialog
    End While

    Kind regards,
    Cody
    the Telerik team
    Check out the Test Studio roadmap to find out more about the new performance testing functionality coming in our R2 2011 release this September!

    Have you looked at the new Online User Guide for Telerik Test Studio?
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!