SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SetTrap error message

    I have a random modal dialog that comes up.

    Doing a "SetTrap("Yes") and it is working beautifully.

    However, at the end of the test I'm calling ClearTrap() on that dialog and it gives me the error message "Trap has not been set."

    Whassup widdat? Anyone seen this before?

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

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

    Re: SetTrap error message

    I can reproduce this behavior but only if the ClearTrap() is applied to the wrong window. Are you sure yours are the same?


    John


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

  3. #3
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SetTrap error message

    Well, possibly...

    I'm calling SetTrap inside of 'testcase', but testcase is only a few lines where I call a window TestObject.PerformTests() and all the work is done there.

    So, SetTrap is called, then the TestObject, then ClearTrap.

    What I have done is move SetTrap and ClearTrap to the TestObject and it works fine. I'm unclear why this is the case, but I'm satisfied with the solution.

    Thanks John!

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

  4. #4
    Member
    Join Date
    Sep 2002
    Location
    Foster City, CA, USA
    Posts
    55
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SetTrap error message

    Just wondering when you gurus would use SetTrap(). I read the help on it but can't see why I would use it versus Exists. Help compared the two and stated that the "trap triggers in those instances when Exists would return TRUE" Can you please give an example?

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

    Re: SetTrap error message

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by kchan:
    Just wondering when you gurus would use SetTrap(). I read the help on it but can't see why I would use it versus Exists. Help compared the two and stated that the "trap triggers in those instances when Exists would return TRUE" Can you please give an example?<HR></BLOCKQUOTE>

    First off, SetTrap() is quite limited in its usefulness primarily because it doesn't include support to call a user-defined routine to process the container that appears. It only supports closing it.

    If it supported user-calls it would be one of the most powerful commands in the language.

    An example of its use: Let's say you have a LAN connected application that (rather irritatingly) warns the user when the connection goes down by popping up a modal dialog. Suppose further that your LAN has been so unreliable lately - a failure can be reported at any moment - that your tests cannot run for very long without being stopped by the LAN error message.

    A SetTrap() for this LAN message would effectively remove it from view just as if the underlying LAN problem had actually been fixed. That's a good deal right? Not really. The effect is to mask the very appearance of those errors when you may have wanted to document the rate and frequency of their appearance.

    Using Exists() would not be as effective in this example because calling it is a one-time serial action - it only runs when you call it. setTrap() initiates a closing action every time the trigger event - that LAN warning dialog - appears. To perform an equivalent action with Exists() would require that some clever coding be added to the base class SetActive() method OR you'd have to call it immediately after every window.method you ever use.

    Consider now IF SetTrap() supported an optional call to your own code to process that darn popup warning every time it appeared. You could then easily compare the warning's contents with expectations, document it, count it, and process the dialog in any other manner desired. You might then decide to either continue test execution or Abort the run. YOU retain full control, not hand it off to a mindless automated closer.

    Does that help?

    John


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

  6. #6
    Senior Member
    Join Date
    Apr 2001
    Location
    San Diego,CA,USA
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SetTrap error message

    can the SetTrap method be overloaded with the custom implementation?

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

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

    Re: SetTrap error message

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by AUTOMATION_GURU:
    can the SetTrap method be overloaded with the custom implementation?

    <HR></BLOCKQUOTE>
    SetTrap() enables trapping; ClearTrap() disables it. To do what's described above we would have to override the unnamed-method that actually performs the closing action. We can't do that without a name.

    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 07:19 AM.

Copyright BetaSoft Inc.