Active Accessibility, Automated Test Harness

### Introduction

### Running the Tool

### Features

### Recorder

### Playback

### Outstanding Issues

### Known Issues

### Test tool files

### Introduction

The Automated Test Harness tool has been built on Microsoft Active Accessibility (MSAA) technology. It can be used with all Visual Foxpro applications. The Mouse and Keyboard events in the VFP applications can be recorded and played back at any time. So it can be used to test an application

### Running the Tool

To run the tool, do the following:

1. The files are installed in the folder \Tools\Test\ folder under the VFP home directory. Run the main program AATEST.APP.
   From the Visual FoxPro command prompt give
   DO (HOME() + "tools\test\aatest")
2. To record the script, click Record button in the toolbar or select from Menu. You see a list of available applications. Also you can launch a new Visual FoxPro instance from the Fox button provided.
3. Select a Visual FoxPro application. You see a prompt to enter the "Test name" to identify the test.
4. Now, the selected VFP application/window will be brought on top which is ready to record the events. You can enter the events you wish to record. To start with, enter the commands from command window or use the menu directly. Make sure you click the parent menu to select the submenu (such as Tools/Wizard). You cannot just move your mouse to select the sub menu, it should be clicked.
5. When finished, click Stop. You can also pause and resume recording.

   To view the events log which has been selected or currently recorded, click "Edit the script".

   To play back the scripts, select the script you want to run and click Play button. If the program detects an error, you see a prompt in the testing application.

   To see the test log, select the Testlog tab.

   Note: Only one instance of the test tool can be run from one installation. This is because the test tables are opened exclusively.

### Features

With the Automated Test Harness you can:

- Work with all operations on the controls within a form
- Call multiple forms
- Use ActiveX controls, dialog boxes and @ ... GET within a window
- Use hotkeys and special keys such as F2, pgdn, alt+S
- Access menus and sub-menus
- Click the title bar (Controlbox, Closebox, Minbutton...) except in system dialog boxes like MESSAGEBOX
- Recalculate the mouse events positions if the object postion is changed.
- Playback the events properly even if the main VFP application is changed (re-sized or maximized)
- Record by entering the commands from command window itself or selecting from the menu
- The selections in the settings tab will provide options to record and playback.
- The coverage logging can be set while testing using the settings in the settings tab.
- The testlog has the time taken to run the script and memory usage

  ### Recorder

  The recorder uses Visual FoxPro event logging to log all events, such as mouse and keyboard. A separate VFP instance which has been already loaded can be selected for recording or a new instance can be selected. If the option "Always Launch new VFP Window" in the settings tab has been checked, the recording will always started with new instance of VFP. If the script name already exists, it will ask confirmation to overwrite unless the option "Overwrite the script if already exists" checked.

  ### Playback

  The playback logic uses Active Accessibility in part to find the objects and window postions. The program emulates output events like keyboard and mouse using windows APIs and Visual FoxPro functions.

  More than one script can be chosen to playback at any time. The script selection can be done by checking the first column in the browse. The currently recorded script will be selected by default. Each script will run the number of times specified in "Run Count" field in the settings tab. The playback can be delayed by selecting "Delay between events". If the checkbox "Validate startup window before playback" is checked, the startup window is validated against the recorded window. If it doesn't match, it will prompt with error. The test will fail if unexpected window appears or an error is occurred. There is an option whether to abort the testing, skip only the current event or continue playing back in the settings tab. The test results can be viewed from the grid in "Test Log" tab. The memory usage will be difference in the memory before and after the testing, to find out the memory leakage.

  The coverage logging can be set using the setting in the "Coverage Log" tab. During playback, it will turn on the coverage logging and save the log in the file specified. Coverage profiler button will invoke the coverage profiler if it has been set in VFP Tools menu. The coverage profiler will load the coverage log file if exists otherwise it will prompt for existing file

  ### Outstanding Issues

  The following outstanding issues exist for the Automated Test Harness:

- Because Visual FoxPro does not support keyboard commands such as shift+tab or ctrl+tab, you cannot use them with this program.
- Clicking the title bar on dialog boxes such as MESSAGEBOX() may not work because the positions are not consistent.

### Known Issues

The following known issues exist for the Automated Test Harness:

- Clicking the edges of menus or objects does not work consistently.
- You cannot use the mouse to drag and drop a window or an object.
- While running the tool, if the Checkboxes are clicked after selecting from the toolbar, it wouldn't get checked properly
- Clicking on the scrollbar of the combobox is not played back properly because the window name/title is not get recorded.

  ###

  ### Test tool files

> Following are the list of files used (installed in \Tools\Test\ folder under the VFP home directory) with the Automated Test Harness:

> File Name | Extensions | Description
> AATest | app/pjx/pjt | The main program/project
> AATest | scx/sct | The main form including the recording/playback logic
> AAUtils | vcx/vct | The class library which has the class cstglobal. This is shared by different forms.
> AAScripts | dbf/fpt | The event logging table. This stores all the scripts that are created.
> AATestLog | dbf/fpt | The test log table which has the information of each test run.