Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

How can I ensure that SilkTest tests all links within my web application apart from links that I specify not to be tested?

How can I ensure that SilkTest tests all links within my web application apart from links that I specify not to be tested?

This can be can be achieved by creating a script that dynamically returns all of the declarations for the window, extracts the links from those declarations and then removes any links specified not to be tested. Then each link could be tested and verified in order. You would call the following LinkTest function from your testcase.

The following example is based on www.google.com:

[-] LinkTest(window sWindow)
    [ ] INTEGER lsSize = ListCount(lsDecs)
    [ ] INT i
    [ ] INT x = 1
    [ ] LIST OF window lsDecs
    [ ] LIST OF window lsLinks
    [ ] WINDOW wWin
    [ ] 
    [ ] 
    [ ] sWindow.SetActive ()
    [ ] // set Table recognition to 0 so that everything is recognised as part of page.
    [ ] BrowserPage.SetUserOption ("ShowBorderlessTables",0)
    [ ] lsDecs = sWindow.GetChildren()
    [ ] 
    [ ] //get caption of main page for verification of links.
    [ ] STRING mainWinCaption = sWindow.GetCaption()
    [ ] 
    [ ] // Get Links
    [-] for each wWin in lsDecs
        [-] if wWin.class==HtmlLink
            [ ] ListAppend (lsLinks, wWin)
    [ ] 
    [ ] // statement to remove any links that you do not want tested.
    [ ] ListDelete (lsLinks, ListFind(lsLinks, Google.Froogle))
    [ ] 
    [ ] // test the links
    [-] for each wWin in lsLinks
            [ ] wWin.Click()
            [ ] sleep(4)
            [ ] // Do a verification here.
            [-] if (Browser.GetCaption() == mainWinCaption)
                [ ] Print("Tested : ", wWin, ": Unsuccesful") 
            [-] else
                [ ] Print("Tested : ", wWin, ": Successful")
                [ ] 
            [ ] Browser.TypeKeys("")
            [ ] sWindow.SetActive ()
            [ ] // set table recognition level back to normal
            [ ] BrowserPage.SetUserOption ("ShowBorderlessTables",0.5)

Old KB# 21304

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:19
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.