Events are unscheduled occurrences or conditions to which you want the target application to respond in a specified manner. Test Partner supports two categories of events: Wait and Whenever.
A Wait event tells Test Partner to wait for a specified occurrence before proceeding. Wait events are useful in situations where you cannot anticipate the amount of time a response will take. An example of a Wait event would be waiting for a system login prompt. When your script is running against a network-based application that requires the user to log in, the amount of time it takes for the login prompt to display may vary. To account for this variance, you can insert a Wait event that instructs your script to wait for the login prompt before proceeding to type a username and password.
A Whenever event tells Test Partner to watch for a specific occurrence and, if it occurs, perform a special set of steps. Whenever events are useful for trapping unexpected error conditions during a test run. For example, you can include events in your scripts to recognize when the connection to the server has been interrupted by a communications error or a network system message has been received, so that the script can report or work around the problem. In a script, Test Partner automatically inserts the Script_Whenever function by default to handle the whenever event. If a whenever event is inserted into a module, shared module, or class module, you must customize the whenever event handler code. Test Partner supports the following types of Events:
i) Bitmap Event:--
A bitmap event detects the presence, absence, or state of a graphic in a window.
ii) Date/Time Event:--
Date/Time events enable you to define a date or time condition. Test Partner recognizes the event by monitoring the internal clock of the computer on which it and the target application are running.
iii) Key Event:--
Watch for the entry of a particular keystroke combination by the user. You can use key events to:
Build your own “hotkeys” to make Test Partner perform an action whenever the hotkey is used.
Interrupt a script to take manual control of the target application.
Pause a script until a particular key is used.
Prevent certain keys from being entered.
iv) Menu Events:--
Watch for when a particular menu item is selected by the user.
v) Mouse Events:--
Watch for when one of the mouse buttons is clicked or released in a certain window.
vi) Screen Events:--
A screen event detects the presence or absence of text in a window. The most common use of screen events is to synchronize with host-based applications and to detect error messages.
vii) Window Events:--
A window event detects an action on a window; for example, its creation, destruction, movement, or its existence.
Data Driven Test:--
The Test Partner Active Data Test Creation wizard provides a non-programmatic way to create data-driven tests. Such tests are useful for testing form-based applications. Using the wizard, you can record a test, choose the fields you want to include in your data file, then populate the data file itself using a data table.
To create a data test
1. From the Script menu, choose Create Data Test. The Data Test wizard appears.
2. Read the instructions and click Next.
3. Follow the instructions in the Data Layout Assistant for the three steps necessary to define the scope of the test.
4. Enter a name for the Data Table.
5. Exclude any fields you do not want to include in the test by unchecking the Use checkbox and click Next.
6. Read the instructions and click Finish.
TestPartner shows the Data Table, which includes a column for each field you defined and one row of data. The data table also includes a column labelled Results Script, to specify a script to be run after the data driven test.
To modify the data table.
1. If you have just recorded a new data test and the data table is open, proceed to step 3.
2. To modify an existing data test, select Modify Data Table on the Script menu and choose the data table you want to change.
3. To add rows and populate the table with test data, right-click on the empty row labelled END ( or any other row) and select Insert on the context menu. Test Partner inserts a new row above the selected row.
4. Enter test data into the cells of the new row.
5. Alternatively, right-click the empty row and choose Import. You can import data from a tab-delimited text (.TXT) or comma-delimited (.CSV) file to populate the cells of the data table. If you select the END row in the table, TestPartner will add multiple rows if needed to accommodate the data.
6. To delete rows from the table, right-click the row and choose Delete. To delete multiple rows, press the Ctrl or Shift (for contiguous rows) key while selecting rows to delete.
7. To launch another script from the data test, insert the name of the script in the Results Script field in the table at any point(s) at which you want to run the script.
8. When you have finished editing the data table, click Save and Close to exit.