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.
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.