SlideShare a Scribd company logo
Migration to Extent Report 4
Migration to Extent Report 4
Pre-requisites to Generate Extent Reports
1. Java should be installed and set up.
2. TestNG maven dependency should be available.
3. Extent Report Maven dependency should be available.
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.1.3</version>
</dependency>
Below is the code snippet before starting the suite,
public static ExtentSparkReporter sparkReporter;
public static ExtentReports extentReport;
String reportPath = System.getProperty("user.dir") + "/AutomationReport/";
sparkReporter = new ExtentSparkReporter(reportPath);
sparkReporter.config().setDocumentTitle("Appium Automation");
sparkReporter.config().setReportName("Automation Execution Report");
sparkReporter.config().setTheme(com.aventstack.extentreports.reporter.configuration.Theme.DARK);
extentReport = new ExtentReports();
extentReport.attachReporter(sparkReporter);
extentReport.setSystemInfo("Application Name", "ExtentReport");
extentReport.setSystemInfo("Platform", System.getProperty("os.name"));
extentReport.setSystemInfo("Environment", "QA");
Below is the code snippet to collect the test method name, prior to each test execution. This logic can be added
before method section,
String className = this.getClass().getSimpleName();
extentTest = extentReport.createTest(className + "-" + method.getName()); //method object of
Method class should be passed to get the method name.
Below is the code snippet to collect the test results after each test execution. Map those results into the HTML
report. You can use the below logic after method section,
public static ExtentTest extentTest;
String methodName = result.getName();
extentTest.createNode(methodName);
if (result.getStatus() == ITestResult.FAILURE) {
extentTest.log(Status.FAIL, MarkupHelper.createLabel(methodName + " - Test Case Failed",
© RapidValue Solutions 2
Migration to Extent Report 4
ExtentColor.RED));
extentTest.log(Status.FAIL,
MarkupHelper.createLabel(result.getThrowable() + " - Test Case Failed", ExtentColor.RED));
// Here you can add screenshot in the report for fail case
extentTest.fail(methodName + "Test Step Failed");
}
if (result.getStatus() == ITestResult.SKIP) {
extentTest.log(Status.SKIP,
MarkupHelper.createLabel(result.getName() + " - Test Case Skipped", ExtentColor.ORANGE));
extentTest.skip(methodName + "Test Step Skipped");
}
if (result.getStatus() == ITestResult.SUCCESS) {
extentTest.log(Status.PASS,
MarkupHelper.createLabel(result.getName() + " Test Case PASSED", ExtentColor.GREEN));
extentTest.pass(methodName + "Test Step Passed");
}
The below final code snippet helps to flush the object of the ExtentReports class and also rename the generated
file name with time-stamp. By default, the library will generate index.html file. After suite, you can rename the
HTML report along with flushing the object of the ExtentReports class.
extentReport.flush();
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy_HH-mm-ss");
Date date = new Date();
String filePathdate = dateFormat.format(date).toString();
String actualReportPath = reportPath + "index.html";
new File(actualReportPath).renameTo(new File(
System.getProperty("user.dir") + "/AutomationReport/" + "Automation_" + filePathdate + ".html"));
Below are the sample screenshots of the generated HTML report.
© RapidValue Solutions 3
Migration to Extent Report 4
Conclusion
Migration of Extent Report version 4 will definitely be helpful as you obtain more detailed and customized
information on test automation executions. Try to migrate your Extent Report 3 versions to 4 series and feel the
difference.
By,
Sanoj S, Test Architect
© RapidValue Solutions 4
Migration to Extent Report 4
About RapidValue
RapidValue is a global leader in digital product engineering solutions including mobility, omni-channel, IoT, AI,
RPA and cloud to enterprises worldwide. RapidValue offers its digital services to the world’s top brands, Fortune
1000 companies and innovative emerging start-ups. With offices in the United States, the United Kingdom,
Germany and India and operations spread across the Middle-East, Europe and Canada, RapidValue delivers
enterprise services and solutions across various industry verticals.
www.rapidvaluesolutions.com/blogwww.rapidvaluesolutions.com
+1 877.643.1850 contactus@rapidvaluesolutions.com
© RapidValue Solutions 5

More Related Content

PPT
Wicket Security Presentation
PPTX
Change tracking
PDF
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
PDF
Servlet Filter
PDF
SPARQLing cocktails
PDF
Hash Endereçamento Quadrático Main
PPTX
Servlet Filters
PPT
R12 d49656 gc10-apps dba 22
Wicket Security Presentation
Change tracking
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Servlet Filter
SPARQLing cocktails
Hash Endereçamento Quadrático Main
Servlet Filters
R12 d49656 gc10-apps dba 22

What's hot (20)

