two_apps.inc

The following sample include file for the Classic Agent shows how you can locally test multiple applications. To use the sample with the Open Agent, you have to change the sample code, for example you have to replace all tags with locators.
// two_apps.inc
// define wMainWindow as a window global var
// and assign one of the apps (your pick) as a starting point.
window wMainWindow = TextEditor
const wMainWindow = TextEditor //replace default def

// Create a list of app MainWins
list of window lwApps = {...}
TextEditor
TestApplication
// Define your own TestCaseEnter.
TestCaseEnter ()
	 window wCurrentApp
	 for each wCurrentApp in lwApps
		  wMainWindow = wCurrentApp
		  SetAppState()

// Define your own TestCaseExit.
TestCaseExit (BOOLEAN bException)
  if bException 
    ExceptLog()
  window wCurrentApp
  for each wCurrentApp in lwApps
    wMainWindow = wCurrentApp
    if (wCurrentApp.Exists())
      SetBaseState()

window MainWin TextEditor
  tag "Text Editor"

// The working directory of the application when it is invoked
const sDir = "C:\QAP40"
// The command line used to invoke the application
const sCmdLine = "C:\PROGRAMFILES\<SilkTest install directory>\\SILKTEST\TEXTEDIT.EXE"

// The first window to appear when the application is invoked
// const wStartup = ?

// The list of windows the recovery system is to leave open
// const lwLeaveOpen = {?}
Menu File
  tag "File"
  MenuItem New
    tag "New"
  MenuItem Open
    tag "Open"
  MenuItem Close
    tag "Close"
  MenuItem Save
    tag "Save"
  MenuItem SaveAs
    tag "Save As"
  MenuItem Print
    tag "Print"
  MenuItem PrinterSetup
    tag "Printer Setup"
  MenuItem Exit
    tag "Exit"
  Menu Edit
    tag "Edit"
  MenuItem Undo
    tag "Undo"
  MenuItem Cut
    tag "Cut"
  MenuItem Copy
    tag "Copy"
  MenuItem Paste
    tag "Paste"
  MenuItem Delete
    tag "Delete"
  Menu Search
    tag "Search"
  MenuItem Find
    tag "Find"
  MenuItem FindNext
    tag "Find Next"
  MenuItem Replace
    tag "Replace"
  MenuItem GotoLine
    tag "Goto Line"
  Menu Options
    tag "Options"
  MenuItem Font
    tag "Font"
  MenuItem Tabs
    tag "Tabs"
  MenuItem AutomaticIndent
    tag "Automatic indent"
  MenuItem CreateBackups
    tag "Create backups"
  Menu xWindow
    tag "Window"
  MenuItem TileVertically
    tag "Tile Vertically"
  MenuItem TileHorizontally
    tag "Tile Horizontally"
  MenuItem Cascade
    tag "Cascade"
  MenuItem ArrangeIcons
    tag "Arrange Icons"
  MenuItem CloseAll
    tag "Close All"
  MenuItem Next
    tag "Next"
  Menu Help
    tag "Help"
  MenuItem About
    tag "About"
  
window MessageBoxClass MessageBox
  tag "~ActiveApp/[DialogBox]$MessageBox"
  PushButton OK
    tag "OK"
  PushButton Cancel
    tag "Cancel"
  PushButton Yes
    tag "Yes"
  PushButton No
    tag "No"
  StaticText Message
    mswnt tag "#2"
    tag "#1"

window ChildWin Untitled
  tag "(untitled)"
  parent TextEditor
  TextField TextField1
    tag "#1"

window DialogBox Open
  tag "Open"
  parent TextEditor
  StaticText FileNameText
    tag "File Name:"
  TextField FileName1
    tag "File Name:"
  ListBox FileName2
    tag "File Name:"
  StaticText DirectoriesText
    tag "Directories:"
  StaticText CQap40Text
    tag "c:\qap40"
  ListBox CQap40
    tag "c:\qap40"
  StaticText ListFilesOfTypeText
    tag "List Files of Type:"
  PopupList ListFilesOfType
    tag "List Files of Type:"
  StaticText DrivesText
    tag "Drives:"
  PopupList Drives
    tag "Drives:"
  PushButton OK
    tag "OK"
  PushButton Cancel
    tag "Cancel"
  PushButton Network
    tag "Network"
 
