
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)
Step 2- To run script simply right click and select TestNG Test.
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.
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.
After refreshing, you will get below folder ready 🙂
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
Second open emailable-report.html
Third, open Index.html
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
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
Hi Priya, please use pdfbox lib to create report and add screenshot as well.
hii Mukesh
i just want to know about how to perfotm key actions and mouse action..
can you plz help me with this?
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
Thanks able to implement it smoothly without any errors
Great…!!!
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.
In this case,You can continue with default testng report.
Hai Mukesh , How are you & could you send me the most important selenium interview questions and it’solution.
Here you go
http://learn-automation.com/selenium-interview-questions-and-answers/
https://vigoreport.io/
This is awesome tool gor online reporting, from anywhere.
Seems Nice let me try this.
hello mukesh!!
how to read excel (.xls and .xslx) and supply data using data provider?
HI Noori,
I have done the same thing in below post http://learn-automation.com/data-driven-framework-in-selenium-webdriver/
Hi I am unable to genarete extent report could you please help me.
What is the issue? Kindly share the logs/exception.
hi Mukesh,
why my test-output folder doesnt updated.
And emailable-report.html always not updated… help
Hi Shalsa,
In eclipse it does not updated automatically but if you see the local drive then you will find updated reports.
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
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/
Great tutorial and its helping me to learn easily.!!
Good to hear Nitesh. Check advance report too http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/
Very Helpful and so much Interesting .
Thanks Mukesh
Hey Sid,
Glad to know that you find this usefull.
Hi Mukesh,
could you please help me how to configure xslt files in testng
This post has clearly explained the same. Please try extent report as well.
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.
Hi Ahmed,
Sorry dear I have never integrated Selenium with ALM so really not sure on this.
Good doc for begineers
Hi Swamy Thank you 🙂
Really very nice its clearing all my doughts what ever i have… Thanks Mukesh.
Hi Sowjanya,
Thank you.
Please check other articles too and let me know if any help needed from my side 🙂
Excellent
Thanks Karthikeyan
Good work.. Its very useful to beginners for automation
Thank you Senthi, keep visiting and please check other articles too 🙂
keep up your great work…
thanx Deepa keep visiting 🙂