Normalizing Strings in QTP

The NormalizeString function receives a string and returns the equivalent string in a regular expression.

Function NormalizeString(OrgStr)

Dim TempStr

TempStr = Replace(OrgStr, "\", "\\")

TempStr = Replace(TempStr, "*", "\*")

TempStr = Replace(TempStr, "+", "\+")

TempStr = Replace(TempStr, ".", "\.")

NormalizeString = Replace(TempStr, "?", "\?")

End function

msgbox NormalizeString ("a+b*c.d?e")

Additional Online Resources for QTP

QuickTest Professional includes the following additional online resources:

Mercury Tours sample Web site (available from the QuickTest Professional Start menu program folder and also available from the QuickTest Professional Record and Run Settings dialog box) and the Mercury Tours Windows sample flight application (available from the QuickTest Professional Start menu program folder) are the basis for many examples in this book. The URL for the Web site is http://newtours.mercury.com.

Knowledge Base (available from Help > Knowledge Base) uses your default Web browser to open the Mercury Customer Support knowledge base, which enables you to browse the Mercury and user-contributed knowledge base articles, and add your own articles. The URL for this Web site is http://support.mercury.com/cgi-bin/portal/CSO/kbBrowse.jsp.

Customer Support Web Site (available from Help > Customer Support Web Site) uses your default Web browser to open the Mercury Customer Support Web site. This site enables you to browse the knowledge base and add your own articles, post to and search user discussion forums, submit support requests, download patches and updated documentation, and more. The URL for this Web site is http://support.mercury.com.

Send Feedback (available from Help > Send Feedback) enables you to send online feedback about QuickTest Professional to the product team.

Mercury Home Page (available from Help > Mercury Home Page) uses your default Web browser to open the Mercury home page. This site provides you with the most up-to-date information on Mercury and its products. This includes new software releases, seminars and trade shows, customer support, educational services, and more. The URL for this Web site is http://www.mercury.com.

Mercury Best Practices contain guidelines for planning, creating, deploying, and managing a world-class IT environment. Mercury provides three types of best practices: Process Best Practices, Product Best Practices, and People Best Practices. Licensed customers of Mercury software can read and use the Mercury Best Practices available from the Customer Support site, http://support.mercury.com.

Modifying License Information for QTP

Working with QuickTest requires a license. When you install QuickTest, you select one of the following license types:

  • a 14-day demo license
  • a permanent seat license that is specific to the computer on which it is installed
  • a network-based concurrent license that can be used by multiple QuickTest users

You can change your license type at any time (as long as you are logged in with administrator permissions on your computer). For example, if you are currently working with a demo license, you can install a seat license, or you can choose to connect to a concurrent license server, if one is available on your network.

If needed, you can request a new seat license on the Mercury Customer Support Web site. The URL for the License Request Web site is http://support.mercury.com/license.

If you purchase external add-ins, you need to install the relevant add-in licenses.

Deleting Results Using the Windows Command Line

You can use the Windows command line to instruct the Test Results Deletion Tool to delete test results according to criteria you specify. For example, you may want to always delete test results older than a certain date or over a minimum file size.

To run the Test Results Deletion Tool from the command line:

Open a Windows command prompt and type <QuickTest installation path>\bin\TestResultsDeletionTool.exe, then type a space and type the command line options you want to use.

Note: If you use the -Silent command line option to run the Test Results Deletion Tool, all test results that meet the specified criteria are deleted. Otherwise, the Delete Test Results window opens.

Command Line Options

You can use command line options to specify the criteria for the test results that you want to delete. Following is a description of each command line option.

Note: If you add command line options that contain spaces, you must specify the option within quotes, for example:
TestResultsDeletionTool.exe -Test "F:\Tests\Keep\web objects"

-Domain Quality_Center_domain_name

Specifies the name of the Quality Center domain to which you want to connect. This option should be used in conjunction with the -Server, -Project, -User, and -Password options.

-FromDate results_creation_date

Deletes test results created after the specified date. Results created on or before this date are not deleted. The format of the date is MM/DD/YYYY.

The following example deletes all results created after November 1, 2005.

TestResultsDeletionTool.exe -Silent -Test "C:\tests\test1" -FromDate "11/1/2005"

-Log log_file_path

Creates a log file containing an entry for each test results file in the folder or test you specified. The log file indicates which results were deleted and the reasons why other results were not. For example, results may not be deleted if they are smaller than the minimum file size you specified.

You can specify a file path and name or use the default path and name. If you do not specify a file name, the default log file name is TestResultsDeletionTool.log in the folder where the Test Results Deletion Tool is located.

The following example creates a log file in C:\temp\Log.txt.

TestResultsDeletionTool.exe -Silent -Log "C:\temp\Log.txt" -Test "C:\tests\test1"

The following example creates a log file named TestResultsDeletionTool.log in the folder where the Test Results Deletion Tool is located.

TestResultsDeletionTool.exe -Silent -Log -Test "C:\tests\test1"

-MinSize minimum_file_size

Deletes test results larger than or equal to the specified minimum file size. Specify the size in bytes.

Note: The -MinSize option is available only for test results in the file system. It is not supported when working with tests in Quality Center.

The following example deletes all results larger than or equal to 10000 bytes. Results that are smaller than 10000 bytes are not deleted.

TestResultsDeletionTool.exe -Silent -Test "C:\tests\test1" -MinSize "10000"

-Name result_file_name

Specifies the name(s) of the result file(s) to be deleted. Only results with the specified name(s) are deleted.

You can use regular expressions to specify criteria for the result file(s) you want to delete. For more information about regular expressions and regular expression syntax, refer to the QuickTest Professional Basic Features User's Guide.

The following example deletes results with the name Res1.

TestResultsDeletionTool.exe -Silent -Test "C:\tests\test1" -Name "Res1"

The following example deletes all results whose name starts with Res plus one additional character. (For example, Res1 and ResD would be deleted. ResDD would not be deleted.)

TestResultsDeletionTool.exe -Silent -Test "C:\tests\test1" -Name "Res."

-Password Quality_Center_password

Specifies the password for the Quality Center user name. This option should be used in conjunction with the -Domain, -Server, -Project, and -User options.

The following example connects to the Default Quality Center domain, using the server located at http://QCServer/qcbin, with the project named Quality Center_Demo, using the user name Admin and the password PassAdmin.

TestResultsDeletionTool.exe -Domain "Default" -Server "http://QCServer/qcbin" -Project "Quality Center_Demo" -User "Admin" -Password "PassAdmin"

-Project Quality_Center_project_name

Specifies the name of the Quality Center project to which you want to connect. This option should be used in conjunction with the -Domain, -Server, -User, and -Password options.

-Recursive

Deletes test results from all tests in a specified folder and its subfolders. When using the -Recursive option, the -Test option should contain the path of the folder that contains the tests results you want to delete (and not the path of a specific test).

The following example deletes all results in the F:\Tests folder and all of its subfolders.

TestResultsDeletionTool.exe -Test "F:\Tests" -Recursive

Note: The -Recursive option is available only for folders in the file system. It is not supported when working with tests in Quality Center.

-Server Quality_Center_server_path

Specifies the full path of the Quality Center server to which you want to connect. This option should be used in conjunction with the -Domain, -Project, -User, and -Password options.

-Silent

Instructs the Test Results Deletion Tool to run in the background (silently), without the user interface.

The following example instructs the Test Results Deletion Tool to run silently and delete all results located in C:\tests\test1.

TestResultsDeletionTool.exe -Silent -Test "C:\tests\test1"

-Test test_or_folder_path

Sets the test or test path from which the Test Results Deletion Tool deletes test results. You can specify a test name and path, file system path, or full Quality Center path.

This option is available only when used in conjunction with the -Silent option.

Note: The -Domain, -Server, -Project, -User, and -Password options must be used to connect to Quality Center.

The following example opens the Test Results Deletion Tool with a list of the results in the F:\Tests\Keep\webobjects folder.

TestResultsDeletionTool.exe -Test "F:\Tests\Keep\webobjects"

The following example deletes all results in the Quality Center Tests\webobjects test:

TestResultsDeletionTool.exe -Domain "Default" -Server "http://QCServer/qcbin" -Project "Quality Center_Demo592" -User "Admin" -Password "PassAdmin" -Test "Subject\Tests\webobjects"

Note: The -Test option can be combined with the -Recursive option to delete all test results in the specified folder and all its subfolders.

-UntilDate results_creation_date

Deletes test results created before the specified date. Results created on or after this date are not deleted. The format of the date is MM/DD/YYYY.

This option is available only when used in conjunction with the -Silent option.

The following example deletes all results created before November 1, 2005.

TestResultsDeletionTool.exe -Silent -Test "C:\tests\test1" -UntilDate "11/1/2005"

-User Quality_Center_user_name

Specifies the user name for the Quality Center project to which you want to connect. This option should be used in conjunction with the -Domain, -Server, -Project, and -Password options.

This option is available only when used in conjunction with the -Silent option.