• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Programming Languages
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
  • Automation Tools and Different Tools
    • Web Automation
      • Selenium with Java
        • Selenium Basic
        • Selenium Advance
        • Selenium Realtime
        • Framework
        • Selenium Interview
        • Selenium Videos
        • Selenium with Docker
      • Selenium with Python
      • WebdriverIO
        • Selenium Webdriver C# Tutorial
      • Cypress
      • Playwright
    • TestNG
    • Cucumber
    • Mobile Automation
      • Appium
    • API Testing
      • Postman
      • Rest Assured
      • SOAPUI
    • testRigor
    • Katalon
    • TestProject
    • Serenity BDD
    • Gradle- Build Tool
    • RPA-UiPath
    • Protractor
    • Windows Automation
  • Automation For Manual Testers
  • Services
  • Online Training
  • Contact us
  • About me
  • Follow us
    • Linkedin
    • Facebook Group
    • Facebook Page
    • Instagram

Automation

Selenium WebDriver tutorial Step by Step

You are here: Home / TestNG Tutorial / How to Generate Report in Selenium Webdriver using TestNG

How to Generate Report in Selenium Webdriver using TestNG

March 21, 2015 by Mukesh Otwani 38 Comments

Advance Selenium Reporting part 2

Welcome to Selenium tutorial, Today we will discuss how to generate report in selenium webdriver.

Automation without reporting of no use. Reporting plays very important role in Automation as well in Manual testing as well. Report help us to identify ROI and to prepare POC as well.

 

We can generate Advance reports as well like XSLT report which provide very good reporting.

I would highly recommend using Extent report which is a really very impressive report which is the advance version of XSLT report.

 

 

I have created a detailed video on TestNG which will help you to get started 

Generate Report in Selenium Webdriver

 Q1-Importance of Reporting in Selenium?

Ans-1- Reports helps you to identify the status of the test case (Pass/Fail/Skip).

2- Using reports we calculate time taken by  each test case that helps to calculate ROI(Return on Investment).

3- You can share automation reports with your team and clients as well to share the status of testing progress etc.

 

Q2- Does selenium support report generation?

Ans- No Selenium will only help you to automate your web application. If you want to generate reports then we can use Third party tools that we can integrate and can generate reports.

Here TestNG comes into the picture.

 

Q3- Do we need to write some script or any additional code for reports?
Ans- No we do not have to write any additional code for report generation. We need to refresh our project and we will get 1 additional folder (default suite) inside that folder we will get all the reports.

One good feature about TestNG for every test case it creates 3 different type of reports.

 

Generate Report in selenium webdriver

Step 1- Create a Simple java class and write some test cases (in my case I have written 3 test case)

 

generate report in selenium webdriver

 

Step 2- To run script simply right click and select TestNG Test.

 

generate report in selenium webdriver

 

Step 3- Now test case will start execution and you will get console notification about the status and wait until the program is getting finished.

Report type 1- Console output.

generate report in selenium webdriver

Since console output is not useful because you can’t share and send to others so we required some HTML reports as well

TestNG guys already gave a solution for this so for even single test case you will get HTML reports as well.

 

Report type 2- HTML report

We have to refresh your project and reports folder will come automatically.

 

Generate Reports Selenium using TestNG

 

 

After refreshing, you will get below folder ready 🙂

 

Generate Reports Selenium using TestNG

Let’s open each report and check the content

Note- Open Each report in Web Browser select each report then right click and open in browser

 

 

Generate report in selenium webdriver

First open Default test.html

generate report in selenium webdriver

Second open emailable-report.html

generate report in selenium webdriver

 

Third, open Index.html

generate report in selenium webdriver

 

 

If you really think this article will help others too then please share this with others too.

For More updates Learn Automation page

For any query join Selenium group- Selenium Group

Filed Under: TestNG Tutorial Tagged With: generate report in selenium webdriver, Selenium Reports

Reader Interactions

