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)