Seapine Labs
Personal tools

Custom Controls

From Seapine Labs

Jump to: navigation, search

QA Wizard Pro recognizes both standard and custom controls. Standard controls include such things as, check boxes, combo boxes, edit boxes, and buttons. Scripts can perform checks and specific actions on standard controls. The available actions depend on the type of control. For example, you can enter text or select an item in a combo box, but you can only click a button.

In the Application Repository, standard controls are named using the object type, a number, and a corresponding icon.

 Figure 1: Standard control
Figure 1: Standard control

Custom controls are objects that QA Wizard Pro does not recognize as conventional Windows or Web items, such as custom grids or dynamic list items. In the repository, custom controls are numbered using the generic “Control” identifier and a number.

 Figure 2: Custom control
Figure 2: Custom control

Only the following low-level actions are available for custom controls.

  • Left mouse button down
  • Left mouse button up
  • Middle mouse button down
  • Middle mouse button up
  • Right mouse button down
  • Right mouse button up
  • Mouse move
  • Key press

You can combine low-level actions to interact with a custom control. For example, use Left mouse button down and Left mouse button up together to click an item.

[edit] Recording actions on custom controls

When creating a script against an application with custom controls, you can record interactions by clicking Low-Level on the Recording toolbar. QA Wizard Pro records every mouse movement until you click Low-Level again. The script will contain many low-level steps that will duplicate mouse moves exactly on playback.

 Figure 3: Low-level steps
Figure 3: Low-level steps

[edit] Streamlining text entry in custom controls

When recording input into a generic control, typed text often appears as individual key press steps, making scripts difficult to read. The following example shows a script that enters ‘Name1’ in a custom field. Notice the pairs of KeyDown and KeyUp statements for each character.

 Figure 4: Low-level text entry
Figure 4: Low-level text entry

To replace these steps, you can create a subroutine that parses a passed text string and types each letter.

In the following script, line 13 creates a subroutine named ‘EnterText’ that accepts one argument ‘Text’. Text contains the string that you want to enter in the field. Line 14 determines the length of the text string and sets it equal to the variable y.

Steps 15 through 30 are a loop that runs for each character in the string (from 1 to y, which is the length of the string). Step 16 sets the variable Key equal to the leftmost character.

Steps 17 through 27 (a series of If statements) determine the ASCII value for the leftmost character and then reset the value of Key. Line 28 enters the character into the field using a KeyPress statement and the ASCII character code determined in the If statements. Step 29 removes the first character in the string (the character just evaluated) and sets Text equal to the new string before starting another iteration of the loop.

If the Text equals the string ‘Name1’, y equals 5 and the loop repeats five times. The first time through the loop, the KeyPress statement is KeyPress(N, Shift). After the character is entered into the field, the Text variable resets to ‘ame1’.

 Figure 5: Enter Text Subroutine
Figure 5: Enter Text Subroutine

To implement the subroutine, you can either create it in the script where it will be used or store it in a separate script and call it. Replace the individual KeyPress steps with a step that contains the subroutine name and the text to enter.

 Figure 6: Original script
Figure 6: Original script
 Figure 7: Script with subroutine call
Figure 7: Script with subroutine call

Note: Make sure that focus is on the field prior to entering the text (notice steps 36 and 37).














Issue Management Software | Source Code Control Software | Test Case Management | Requirements Management Software