SPONSORS:






User Tag List

Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Oct 2001
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trouble with menu identification

    I'm kind of new to SilkTest and I'm writing a test script for a Windows application that has two basic states. My trouble is that each state has a 'File' menu with completely different menu items. I captured and declared each File menu as a seperate object and inserted them both into my MainWin declaration. (both have single tags that default to "File")

    To keep them seperate, I specified a unique child object in each of their tags. ex:
    State1: "File/[MenuItem]Save Session"
    State2: "File/[MenuItem]Save File"

    After declaring them as above, my test scripts can check which menu "Exists()" and go from there. This method seems to work fine to identify the different menus. The only problem is that now I can't access any of the 'File' menu items. I keep getting errors saying the MenuItem can't be found.

    If I change the tags back to "File", I can access all the MenuItems just fine, but I don't know which menu (and which Application State) is currently running. What do I have to do to be able to access the MenuItems while keeping the declarations seperate? ...Or do I have to go about this a different way? Any advice appreciated... Thnx.

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

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Location
    Elizabeth, CO, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with menu identification

    Just checking on something...

    The tag you specified for the different File Menu objects should look like this:
    The ".." on the end tells SilkTest to go back up one level. Without that, SilkTest will think that the File Menu object has a tag of File/[MenuItem]Save Session" (for example) and any reference to what you think are the File Menu's children will be looking for children of the MenuItem "Save Session".

    I hope this helps.

    - Dave



    ------------------
    Amelior Technology
    dreed@ameliortech.com
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  3. #3
    Junior Member
    Join Date
    Oct 2001
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with menu identification

    Thanks Dave,

    That did something because now I'm not getting the "MenuItem not found" error, but now I'm getting a "Key syntax error". Like before, if I change the tag back to "File" I can access the menu items fine, only (like before) I don't know which menu I am accessing. Is there some sort of Agent option I need to set?

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

  4. #4
    Senior Member
    Join Date
    Jul 2001
    Location
    Elizabeth, CO, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with menu identification

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by ChrisRobinson:
    ...but now I'm getting a "Key syntax error".<HR></BLOCKQUOTE>

    I think I have to respond to that with, "Huh?" I don't think I've ever heard of that one. Since you're not getting the other error on run, I'll assume that you're getting the above at runtime and not compile. On what line of code? On the Pick method?

    A kludge would be to use the keystrokes to activate a menu item. Such as App.TypeKeys ("&lt;Alt-f&gt;o") to hit the Open item on the File menu.

    ****- Dave


    ------------------
    Amelior Technology
    dreed@ameliortech.com

    [This message has been edited by dcreed (edited 10-17-2001).]
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  5. #5
    Junior Member
    Join Date
    Apr 2001
    Location
    San Francisco, Ca. USA
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with menu identification

    I overcame a similar problem by simply adding all of the menu items from both File menu types into one File Menu declaration. I fortunately didn't have any duplicate menu items, and this approach does sacrifice some testing capabilities of the File Menu.
    Just a thought..

    ------------------
    Robert
    Robert

  6. #6
    Junior Member
    Join Date
    Oct 2001
    Posts
    22
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Trouble with menu identification

    roberto,
    Thanks for the advice. I started to declare the menu like that (and it worked!), but then I decided that seperate declarations would be better...this way, if I try to access a menu item from the wrong menu, I'll get a compile error rather than a run-time error. I think it will simplify the menu verification as well.

    dcreed,
    As far as the "Key syntax error":
    You are right, it is a runtime error. It happens when I use the Pick method on any MenuItem from the menu in question (File menu).


    When the declarations for the two File menu's are like this:
    Menu File1
    tag "File/[MenuItem]Save Session/.."
    ...and...
    Menu File2
    tag "File/[MenuItem]Save File/.."

    1. When I use the Exists method on either menu, I will get a TRUE or FALSE depending on which state my app is in. (Works Correctly). Code example:
    if (MyApplication.File1.Exists ())
    print ("Application is in state 1")

    2. When I use the Pick method on one of the MenuItems, I get the runtime error "Key syntax error" Code example:
    if (MyApplication.File1.Exists ())
    print ("Application is in state 1")
    MyApplication.SetActive ()
    MyApplication.File1.SaveSession.Pick() // Error!

    3. I get the following results from checking the WndTag property.
    File1.WndTag:
    "[MainWin]MyApplication/[Menu]File/[MenuItem]Save Session/.."
    SaveSession.WndTag:
    "[MainWin]MyApplication/[Menu]File/[MenuItem]Save Session/../[MenuItem]Save Session"


    When the declarations for the two File menu's are like this:
    Menu File1
    tag "File"
    ...and...
    Menu File2
    tag "File"

    1. When I use the Exists method on either menu, I will always get a TRUE result no matter what state the app is in. Code example:
    if (MyApplication.File1.Exists ())
    print ("A file menu exists, but I don't know which one...")

    2. When I use the Pick method on one of the MenuItems, everything works fine (only if the application is in the correct state, otherwise, I get a runtime error). Code example:
    if (MyApplicationFile1.Exists ())
    print ("Application is in state ???")
    MyApplication.SetActive ()
    MyApplication.File1.SaveSession.Pick()

    3. I get the following results from checking the WndTag property.
    File1.WndTag:
    "[MainWin]MyApplication/[Menu]File"
    SaveSession.WndTag:
    "[MainWin]MyApplication/[Menu]File/[MenuItem]Save Session"


    It seems to me that the tags are syntacticly correct, but SilkTest is not correctly referencing children of Menu objects using ".." in their tags. (At least in this case). I'm running SilkTest 5.0.3 with no patches. Are there any patches for 5.0.3 that would (possibly) help this? Any agent options?

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

 

 

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 12:42 PM.

Copyright BetaSoft Inc.