Monday, January 2, 2012

VBScript Constants

A constant is a meaningful name that takes the place of a number or string and never changes. VBScript defines a number of intrinsic constants .

Creating Constants

You create user-defined constants in VBScript using the Const statement. Using the Const statement, you can create string or numeric constants with meaningful names and assign them literal values. For example:
Const MyString = "This is my string."
Const MyAge = 49
Note that the string literal is enclosed in quotation marks (" "). Quotation marks are the most obvious way to differentiate string values from numeric values. You represent Date literals and time literals by enclosing them in number signs (#). For example:
Const CutoffDate = #6-1-97#

Learning Virtual Objects

You can teach QuickTest to recognize any area of your application as an object by defining it as a virtual object. Virtual objects enable you to record and run tests on objects that are not normally recognized by QuickTest.

About Learning Virtual Objects

Your application may contain objects that behave like standard objects but are not recognized by QuickTest. You can define these objects as virtual objects and map them to standard classes, such as a button or a check box. 


QuickTest emulates the user's action on the virtual object during the run session. In the test results, the virtual object is displayed as though it is a standard class object.

For example, suppose you want to record a test on a Web page containing a bitmap that the user clicks. The bitmap contains several different hyperlink areas, and each area opens a different destination page. When you record a test, the Web site matches the coordinates of the click on the bitmap and opens the destination page. 

To enable QuickTest to click at the required coordinates during a run session, you can define a virtual object for an area of the bitmap, which includes those coordinates, and map it to the button class. When you run a test, QuickTest clicks the bitmap in the area defined as a virtual object so that the Web site opens the correct destination page.

You define a virtual object using the Virtual Object Wizard (Tools > Virtual Objects > New Virtual Object). The wizard prompts you to select the standard object class to which you want to map the virtual object. You then mark the boundaries of the virtual object using a crosshairs pointer. Next, you select a test object as the parent of the virtual object. Finally, you specify a name and a collection for the virtual object. A virtual object collection is a group of virtual objects that is stored in the Virtual Object Manager under a descriptive name.

Working with Microsoft Internet Explorer

Keep the following in mind when using Microsoft Internet Explorer as your Web browser:
  • QuickTest Professional Web support behaves as a browser extension in Microsoft Internet Explorer. Therefore, you cannot use the Web Add-in on Microsoft Internet Explorer without enabling the Enable third-party browser extensions option. To set the option, in Microsoft Internet Explorer choose Tools > Internet Options > Advanced and select the Enable third-party browser extensions option.
  • QuickTest Professional does not support tabbed browsing. Therefore, if your version of Microsoft Internet Explorer supports tabbed browsing, you must disable this option in Internet Explorer before using the Web Add-in.
  • To disable the option in Internet Explorer, choose Tools > Internet Options > General > Change how webpages are displayed in tabs > Settings and clear the Enable Tabbed Browsing option. After clearing this option, you must restart your browser before using the QuickTest Professional Web Add-in.

Sunday, January 1, 2012

Common methods

Back Method
Navigates to the previous page in the browser history list.
Syntax --object.Back

CaptureBitmap Method 
Saves a screen capture of the object as a .png or .bmp image, depending on the specified file extension
Syntax--object.CaptureBitmap FullFileName

GetROProperty Method
Returns the current value of the test object property from the object in the application.
Syntax--object.GetROProperty (Property, [PropertyData])


GetTOProperties Method
Returns the collection of properties and values used to identify the object.
Syntax--object.GetTOProperties

SetTOProperty Method 
Sets the value of the specified property in the test object description
Syntax--object.SetTOProperty Property, Value

Output Method 
Retrieves the current value of an item and stores it in a specified location
Syntax--object.Output Verify

WaitProperty Method
Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step.
Syntax--object.WaitProperty (PropertyName, PropertyValue, [TimeOut])

Sync Method
Waits for the browser to complete the current navigation.
Syntax--object.Sync

ChildObjects Method
Returns the collection of child objects contained within the object.
Syntax--object.ChildObjects ([Description])

Close Method
Closes the browser window.
Syntax--object.Close


DataTable Object--The run-time Data Table. 

AddSheet Method--Adds the specified sheet to the run-time Data Table and returns the sheet so that you can directly set properties of the new sheet in the same statement.

Syntax--DataTable.AddSheet(SheetName)

DeleteSheet Method  --Deletes the specified sheet from the run-time Data Table. 

Syntax--DataTable.DeleteSheet SheetID

Export Method--Saves a copy of the run-time Data Table in the specified location. 

Syntax--DataTable.Export(FileName)

ExportSheet Method--Exports a specified sheet of the run-time Data Table to the specified file.


  • If the specified file does not exist, a new file is created and the specified sheet is saved.

  • If the current file exists, but the file does not contain a sheet with the specified sheet name, the sheet is inserted as the last sheet of the file.

  • If the current file exists and the file contains the specified sheet, the exported sheet overwrites the existing sheet.
Syntax--DataTable.ExportSheet(FileName, DTSheet)

GetCurrentRow Method--Returns the current (active) row in the first sheet in the run-time Data Table (global sheet). 

Syntax--DataTable.GetCurrentRow

GetRowCount Method--Returns the total number of rows in the longest column in the first sheet in the run-time Data Table (global sheet). 

Syntax--DataTable.GetRowCount

GetSheet Method  --Returns the specified sheet from the run-time Data Table. 

Syntax--DataTable.GetSheet(SheetID)

GetSheetCount Method--Returns the total number of sheets in the run-time Data Table. 

Syntax--DataTable.GetSheetCount.

GlobalSheet Property--Returns the first sheet in the run-time Data Table (global sheet). 

Syntax--DataTable.GlobalSheet

Import Method--Imports the specified Microsoft Excel file to the run-time Data Table.

Syntax--DataTable.Import(FileName)

ImportSheet Method--Imports a sheet of a specified file to a specified sheet in the run-time Data Table. The data in the imported sheet replaces the data in the destination sheet (see SheetDest argument). 

Syntax--DataTable.ImportSheet(FileName, SheetSource, SheetDest

LocalSheet Property--Returns the current (active) local sheet of the run-time Data Table.

Syntax--DataTable.LocalSheet

RawValue Property--Retrieves the raw value of the cell in the specified parameter and the current row of the run-time Data Table. The raw value is the actual string written in a cell before the cell has been computed, such as the actual text from a formula. 

Syntax--DataTable.RawValue ParameterID [, SheetID]

  SetCurrentRow Method--Sets the specified row as the current (active) row in the run-time Data Table. 

Syntax--DataTable.SetCurrentRow(RowNumber)

SetNextRow Method--Sets the row after the current (active) row as the new current row in the run-time Data Table. 

Syntax--DataTable.SetNextRow

SetPrevRow Method--Sets the row above the current (active) row as the new current (active) row in the run-time Data Table. 

Syntax--DataTable.SetPrevRow

Value Property--DataTable default property. Retrieves or sets the value of the cell in the specified parameter and the current row of the run-time Data Table.

Syntax--To find the value:DataTable.Value(ParameterID [, SheetID])
 

 

 

 

 

 

 
 

 

 

 

 

 
 

 

 

 

 

 


 


 

 

 

 

 

 


 












Web Environment

The objects, methods, and properties described in this section can be used when testing Web objects.

Browser--The Web browser. The name of the Browser test object is the same as the first recorded Page object
Frame-- An HTML frame.
Image-- An image with or without a target URL link
Link-- A hypertext link.
Page-- An HTML page.
ViewLink-- A Viewlink object.
WebArea-- A section of an image (usually a section of a client-side image map).
WebButton-- An HTML button
WebCheckBox-- A check box with an ON and OFF state.
WebEdit--An edit box, usually contained inside a form
WebElement--A general Web object that can represent any Web object
WebFile--An edit box with a browse button attached, used to select a file from the File dialog box.
WebList--A drop-down box or multiple selection list.
WebRadioGroup--A set of radio buttons belonging to the same group
WebTable--A table containing a variable number of rows and columns.

Running and Analyzing a Test with Regular Expressions

  1. Run the RegExpression test.
  2. Click the Run button or choose Automation > Run. The Run dialog box opens.
    Select New run results folder and accept the default results folder name.
    Click OK. When the test run is completed, the Test Results window opens.
  3. Examine the checkpoint results.
  4. In the results tree, expand (+) Test RegExpression Summary > RegExpression Iteration 1 (Row 1) > Action1 Summary > Welcome: Mercury Tours > Select a Flight: Mercury
    Select CheckPoint "CheckExpectedText".
    The checkpoint passed because the text was displayed in the format specified by the regular expression.
  5. Exit the Test Results window.
  6. Choose File > Exit to close the Test Results window.

Working with Regular Expressions

 You will create a text checkpoint on a date text string that changes according to the selected flight date. You can define the date as a regular expression so that the checkpoint checks that the captured text string matches the expected format, rather than checking the exact text.

To do this, you will create a text checkpoint with a regular expression that will match any single character within a defined range.

  1. Start QuickTest and open the Recording test.
  2. If QuickTest is not already open, choose Start > Programs > QuickTest Professional > QuickTest Professional.

    • If the Welcome window opens, click Open Existing.

    • If QuickTest opens without displaying the Welcome window, choose
      File > Open or click the Open button .
    • In the Open Test dialog box, locate and select the Recording test, then click Open.

  3. Save the test as RegExpression.
  4. Choose File > Save As. Save the test as RegExpression.

  5. Confirm that the Active Screen option is enabled.
  6. If you do not see the Active Screen at the bottom of the QuickTest window, click the Active Screen button or choose View > Active Screen.

  7. Select the text for which you will create the checkpoint.
  8. In the Keyword View, expand Welcome: Mercury: Tours and click the Select a Flight: Mercury page. The page is displayed in the Active Screen.
    In the Active Screen, scroll up and highlight the date for the outbound flight, New York to San Francisco (12/29/2007). Right-click the highlighted string and select Insert Text Checkpoint. The Text Checkpoint Properties dialog box opens.

  9. Enter the regular expression for the text you want to check.
  10. In the Checked Text area, click the Constant Value Options button . The Constant Value Options dialog box opens.

    In the Value box, replace the displayed date with [0-1][0-9]/[0-3][0-9]/200[0-9]. This instructs QuickTest to check that each character in the selected text matches the number-range format defined by the regular expression. The expression checks for the following format: MM/DD/200Y.
    Select the Regular expression check box. A message box prompts you to insert the backslash character before each special character. Click No.
    Note: Clicking Yes would cause QuickTest to treat the special characters ( [ ), ( - ) and ( ] ) as literal characters and not as a regular expression.
    Click OK to close the Constant Value Options dialog box.

  11. Rename the checkpoint.
  12. In the Name box, enter CheckExpectedText as the new checkpoint name.
    Click OK to accept the other default settings and close the Text Checkpoint Properties dialog box.
    QuickTest adds the text checkpoint to your test. It is displayed as a check operation on the Select a Flight: Mercury page in the Keyword View.

  13. Save the test.
  14. Choose File > Save or click the Save button .