10 Dec 2012

Reporting Defect

Defining our own Result in result summary

QTP has 4 types of result status

Pass
Fail
Done
Warning

Result is captured using ReportEvent Method

Generally QTP provides, test results, if we use qtp tool features like checkpoints. Suppose if we use flow control statements (conditional and Loop statements), then we have to define our own result.For defining our own results, QTP is providing an utility object called "Reporter" by using reporter, we can define our own results.

Syntax:

Reporter.ReportEvent EventStatus, ReportStepName, Details [, Reporter]

Arguments:

EventStatus:             Status of the report step.Different types of event status are mentioned below:

0 or micPass:        Causes the status of this step to be passed and sends the specified message to the report.

1 or micFail:         Causes the status of this step to be failed and sends the specified message to the report. When this step runs, the test fails.

2 or micDone:       Sends a message to the report without affecting the pass/fail status of the test.

3 or micWarning:  Sends a warning message to the report, but does not cause the test to stop running, and does not affect the pass/fail status of the test.

ReportStepName:   (String)Name of the intended step in the report (object name).

Details:                (String)Description of the report event. The string will be displayed in the step details frame in the report.


Ex 1: The following example use the ReportEvent method to report a Passed step with different format of  Event  status

Reporter.ReportEvent 0, "User Login", "Passed as the Login functionality worked as per the requirment"

'OR

Reporter.ReportEvent micPass, "User Login", "Passed as the Login functionality worked as per the requirment"

Ex 2: The following example use the ReportEvent method to report a Failed step with different format of  Event  status

Reporter.ReportEvent 1, "User Login", "Failed as the Login functionality didn't work as per the requirment"

'OR

Reporter.ReportEvent micFail, "User Login", "Failed as the Login functionality didn't work as per the requirment"

Ex 3: The following example use the ReportEvent method to report a Done step with different format of  Event  status

Reporter.ReportEvent 2, "User Login", "The Login functionality is validated"

'OR

Reporter.ReportEvent micDone, "User Login", "The Login functionality is validated"

Ex 4: The following example use the ReportEvent method to report a Warning step with different format of  Event  status

Reporter.ReportEvent 3, "User Login", "Warning : No input provided"

'OR

Reporter.ReportEvent micWarning, "User Login", "Warning : No input provided"

No comments:

Post a Comment