SPONSORS:






User Tag List

Results 1 to 9 of 9
  1. #1
    Junior Member
    Join Date
    Mar 2002
    Location
    Toronto, Ontario, Canada
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems using SetTrap and Exists in the same testcase

    I was hoping maybe someone has come across a similar problem to what I am having.

    I am using the SetTrap method on a messagebox in a testcase. I know SetTrap has problems of its own. The only reason I am using it is because the operation I am performing in my application is being timed, so using something such as the WaitFor method (from qadownloads) would most likely throw off the time and also because the messagebox only contains an OK button so there is no need to do any type of validation on it.

    The problem I have run into is that when I use the SetTrap feature in a testcase, I have problems with the Exists method on a completely different window. I figure out when an operation is complete by waiting for the dialog to disapear, so I use the following

    do while (Window.Exists(1))
    Sleep (1)


    If I use this code by itself, it works flawlessly. However with the SetTrap method already executed in a previous block, it will wait for a minute or so before it realizes the window has disapeared!

    Anyone have any ideas?

    Thanks



    ------------------

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems using SetTrap and Exists in the same testcase

    I can't reproduce it with a quick-n-dirty Notepad example. SetTrap() closes the Open dialog just as fast as it sees it and immediately goes onto the next line of code.

    Do your have a code example that we can look at?


    John


    ------------------

  3. #3
    Junior Member
    Join Date
    Mar 2002
    Location
    Toronto, Ontario, Canada
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems using SetTrap and Exists in the same testcase

    I wa using something along these lines:

    MessageBox.SetTrap ("OK")

    // Code to perform operation

    while (Window.Exists(1)
    Sleep (1)
    // Message box should come up sometime during this, and then the window will close

    // Code to finish

    ------------------

  4. #4
    Senior Member
    Join Date
    Dec 2000
    Location
    Phoenix, AZ
    Posts
    371
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems using SetTrap and Exists in the same testcase

    Have you also included a ClearTrap once you are finished with the trap you set with SetTrap?

    ------------------

  5. #5
    Junior Member
    Join Date
    Mar 2002
    Location
    Toronto, Ontario, Canada
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems using SetTrap and Exists in the same testcase

    Yes at the end of the testcase...

    ------------------

  6. #6
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems using SetTrap and Exists in the same testcase

    OK, I think I have a solution.

    Go into Options/Runtime and check the boxes for "Show detailed status..." and "Save Status window..." in the lower left corner.

    Then rerun your test with the SetTrap() code enabled. At the point where your app' "waits a minute or so" check the runtime status box: What part of your code is silk working on in it's "Current Agent Call" line?

    I suspect that the delay you're incurring is a side effect of a command in other nearby code - a delay which seems to be made-worse by an active SetTrap call.

    Try setting the Options/Agent "Window Timeout" to a much lower value (like 1) than it currently is (probably 30 or higher). I think you'll find that your code will run much faster.


    John


    ------------------

  7. #7
    Junior Member
    Join Date
    Mar 2002
    Location
    Toronto, Ontario, Canada
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems using SetTrap and Exists in the same testcase

    Without the SetTrap, I see
    Window.Exists(1) repeat many times (for the duration of the windows existance), but with SetTrap, I only see one Window.Exists(1) call followed by the code that finishes up the testcase.

    ------------------

  8. #8
    Junior Member
    Join Date
    Mar 2002
    Location
    Toronto, Ontario, Canada
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems using SetTrap and Exists in the same testcase

    I should also mention that the window timeout is set to 4. I tried using a withoptions statement and setting it to 1 for the duration of the exists method but it didn't make any difference.

    ------------------

  9. #9
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problems using SetTrap and Exists in the same testcase

    Your app's behavior matches what I had expected you'd see. For some reason, SetTrap() is unnecessarily sensitive to the window timeout value. Here's my final attempt:



    If this doesn't help, give support a call and see if they've any similar reports. Realise though that they'll likely need a functioning code block from you that demonstrates the problem.


    John


    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:08 PM.

Copyright BetaSoft Inc.