Generating HTML Reports for HP Quick Test Pro (QTP)

2011-09-04  张林 

Generating HTML Reports for HP Quick Test Pro (QTP)Do you struggle to provide detailed automation reports to stakeholders and clients automatically from your QTP projects? Do you struggle with various formats for your reporting from excel to converting QTP results to generating text files with? Do you have to add extra code to capture screen shot each time you need to capture a screen shot?

Won’t it be nice if you could just call a logging method which will create detailed HTML reports for your QTP projects which could be distributed to all stakeholders? How about if you could just capture screen shots on each failure and link them to your reports so that you could just navigate to them from within your report? Won’t it be even better if HTML reports provided detailed logging, highlighted failures and provided consolidated results with execution time for each step/validation point in your scripts?

If the answer is yes, you should look at this HTML Reporting Utility from Alliance to help you create HTML reports in minutes for your QTP projects which allows you to generate HTML format reports along with QTP Native Report by making use of QTP QFL file

This HTML Reporting utility creates two HTML reports for each execution cycle.

• Module specific and Detailed Report with Test Step pass/Fail status.

• Test Summary Report detailing about Automation to Manual traceability and Execution Duration

How to use the reports?

It is a simple 3 step process.

1. Register the AGS_HTMLReport.DLL using RegSvr32 command

2. Create a QTP Script & Add the AGS_HTML_Report.qfl to Test Resources.

3. Call the SetProject() to start creating reports and LogMessage() to generate QTP + HTML Report

Registering AGS_HTMLReport.DLL

1. Windows Run-> Regsvr32 <Path of DLL>\AGS_HTMLReport.dll

2. If DLL registered successfully, then you will get confirmation as below.

Adding HTML_Report.QFL to QTP Test Resources

1. Open QTP

2. Navigate to File-> Setting

3. In Test Settings Window-> Select Resources

4. Click ‘+’ in Associated Function Libraries and click .. Button

5. Navigate to AGS_HTMLReport.QFL Path & select it and click OK

HTMLReport Utility API Usage Example

SetProject "Mercury Tours","Reservation","C:\temp\"

LogMessage gStart ,"Opening Application ","URL: " & sURL

LogMessage gInfo ,"Enter User Name :","mercury"

LogMessage gPass,"Validating Login", "User Logged in Successfully"

LogMessage gfail,"Validating Login", "Error in Login. Unable to Proceed Further"

The above sample script creates two HTML reports, Module Specific and Test Summary in C:\Temp\.



Module Specific HTML Report Format


Test Summary Report Format

HTMLReport Utility API

SetProject()

Call SetProject() to initialize the report with AUT Name and location to store the HTML reports.

Syntax: SetProject(sProjectName, sModule, sResultsPath)

sProjectName - Name of the application under test (AUT)

sModule – Module name under test for the AUT

sResultsPath – Full path where to store the HTML reports


LogMessage ()

Call LogMessage() to log a step in QTP and HTML reports.

Syntax: LogMessage(iResult, sMsg, sExtended )

iType – represents the result of the step to log into the report. This supports following values:

o gPass – To Log pass in the report

o gFail – to Log failure in report. This type automatically captures screenshot of application state and links to HTML report.

o gWarning – To log warning in the report

o gInfo/gDone – To log a step for information purpose in the report

o gStart – To log starting point of function/action

sMsg – Detailed description of the current step like action name, validation details, object description etc

sExtended – To capture actual and expected results OR any additional description to capture about the step or details


Summarize_Results()

Call Summarize_Results() to add summary at the end of the reports like total pass/fail/warning and execution duration in HTML reports.

Syntax: Summarize_Results(gsAutomationID, gsScenarioID, gsManualTestCase)

gsAutomationID – Automation ScenarioID

gsScenarioID – Manual Test Scenario ID

gsManualTestCase – Manual Test Case ID


Append_To_ResultFile()

Call Append_To_ResultFile() to append current scenario test results to an existing HTML Report

Syntax: Append_To_ResultFile()


Close_Report()

Call Close_Report() at the end of execution to destroy the HTMLReport Object

Syntax: Close_Report()


Sample Implementation of HTMLReport

The attached zip contains a sample QTP test using AGS_HTMLReport.DLL and AGS_HTMLReport.QFL for Mercury Tours Web Application.

Download the attached ZIP File which contains two folders.

HTML Report_Usage Script – This is the QTP sample script with two actions and AGS_HTMLReport.QFL file associated with Test.

QTP_HTML_Plugin – Contains AGS_HTMLReport.DLL and AGS_HTMLReport.QFL.

Pre-requisites for Execution:

• Copy the AGS_HTMLReport.DLL to windows folder and register this DLL as mentioned in section 3.

• Verify C:\Temp Folder is exists or not. Create Temp folder is does not exist.

Instructions for Execution

• After registering DLL, open HTML Report_Usage script in QTP and click RUN.

Analyzing Results:

• Once execution is completed, you can view QTP results as usual and look at the HTML reports in C:\Temp folder.

fyi,
http://www.allianceglobalservices.com/white-paper/test-utilities-generating-HTML-Reports-for-HP-Quick%20-test-Pro.html
997°/9966 人阅读/1 条评论 发表评论

小窝  2011-09-23

已同步至官方微博


登录 后发表评论