PDF
Hackathon
PPT
R12 d49656 gc10-apps dba 19
PPTX
PPTX
Servlets - filter, listeners, wrapper, internationalization
PPTX
Reactive programming with RxAndroid
PPT
R12 d49656 gc10-apps dba 25
PDF
MegaScriptSample - Released x-x-15
PPTX
MS SQL SERVER: Programming sql server data mining
PPT
R12 d49656 gc10-apps dba 20
PPTX
Procedures and triggers in SQL
PPT
Intro to tsql unit 15
PPTX
Reactive Programming on Android
PDF
Web application to keep track of time spent on projects
PPTX
Reactive Programming no Android
DOCX
SSMS-waitstats
PPT
Asegúr@IT IV - Remote File Downloading
PPT
Intro to tsql unit 6
PPT
Intro to tsql
PPSX
Automation Framework 042009 V2
Hackathon
R12 d49656 gc10-apps dba 19
Servlets - filter, listeners, wrapper, internationalization
Reactive programming with RxAndroid
R12 d49656 gc10-apps dba 25
MegaScriptSample - Released x-x-15
MS SQL SERVER: Programming sql server data mining
R12 d49656 gc10-apps dba 20
Procedures and triggers in SQL
Intro to tsql unit 15
Reactive Programming on Android
Web application to keep track of time spent on projects
Reactive Programming no Android
SSMS-waitstats
Asegúr@IT IV - Remote File Downloading
Intro to tsql unit 6
Intro to tsql
Automation Framework 042009 V2
Ad

Similar to Migration to Extent Report 4 (20)

PDF
Guide to Generate Extent Report in Kotlin
PDF
Appium Automation with Kotlin
PPTX
Overview of RESTful web services
PDF
How to connect redis and mule esb using spring data redis module
PDF
I really need help on this question.Create a program that allows t.pdf
PPTX
Speed up your developments with Symfony2
PPT
Android - Anatomy of android elements & layouts
PPT
比XML更好用的Java Annotation
PDF
Monitoring with Prometheus
PPTX
Тарас Олексин - Sculpt! Your! Tests!
PPT
Asp.net tips
PDF
Instrumenting plugins for Performance Schema
PPT
Android tutorial (2)
PPTX
Developing your first application using FIWARE
KEY
Integrating Wicket with Java EE 6
PPTX
Annotation processing
PPT
First Failure Data Capture for your enterprise application with WebSphere App...
PPTX
Metadata Extraction and Content Transformation
PPTX
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
PPTX
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Guide to Generate Extent Report in Kotlin
Appium Automation with Kotlin
Overview of RESTful web services
How to connect redis and mule esb using spring data redis module
I really need help on this question.Create a program that allows t.pdf
Speed up your developments with Symfony2
Android - Anatomy of android elements & layouts
比XML更好用的Java Annotation
Monitoring with Prometheus
Тарас Олексин - Sculpt! Your! Tests!
Asp.net tips
Instrumenting plugins for Performance Schema
Android tutorial (2)
Developing your first application using FIWARE
Integrating Wicket with Java EE 6
Annotation processing
First Failure Data Capture for your enterprise application with WebSphere App...
Metadata Extraction and Content Transformation
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Ad

More from RapidValue (20)

PDF
How to Build a Micro-Application using Single-Spa
PDF
Play with Jenkins Pipeline
PDF
Accessibility Testing using Axe
PDF
Automation in Digital Cloud Labs
PDF
Microservices Architecture - Top Trends & Key Business Benefits
PDF
Uploading Data Using Oracle Web ADI
PDF
Build UI of the Future with React 360
PDF
Python Google Cloud Function with CORS
PDF
Real-time Automation Result in Slack Channel
PDF
Automation Testing with KATALON Cucumber BDD
PDF
How to Implement Micro Frontend Architecture using Angular Framework
PDF
Video Recording of Selenium Automation Flows
PDF
JMeter JMX Script Creation via BlazeMeter
PDF
The Definitive Guide to Implementing Shift Left Testing in QA
PDF
Data Seeding via Parameterized API Requests
PDF
Test Case Creation in Katalon Studio
PDF
How to Perform Memory Leak Test Using Valgrind
PDF
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
PDF
A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...
PDF
MS Azure: Soaring High in the Cloud - An Infographic by RapidValue
How to Build a Micro-Application using Single-Spa
Play with Jenkins Pipeline
Accessibility Testing using Axe
Automation in Digital Cloud Labs
Microservices Architecture - Top Trends & Key Business Benefits
Uploading Data Using Oracle Web ADI
Build UI of the Future with React 360
Python Google Cloud Function with CORS
Real-time Automation Result in Slack Channel
Automation Testing with KATALON Cucumber BDD
How to Implement Micro Frontend Architecture using Angular Framework
Video Recording of Selenium Automation Flows
JMeter JMX Script Creation via BlazeMeter
The Definitive Guide to Implementing Shift Left Testing in QA
Data Seeding via Parameterized API Requests
Test Case Creation in Katalon Studio
How to Perform Memory Leak Test Using Valgrind
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
A Technology Backgrounder to Serverless Architecture - A Whitepaper by RapidV...
MS Azure: Soaring High in the Cloud - An Infographic by RapidValue

Recently uploaded (20)