window MainWin TestApplication
  tag "Test Application"
// The working directory of the application when it is invoked
const sDir = "C:\QAP40"

// The command line used to invoke the application
const sCmdLine = "C:\QAP40\TESTAPP.EXE"

// The first window to appear when the application is invoked
// const wStartup = ?

// The list of windows the recovery system is to leave open
// const lwLeaveOpen = {?}
Menu File
  tag "File"
  MenuItem New
    tag "New"
  MenuItem Close
    tag "Close"
  MenuItem Exit
    tag "Exit"
  MenuItem About
    tag "About"
Menu Control
  tag "Control"
  MenuItem CheckBox
    tag "Check box"
  MenuItem ComboBox
    tag "Combo box"
  MenuItem ListBox
    tag "List box"
  MenuItem PopupList
    tag "Popup list"
  MenuItem PushButton
    tag "Push button"
  MenuItem RadioButton
    tag "Radio button"
  MenuItem StaticText
    tag "Static text"
  MenuItem Scrollbar
    tag "Scrollbar"
  MenuItem Textfield
    tag "Textfield"
  MenuItem DrawingArea
    tag "Drawing area"
  MenuItem KeyboardEvents
    tag "Keyboard events"
  MenuItem Cursors
    tag "Cursors"
  MenuItem ListView
    tag "List view"
  MenuItem PageList
    tag "Page list"
  MenuItem StatusBar
    tag "Status bar"
  MenuItem ToolBar
    tag "Tool bar"
  MenuItem TrackBar
    tag "Track bar"
  MenuItem TreeView
    tag "Tree view"
  MenuItem UpDown
    tag "Up-Down"
Menu Menu
  tag "Menu"
  MenuItem TheItem
    tag "The item"
  MenuItem TheAcceleratorItem
    tag "The accelerator item"
  Menu TheCascadeItem
    tag "The cascade item"
    MenuItem Item1
      tag "Item1"
    MenuItem Item2
      tag "Item2"
  MenuItem Check
    tag "Check"
  MenuItem Uncheck
    tag "Uncheck"
  MenuItem TheCheckItem
    tag "The check item"
  MenuItem Enable
    tag "Enable"
  MenuItem Disable
    tag "Disable"
  MenuItem TheEnableItem
    tag "The enable item"
  Menu Submenu1
    tag "Submenu1"
    MenuItem Item1
      tag "Item1"
    MenuItem Item2
      tag "Item2"
  Menu Submenu2
    tag "Submenu2"
    MenuItem Item1
      tag "Item1"
    MenuItem Item2
      tag "Item2"
  Menu Submenu3
    tag "Submenu3"
    MenuItem Item1
      tag "Item1"
    MenuItem Item2
      tag "Item2"
    MenuItem ThePopupMenu
      tag "The popup menu"
    MenuItem Check
      tag "Check"
    MenuItem Uncheck
      tag "Uncheck"
    MenuItem TheCheckItem
      tag "The check item"
    MenuItem Enable
      tag "Enable"
    MenuItem Disable
      tag "Disable"
    MenuItem TheEnableItem
      tag "The enable item"
    MenuItem AddMenu
      tag "Add menu"
    MenuItem ClearMenus
      tag "Clear menus"
    Menu DisabledMenu
      tag "DisabledMenu"
    MenuItem Item1
      tag "Item1"
    MenuItem Item2
      tag "Item2"
    Menu Menu5
      tag "#5"
    MenuItem MenuItem1
      tag "#1"
    MenuItem MenuItem2
      tag "#2"
  Menu xWindow
    tag "Window"
    MenuItem Cascade
      tag "Cascade"
    MenuItem Tile
      tag "Tile"
    MenuItem ArrangeIcons
      tag "Arrange Icons"
    MenuItem CloseAll
      tag "Close All"
    MenuItem ChangeCaption
      tag "Change Caption"
    MenuItem SysModal1
      tag "SysModal 1"
    MenuItem SysModal2
      tag "SysModal 2"
    MenuItem SysModal3
      tag "SysModal 3"
    MenuItem N1MDIChildWindow1
      tag "1 MDI Child Window #1"

window ChildWin MDIChildWindow1
  tag "MDI Child Window #1"
  parent TestApplication
  TextField TextField1
    tag "#1"