Sunday, May 23, 2021

Creating Extent Report in UFT

This tutorial explains how to create extent report in UFT application. With the help of Extent report we can beautifully crafted reports and realtime analytics so you can look at your tests in a totally different way. ExtentReports is an open-source reporting library useful for test automation. It can be easily integrated with major testing frameworks like JUnit, NUnit, TestNG, etc. These reports are HTML documents that depict results as pie charts. They also allow the generation of custom logs, snapshots, and other customized details. Once an automated test script runs successfully, testers need to generate a test execution report.

Creating Extent Report in UFT


Here we are going to see Extent report integration steps in UFT application. As of now this report is not available for UFT because its only developed for .Net and Java based projects.


How this will work?

We will create a COM visible.net class and this class will expose the functionalities of extent reports to UFT. All of the DLL’s are available below for download :-

Download Version 1

Download Version 2


Register the COM Libraries

To register the COM Libraries use the following command.

Regasm.exe is available under the below folder and Pick a folder with name v4.x.

Folder Location:-
C:\Windows\Microsoft.NET\Framework\V4.x.xxxx\Regasm.exe

C:\Windows\Microsoft.NET\Framework\V4.x.xxxx\Regasm.exe ExtentReports_UFT.DLL /codebase


Generate the Extent reports in UFT

use below function in your UFT application to generate extent report.

Call all the methods and generate reports in UFT
Set htmlReporter = CreateObject("UFT_Extent_Reports.HTMLReporter")
    htmlReporter.InitializeReport("C:\temp\Extent.html")
    htmlReporter.AddReportName("TEST AUTOMATION REPORT")
    htmlReporter.AddDocumentTitle("Business Acceptance Report")
  
    '''Create a new test
    htmlReporter.CreateTest("FirstTest")
    call htmlReporter.AssignAuthorToTest("Skptricks")
    call htmlReporter.AssignCategoryToTest("Regression")
  
    ''' Add Logs to the test
    call htmlReporter.AddInfoLog("Test Started")
    call htmlReporter.AddErrorLog("Test Error")
       call htmlReporter.AddFailLog("Test Failed", "C:\temp\image1.png")
       call htmlReporter.AddFailLog("Test Failed - With Long error", "C:\temp\image2.png")
  
    ''''Create another test
    htmlReporter.CreateTest("Second Test")
    call htmlReporter.AssignAuthorToTest("Skptricks")
    call htmlReporter.AssignCategoryToTest("Functional")
  
    ''' Add Logs to the test
    call htmlReporter.AddInfoLog("Test Step1")
    call htmlReporter.AddInfoLog("Test Step 2")
    call htmlReporter.AddPassLog("Test Step Passed","C:\temp\image3.png")
    call htmlReporter.AddFatalLog("Test Step Passed","C:\temp\image4.png")
  
    '''Change Theme to dark
    htmlReporter.ChangeToDarkTheme
  
    ''Generate the html reports
    htmlReporter.GenerateReport()


Sample Report:

Tests view 

Creating Extent Report in UFT

Tags view

Creating Extent Report in UFT

Dashboard view

Creating Extent Report in UFT

This is able about integrating extent report in UFT application with the help of COM libraries. Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section.


No comments:

Post a Comment