SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Feb 2001
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic Declarations \"How To...?\"

    Is there better instruction somewhere on how to use GeneratateDecl() to get Dynamic Declaration of your windows at runtime?
    What I have is an application that requires you to pick an option from a tree view. The tree view app then opens a child window where a list box allows selection of several more possibilities, based on the initial tree view selection. The next child window will have a varying number of pages (tabs) with a huge number of possible page styles, based on your 2 prior selections.
    So, I'm thinking that the best way to account for the huge number of unforseen possibilities may be to try Dynamic Declarations that grab the windows declarations at runtime. GenerateDecl() is supposed to be capable of making this work.
    Is there somewhere that I can find good information on how to make this work? The three lines in the Help file don't do much for me.
    Thanks

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

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dynamic Declarations \"How To...?\"

    GenerateDecl() might be the way to handle this situation, but what do you want to do to the screens once you capture them? Please give us more information.

    Thanks,
    Mike

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

  3. #3
    Member
    Join Date
    Feb 2001
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dynamic Declarations \"How To...?\"

    Based on prior selections, the format of the next window varies substantially (as does it's identifying variables but that's another problem entirely). One instance of the window may have 3 tabs in the tab strip control while another instance may have 8 tabs. The screens below each tab will have a number of unique options that will have to be set. Some of the controls may be common windows controls accessable to SilkTest, while some are CustomWins that may have to be mapped or recorded or who-knows-what.
    So what I need to do to the windows varies. Some items have required values that need to be filled in, some things need to be checked via radio or check boxes... There is a lot of possibilities. And failing to set some options (that are not obviously detectable) will cause the application to halt and prompt for a correct entry.

    I guess the first thing I need to know is:
    How does GenerateDecl() work? Do the declarations actually land somewhere that I can see (to see if it's giving me what I need) or does it somehow get dynamically written to SilkTest internally at runtime? I've tried sending it to a Print() and it seems to return a full set of declarations but I have not been able to make it work at runtime.
    Then once I get it declaring what I need, I guess I'll have to go ahead and write functions specific to each type of window.

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

  4. #4
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dynamic Declarations \"How To...?\"

    If you make sure that your include file is closed when you are running the script you can store the newly generated declarations in your current include file. If you want to look at the window declarations before adding them to your include file create a new .inc file to store them in within your code.

    Here is a function I wrote to capture window declarations and screen captures when my script fails:

    [+] ErrorCapture(STRING sName) //Captures an bitmap image and window declarations for an error window
    [ ] //************************************************** *****************************************
    [ ] //* This function captures the bitmap representation of a screen and the window declarations
    [ ] //* when the script fails
    [ ] //* STRING sName the name to use for saving the screen
    [ ] //************************************************** *****************************************
    [ ] WINDOW w
    [ ] LIST OF STRING lsDeclarations
    [ ] STRING sDec
    [ ] HFILE hIncFile //Establish handle for the .inc file to store new window declarations
    [ ] STRING sBitMapDir = "d:\dataAAResults\" //Path to store bitmap and .inc files in
    [ ]
    [ ] w=Browser.GetActive() //Get the currently active screen
    [ ] w.CaptureBitmap (sBitMapDir + sName + ".bmp") //Capture the bitmap file of the current screen
    [ ]
    [ ] hIncFile=FileOpen(sBitMapDir + "New.inc", FM_APPEND) //Open the window declaration file as append
    [ ] FileWriteLine(hIncFile, " ") //Write a blank line to the output file
    [ ] FileWriteLine(hIncFile, "//New Declaration, Window" + sName) //Write a comment line to the output file
    [ ] lsDeclarations=w.GenerateDecl() //Get the window declarations for the current captured screen
    [+] for each sDec in lsDeclarations //For each object declaration in the declaration list
    [ ] FileWriteLine (hIncFile, sDec) //Write the string to the output file
    [ ]
    [ ] FileClose(hIncFile)


    I create a unique name for each window declaration (within comments), that also name also serves for the bitmap capture also.

    Hope this helps you.

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

  5. #5
    Senior Member
    Join Date
    Jun 2000
    Location
    Chicago, IL USA
    Posts
    383
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dynamic Declarations \"How To...?\"

    Jake:
    Using GenerateDecl() for dynamic declarations is a very interesting but it is only a small part of the solution to your problem.

    This is because you cannot get SilkTest to compile and start using the declarations as they are captured, i.e. at runtime. (Actually, you CAN script one copy of SilkTest with another copy of SilkTest running on the same computer to do it -- but it is tricky and not practical)

    Usually, you are better off just capturing the declarations manually. If you really have a LOT of windows to capture -- GenerateDecl() might help you.

    Most of us deal with complicated dynamic declarations all of the time using much simpler techniques.
    Start by manually capturing the window's declarations in each of its incarnations.

    Now study these.
    How many different incarnations are there ?
    What is common to them all ?
    What is unique in each one ?

    If the differences are simple, you can probably handle them by using dynamic string variables in your "tag" statements.

    If they are very complex -- use SilkTest's Object-Oriented features.
    Create a master "winclass" which contains the declarations for features that appear in every incarnation of your window. Then for each incarnation of the window, create a winclass, inherited from your master class that describes its own unique features.

    I usually then override the Exists() method for each derived class so that it looks for a "unique" feature of that incarnation. I then then add an Activate() method which brings that particular incarnation into existence.

    You need to develop this to meet your particular needs. Be careful not to go too far beyond the skill level of your team :-)

    -Rob


    [This message has been edited by RobKapteyn (edited 04-24-2001).]
    Rob Kapteyn, CSTE
    RobKapteyn@gmail.com

  6. #6
    Member
    Join Date
    May 2000
    Location
    NY
    Posts
    52
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dynamic Declarations \"How To...?\"

    I am curious why one would bother generating declarations at runtime as opposed to using calls that dynamically capture the objects of interest, for example via GetEverything or GetChildren. Wouldn't these functions return dynamically the object references of interest without requiring you to go through the extra step of saving them in a declarations file and accessing that file ?

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

  7. #7
    Member
    Join Date
    Feb 2001
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dynamic Declarations \"How To...?\"

    Rob
    I've dealt with the same problem (on a far smaller scale) using methods that you've described. I had a window with a pagelist (tab strip) control on it and I recorded each instance of the window and, with the help of SilkTest's compiler, picked through the details and eliminated the duplicates. That allowed me the declarations to cover any potential test that I may require.
    This time it is far more detailed. I have ascertained probably at least two dozen initial variations of the window, each of which contain a pagelist control with anywhere between 3 and 11 tabs. The problem will be in getting the details for every incarnation, many of which I have not looked at yet. Also some of the controls on different "pages" in the pagelists are CustomWins that I will have to deal with in some non standard fashion. Then throw in the 2 week release cycle of the product and the fact that adding a single new element will add a new page variation with a new series of pagelist pages that will have to be added to the declarations. That's why I was hoping for a "get declarations at runtime" option.
    As for the rest, the automation development "team" is composed of me and my experience with SilkTest is around 2-3 months. I do have a development background but I feel that I have already gone "beyond" my skill level.
    Currently, I'm thinking that the best option may be to limit potential test to a few (2-3) options. Though this is not a preferable option to me personally, it may suffice for the scope of our testing efforts.

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

 

 

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 05:35 AM.

Copyright BetaSoft Inc.