PDF
Digital Strategies for Manufacturing Companies
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
System and Network Administration Chapter 2
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
history of c programming in notes for students .pptx
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Materi_Pemrograman_Komputer-Looping.pptx
PDF
System and Network Administraation Chapter 3
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
ai tools demonstartion for schools and inter college
Digital Strategies for Manufacturing Companies
Which alternative to Crystal Reports is best for small or large businesses.pdf
System and Network Administration Chapter 2
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
How Creative Agencies Leverage Project Management Software.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
2025 Textile ERP Trends: SAP, Odoo & Oracle
Odoo POS Development Services by CandidRoot Solutions
history of c programming in notes for students .pptx
Understanding Forklifts - TECH EHS Solution
ManageIQ - Sprint 268 Review - Slide Deck
Upgrade and Innovation Strategies for SAP ERP Customers
Materi_Pemrograman_Komputer-Looping.pptx
System and Network Administraation Chapter 3
ISO 45001 Occupational Health and Safety Management System
How to Migrate SBCGlobal Email to Yahoo Easily
ai tools demonstartion for schools and inter college

Migration to Extent Report 4

  • 2. Migration to Extent Report 4 Pre-requisites to Generate Extent Reports 1. Java should be installed and set up. 2. TestNG maven dependency should be available. 3. Extent Report Maven dependency should be available. <dependency> <groupId>com.aventstack</groupId> <artifactId>extentreports</artifactId> <version>4.1.3</version> </dependency> Below is the code snippet before starting the suite, public static ExtentSparkReporter sparkReporter; public static ExtentReports extentReport; String reportPath = System.getProperty("user.dir") + "/AutomationReport/"; sparkReporter = new ExtentSparkReporter(reportPath); sparkReporter.config().setDocumentTitle("Appium Automation"); sparkReporter.config().setReportName("Automation Execution Report"); sparkReporter.config().setTheme(com.aventstack.extentreports.reporter.configuration.Theme.DARK); extentReport = new ExtentReports(); extentReport.attachReporter(sparkReporter); extentReport.setSystemInfo("Application Name", "ExtentReport"); extentReport.setSystemInfo("Platform", System.getProperty("os.name")); extentReport.setSystemInfo("Environment", "QA"); Below is the code snippet to collect the test method name, prior to each test execution. This logic can be added before method section, String className = this.getClass().getSimpleName(); extentTest = extentReport.createTest(className + "-" + method.getName()); //method object of Method class should be passed to get the method name. Below is the code snippet to collect the test results after each test execution. Map those results into the HTML report. You can use the below logic after method section, public static ExtentTest extentTest; String methodName = result.getName(); extentTest.createNode(methodName); if (result.getStatus() == ITestResult.FAILURE) { extentTest.log(Status.FAIL, MarkupHelper.createLabel(methodName + " - Test Case Failed", © RapidValue Solutions 2
  • 3. Migration to Extent Report 4 ExtentColor.RED)); extentTest.log(Status.FAIL, MarkupHelper.createLabel(result.getThrowable() + " - Test Case Failed", ExtentColor.RED)); // Here you can add screenshot in the report for fail case extentTest.fail(methodName + "Test Step Failed"); } if (result.getStatus() == ITestResult.SKIP) { extentTest.log(Status.SKIP, MarkupHelper.createLabel(result.getName() + " - Test Case Skipped", ExtentColor.ORANGE)); extentTest.skip(methodName + "Test Step Skipped"); } if (result.getStatus() == ITestResult.SUCCESS) { extentTest.log(Status.PASS, MarkupHelper.createLabel(result.getName() + " Test Case PASSED", ExtentColor.GREEN)); extentTest.pass(methodName + "Test Step Passed"); } The below final code snippet helps to flush the object of the ExtentReports class and also rename the generated file name with time-stamp. By default, the library will generate index.html file. After suite, you can rename the HTML report along with flushing the object of the ExtentReports class. extentReport.flush(); DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy_HH-mm-ss"); Date date = new Date(); String filePathdate = dateFormat.format(date).toString(); String actualReportPath = reportPath + "index.html"; new File(actualReportPath).renameTo(new File( System.getProperty("user.dir") + "/AutomationReport/" + "Automation_" + filePathdate + ".html")); Below are the sample screenshots of the generated HTML report. © RapidValue Solutions 3
  • 4. Migration to Extent Report 4 Conclusion Migration of Extent Report version 4 will definitely be helpful as you obtain more detailed and customized information on test automation executions. Try to migrate your Extent Report 3 versions to 4 series and feel the difference. By, Sanoj S, Test Architect © RapidValue Solutions 4
  • 5. Migration to Extent Report 4 About RapidValue RapidValue is a global leader in digital product engineering solutions including mobility, omni-channel, IoT, AI, RPA and cloud to enterprises worldwide. RapidValue offers its digital services to the world’s top brands, Fortune 1000 companies and innovative emerging start-ups. With offices in the United States, the United Kingdom, Germany and India and operations spread across the Middle-East, Europe and Canada, RapidValue delivers enterprise services and solutions across various industry verticals. www.rapidvaluesolutions.com/blogwww.rapidvaluesolutions.com +1 877.643.1850 contactus@rapidvaluesolutions.com © RapidValue Solutions 5