Step by Step process to Send report through email in Selenium Webdriver
- Download java mail jar file which contains the library to send the email.
- Add jar into your project and if you are working with maven project then you can use dependency.
- Be ready with the file which you want to send. In our case, it will be Selenium Report.
- Write program, which will send the email to the team or a specific person.
Complete program to Send report through email in Selenium Webdriver
Above program will send the report to the respective recipient with the attachment.
You can also send the email via Jenkins which is quite easy but you are not using Jenkins then you can use above program.
Important points
1- You can create a custom library which should accept recipients as arguments so that we can reuse this as much we can.
2- Write the logic to get the path of the report, so that we can set the same in our methods.
3- Always call this code after test execution. You can use @AfterSuite of TestNG which run only when complete suite execute.
Conclusion
1- Sending reports after every execution is very important but if you are running multiple tests in one day better to send combined reports at once.
2-Try to keep all screenshot in a common location where everyone will have access so when they click on report and screenshot then it should be accessible.
I hope you liked above article on Send report through email in Selenium Webdriver.
Please try from your side as well and let me know if any thoughts on this.
Sharing knowledge can seem like a burden to some
but on the contrary,
it is a reflection of teamwork and leadership.
So kindly share with your friends and team member.
Thanks for sharing this post. It will help me to learn how i can send Send report through email in Selenium Webdriver
ReplyDeleteThis was really an interesting topic and I kinda agree with what you have mentioned here!
ReplyDeletecheap web hosting in lahore
I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.
ReplyDeleteDigital Marketing Agency in Pakistan