QTP10.com is a new and completely free website that offers help in all the versions of HP QTP (including latest version 10). More importantly, it offers free code for users of HP QuickTest Professioal. This site helps you in learning the basics of QTP and descriptive/advanced programming in (QTP) on various environments like - .Net, Infragistics, Web, Windows, etc.

Note -
This blog is NOT affiliated with HP / Hewlett-Packard in any way. The data/questions come from various sources and we have our own testing questions. I am just another Software Tester like you.

Managing QTP Test Scripts - QTP Tutorial 2

Share This Post -

Sponsored Links:

We can use the File menu to create, open, save, zip, unzip, and print tests, as well as create standalone, portable tests.

This section includes:

  • Creating a New Test
  • Opening an Existing Test
  • Saving a Test
  • Creating Portable Copies of Your Tests
  • Zipping a Test
  • Unzipping a Test
  • Printing a Test

Creating a New QTP Test


    To create a new test, click the New button or select File > New > Test. A new test opens, with a new action selected in the Keyword View. You are ready to start creating your test.

    If the test you select was last saved in an older version of QuickTest, you may be asked whether to convert the test to the current version or view it in read-only format.

    To open an existing test:

  • (Optional) Connect to a Quality Center server and project.
  • Select File > Open > Test, or click the Open down arrow and select Test. The Open Test dialog box opens.
  • In the sidebar, select the location of the test, for example, File System or Quality Center Test Plan.
  • Browse to and select a test. You can select the Open in read-only mode option at the bottom of the dialog box. Click Open. The test opens and the title bar displays the test name.
  • Note: If the test is stored in a version control-enabled Quality Center project, the Open button contains a down arrow, enabling you to open the test and immediately check it out.

    Tip: You can open a recently used test by selecting it from the Recent Files list in the File menu.

Saving a Test


You can save a new test or save changes to an existing test.

Tip: If changes are made to an existing test, an asterisk (*) is displayed in the title bar until the test is saved.

Note: You must use the Save As option in QTP if you want to save a test under another name or create a copy of a test. You cannot copy a test or change its name directly in the file system or in Quality Center.

To save a new test:

  1. (Optional) Connect to a Quality Center server and project. QTP information, see Connecting to and Disconnecting from Quality Center.
  2. Click the Save button or select File > Save to save the test. The Save QTP Test dialog box opens.
  3. In the sidebar, select the location to save the test, for example, File System or Quality Center Test Plan.
  4. Browse to and choose the folder in which to save the test. Note: In the file system, QTP suggests a default folder called Tests. For all supported operating systems except Windows Vista, this folder is located under your QTP Professional installation folder. For Windows Vista, this folder is located under MyDocuments\HP\QTP Professional.
  5. Type a name for the test in the File name box. Note that the test name cannot exceed 220 characters (including the path), cannot begin or end with a space, and cannot contain the following characters: \ / : * ? " < > | % '
    If you save the test to Quality Center, the file path must not contain two consecutive semicolons (;;).
  6. If you are recording and want to save the Active Screen files with your test, confirm that Save Active Screen files is selected. If you clear this box, your Active Screen files will not be saved, and you will not be able to edit your test using the options that are normally available from the Active Screen.
  7. Clearing the Save Active Screen files check box can be especially useful for conserving disk space once you have finished designing the test and you are using the test only for test runs.
  8. Tip: If you clear the Save Active Screen files check box and then later want to edit your test using Active Screen options, you can regenerate the Active Screen information by performing an Update Run operation.

Note: You can also instruct QTP not to capture Active Screen files while recording or to only capture Active Screen information under certain conditions. You can set these preferences in the Active Screen pane of the Options dialog box.

Click Save. QTP displays the test name in the title bar.

To save changes to an existing test:

  1. Click the Save button to save changes to the current test.
  2. Select File > Save As to save an existing test to a new name or a new location. If you select File > Save As, the following options are available:
  • Select or clear the Save Active Screen files check box to indicate whether or not you want to save the Active Screen files with the new test. For more information, see step 6 above.
  • Select or clear the Save test results check box to indicate whether or not you want to save any existing test results with your test.

Note that if you clear this box, your test result files will not be saved, and you will not be able to view them later. Clearing the Save test results check box can be useful for conserving disk space if you do not require the test results for later analysis, or if you are saving an existing test under a new name and do not need the test results.

Creating Portable Copies of QTP Test Scripts


Tests and their resource files are often stored on a network drive or in Quality Center, as this enables the reuse of actions and other resources, and helps ease test management.

Sometimes, you may need to open or run a test when you do not have access to a network drive or Quality Center. For example, you may need to create a portable copy of a test for use when travelling to other sites. You can save a standalone copy of your test and its resource files to a local drive or to another storage device using the File > Save Test with Resources command.

When you save a test in this manner, QTP creates a copy of the following and saves the files in the location you specify:

  • Source test. QTP saves a copy of this test in the location you specify.
  • Resource files. QTP saves a copy of all resource files associated with the source test, such as function libraries and shared object repositories. QTP stores these files in sub-folders of the copied test.
  • Called actions. QTP saves a copy of any external actions called by the source test. For example, if Test A calls actions that are stored in Test B, QTP creates a local copy of the actions stored in Test B and stores them in a sub-folder of Test A. The sub-folder has the same name as the test from which the called actions were copied. In this example, the sub-folder is named Test_B. QTP also creates a copy of any resources associated directly with these actions, such as its local shared object repositories and action sheets in the Data Table. QTP does not, however, save the resource files associated with Test B, so you must ensure that these resources are associated with the source test, Test A.
    This enables you to modify or run the test without access to a network drive or Quality Center.

Tip: If you use QTP with a concurrent license but do not have access to the concurrent license server (for example, during a business trip), you can install a commuter license.

Zipping QTP Test Scripts
QTP tests contain a series of configuration, run-time, setup data, and (optionally) Active Screen files. QTP saves these files together with the test. You can zip these files to conserve space and make the tests easier to transfer.

To zip a test:

  • Do one of the following:
    Select File > Export Test to Zip File to open the Export to Zip File dialog box.
  • Select the Archive test and resource files in a .zip file check box in the Save Test with Resources dialog box (File > Save Test with Resources).
  • Type a zip file name and path, or accept the default name and path, and click OK. QTP zips the test and its associated files.

Unzipping a Test


You can unzip a test when needed.

To unzip a zipped test:

  • Select File > Import Test from Zip File. The Import from Zip File dialog box opens.

  • Enter or select the name of the zip file that you want to unzip, choose a target folder into which you want to unzip the files, and click OK. QTP unzips the test and its associated files.

Print QTP Test Scripts


You can print your entire test from the Keyword View (in table format). You can also print a single action either from the Keyword View (in table format) or the Expert View (in statement format). When printing from the Expert View, you can also specify additional information that you want to be included in the printout.

To print from the Keyword View:

  • Click the Print button or select File > Print. A standard Print dialog box opens.
  • Click OK to print the content of the Keyword View to your default Windows printer.


Tip: You can select File > Print Preview to display the Keyword View on screen as it will look when printed. Note that the Print Preview option works only with tests created using QTP 8.0 and later.

To print from the Expert View

  • Click the Print button or select File > Print. The Print dialog box opens.
  • Specify the print options that you want to use.
    If you want to print to a different printer, or change your printer preferences, click Setup to display the Print Setup dialog box.
  • Click Print to print according to your selections.
  • Go Back to –> QTP Tutorial Learn QTP – Design QTP Scripts