Comments

  1. Priya says

    February 25, 2021 at 12:11 PM

    Hi Mukesh,

    I want to create test report in PDF along with screenshots of each test case pass/fail.
    I have the code to generate pdf report but not able to add the screenshot. How can I do this

    Reply
    • Mukesh Otwani says

      February 25, 2021 at 4:25 PM

      Hi Priya, please use pdfbox lib to create report and add screenshot as well.

      Reply
  2. Anagha Girwalkar says

    March 28, 2019 at 10:24 PM

    hii Mukesh
    i just want to know about how to perfotm key actions and mouse action..
    can you plz help me with this?

    Reply
    • Mukesh Otwani says

      March 29, 2019 at 5:47 AM

      Hi Anagha,

      Please refer these links
      1. http://learn-automation.com/selenium-advance-activity/
      2. Official Document : https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/interactions/Actions.html

      Reply
  3. Gaurav Khurana says

    January 14, 2017 at 2:00 PM

    Thanks able to implement it smoothly without any errors

    Reply
    • Mukesh Otwani says

      January 14, 2017 at 6:49 PM

      Great…!!!

      Reply
  4. Ashok kumar G says

    November 3, 2016 at 4:34 PM

    How to create a report for Selenium Parallel Test execution.
    I have two test in testng.xml file. Each test calls 50methods(@Test).
    One test runs in chrome browser and another one runs in firefox browser.

    Which one is the best report generation tool and how can i achieve it.

    Reply
    • Mukesh Otwani says

      November 4, 2016 at 1:46 AM

      In this case,You can continue with default testng report.

      Reply
  5. Arun says

    October 19, 2016 at 4:58 PM

    Hai Mukesh , How are you & could you send me the most important selenium interview questions and it’solution.

    Reply
    • Mukesh Otwani says

      October 20, 2016 at 1:59 PM

      Here you go
      http://learn-automation.com/selenium-interview-questions-and-answers/

      Reply
  6. ND says

    October 19, 2016 at 2:03 PM

    https://vigoreport.io/

    This is awesome tool gor online reporting, from anywhere.

    Reply
    • Mukesh Otwani says

      October 20, 2016 at 2:03 PM

      Seems Nice let me try this.

      Reply
  7. Noori Banu says

    October 13, 2016 at 10:50 PM

    hello mukesh!!
    how to read excel (.xls and .xslx) and supply data using data provider?

    Reply
    • Mukesh Otwani says

      October 13, 2016 at 11:42 PM

      HI Noori,

      I have done the same thing in below post http://learn-automation.com/data-driven-framework-in-selenium-webdriver/

      Reply
  8. Shehshukumar says

    September 20, 2016 at 11:55 AM

    Hi I am unable to genarete extent report could you please help me.

    Reply
    • Mukesh Otwani says

      September 29, 2016 at 2:22 PM

      What is the issue? Kindly share the logs/exception.

      Reply
  9. shalsa says

    September 20, 2016 at 8:35 AM

    hi Mukesh,
    why my test-output folder doesnt updated.
    And emailable-report.html always not updated… help

    Reply
    • Mukesh Otwani says

      September 29, 2016 at 2:24 PM

      Hi Shalsa,

      In eclipse it does not updated automatically but if you see the local drive then you will find updated reports.

      Reply
  10. Sambeet says

    September 4, 2016 at 10:23 PM

    Hi,

    Can you tell me how to take backup of the all the report files into a new folder each time I run a suite ?
    Files are –
    index.html
    emailable-report.html
    Default test.html

    Reply
    • Mukesh Otwani says

      September 7, 2016 at 11:57 PM

      Hi Sambeet,

      You can use below post to zip the data after test execution https://www.mkyong.com/java/how-to-compress-files-in-zip-format/

      Reply
  11. Nitesh Jaiswal says

    August 15, 2016 at 4:44 PM

    Great tutorial and its helping me to learn easily.!!

    Reply
    • Mukesh Otwani says

      August 18, 2016 at 9:47 AM

      Good to hear Nitesh. Check advance report too http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/

      Reply
  12. siddhant raut says

    July 12, 2016 at 8:36 PM

    Very Helpful and so much Interesting .

    Thanks Mukesh

    Reply
    • Mukesh Otwani says

      July 14, 2016 at 11:13 AM

      Hey Sid,

      Glad to know that you find this usefull.

      Reply
  13. Mallikarjun says

    May 16, 2016 at 6:40 PM

    Hi Mukesh,

    could you please help me how to configure xslt files in testng

    Reply
    • Mukesh Otwani says

      May 17, 2016 at 12:13 PM

      This post has clearly explained the same. Please try extent report as well.

      Reply
  14. Ahmed says

    April 8, 2016 at 4:02 PM

    Thanks Mukesh for such a great help. Mukhesh could you please help me out in one issue. I have successfully integrated Selenium HP ALM. I am able to do every thing now with ALM. But if I am attaching any file in ALM it is appearing as 0KB file. If you can give some of your precious time kindly contact or reply back.

    Reply
    • Mukesh Otwani says

      April 10, 2016 at 11:38 AM

      Hi Ahmed,

      Sorry dear I have never integrated Selenium with ALM so really not sure on this.

      Reply
  15. Swamy says

    February 18, 2016 at 8:07 PM

    Good doc for begineers

    Reply
    • Mukesh Otwani says

      February 22, 2016 at 9:07 AM

      Hi Swamy Thank you 🙂

      Reply
  16. Sowjanya Viswanath says

    February 15, 2016 at 10:56 AM

    Really very nice its clearing all my doughts what ever i have… Thanks Mukesh.

    Reply
    • Mukesh Otwani says

      February 22, 2016 at 5:21 PM

      Hi Sowjanya,

      Thank you.
      Please check other articles too and let me know if any help needed from my side 🙂

      Reply
  17. Karthikeyan says

    January 20, 2016 at 12:01 AM

    Excellent

    Reply
    • Mukesh Otwani says

      January 20, 2016 at 12:51 AM

      Thanks Karthikeyan

      Reply
  18. Senthilkumar says

    January 9, 2016 at 7:06 AM

    Good work.. Its very useful to beginners for automation

    Reply
    • Mukesh Otwani says

      January 9, 2016 at 5:15 PM

      Thank you Senthi, keep visiting and please check other articles too 🙂

      Reply
  19. Deepa says

    December 13, 2015 at 11:51 AM

    keep up your great work…

    Reply
    • Mukesh Otwani says

      December 13, 2015 at 1:40 PM

      thanx Deepa keep visiting 🙂

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Free Selenium Videos

https://www.youtube.com/watch?v=w_iPCT1ETO4

Search topic

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?

Stay connected via Facebook

Stay connected via Facebook

Archives

Footer

Categories

Recent Post

  • API Testing Using Postman And RestAssured
  • Disable Personalise Your Web Experience Microsoft Edge Prompt In Selenium
  • How To Fix Error: No tests found In Playwright
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Best and easy way to Group test cases in selenium

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?