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.

Software Test Automation Tools – Potential benefits & risks

Potential benefits of using Software Test Automation tools include:

  • 1. Repetitive work is reduced (e.g. running regression tests, re-entering the same test data, and checking against coding standards).
  • 2. Greater consistency and repeatability (e.g. tests executed by a tool, and tests derived from requirements).
  • 3. Objective assessment (e.g. static measures, coverage and system behaviour).
  • 4. Ease of access to information about tests or testing (e.g. statistics and graphs about test progress, incident rates and performance).

Risks of using Software Test Automation tools include:

  • Unrealistic expectations for the tool (including functionality and ease of use).
  • Underestimating the time, cost and effort for the initial introduction of a tool (including training and external expertise).
  • Underestimating the time and effort needed to achieve significant and continuing benefits from the tool (including the need for changes in the testing process and continuous improvement of the way the tool is used).
  • Underestimating the effort required to maintain the test assets generated by the tool.
  • Over-reliance on the tool (replacement for test design or where manual testing would be better).

Reference: http://www.astqb.org/educational-resources/syllabi-tool6.php

Understanding Report.ReportEvent method in QTP

You can define a message that QTP sends to your test results. For example, suppose you want to check that a password edit box exists in the Login Form. If the edit box exists, then a password is entered. Otherwise, QTP sends a message to the test results indicating that the object is absent.

To send a message to your test results:

In the Keyword View, select a step and choose Insert > Step > Report or right-click a step and choose Insert Step > Report. The Insert Report dialog box opens.

Report.ReportEvent method in QTP

Select the status that will result from this step from the Status list.

  • Passed: Causes this step to pass. Sends the specified message to the report.
  • Failed: Causes this step (and therefore the test or component itself) to fail. Sends the specified message to the report.
  • Done: Sends a message to the report without affecting the pass/fail status of the step.
  • Warning: Sends a warning status for the step, but does not cause the test or component to stop running, and does not affect its pass/fail status.

In the Name box, type a name for the step, for example, Password edit box.

In the Details box, type a detailed description of this step to send to your test results, for example, Password edit box does not exist.

Click OK. A report step is inserted into the Keyword View and a ReportEvent statement is inserted into your script in the Expert View.

For example:

Reporter.ReportEvent micFail, "Password edit box", "Password edit box does not exist"

In this example, micFail indicates the status of the report (failed), Password

edit box is the report name, and Password edit box does not exist is the report message.

How to get the List of all subfolders in QTP – VBScript Code

With the help of FileSystemObject, we can get the List of all subfolders in QTP. Lets assume that Folder Structure is:

Test folder structure for QTP

Set a = CreateObject("Scripting.FileSystemObject")
    Set b = a.GetFolder("D:\PFolder")
    Set c = b.SubFolders
    For Each d in c
    msgbox e

How to get the List of all subfolders in QTP – VBScript Code

How to get File Creation Date & Time with QTP - Codes

Below is the QTP Code to get file creation Date and Time:

QTP Code

Set f1 = CreateObject("Scripting.FileSystemObject")
    Set f2 = f1.GetFile("D:\Generic Test Plan.doc")
    S = "File was Created on: "&f2.DateCreated
    Msgbox S