In the previous post we have seen sending an e-mail notification when the build/tests failed. That email notification doesn’t provide us with details of Passed/Failed tests.
To get full details about the execution results, we have to use Email Extension Plugin in Jenkins.We can email the results reports that are generated in Jenkins. With which you can directly check how many tests Passed? How many failed?
I have taken three simple testng tests as shown in the below screen shot. Two of them will Pass and the other one fails.
When executed the above tests using TestN a result report "emailable-report.html" is generated under test-output folder in project home directory as show below.
Now we have to email this report from Jenkins to all the team members after test execution. Let’s get with no further due…
To get full details about the execution results, we have to use Email Extension Plugin in Jenkins.We can email the results reports that are generated in Jenkins. With which you can directly check how many tests Passed? How many failed?
I have taken three simple testng tests as shown in the below screen shot. Two of them will Pass and the other one fails.
When executed the above tests using TestN a result report "emailable-report.html" is generated under test-output folder in project home directory as show below.
Now we have to email this report from Jenkins to all the team members after test execution. Let’s get with no further due…
If you have any queries on creating testng tests and batch file please refer my previous post How to execute Selenium Test Cases from Command Prompt in TestNG?
Step 1: Installing Email
Extension Plugin. Launch Jenkins-> click Manage Jenkins-> click on
Install Plugins.
Step 2: In the Plugins Manager, Under Available tab-> Search for Email Extension-> Select Email Extension Plugin and click on Install without restart.
Wait for plugin to get installed for few minutes. After Installation the plugin should be available under Installed tab.
Step 3: Once the plugin installed. You need configure email in two sections Extended E-mail Notification and E-mail Notification.
Go to Mange Jenkins-> Configure System. Please enter your details as shown in the below screen shots. In the both places you need to enter same email id and password.
And from this account the emails will be sent. In my case from "seleniumbabuqa@gmail.com" the emails will be sent.
Step 4: Now create Job to run the tests. Manage Jenkins-> New Item-> Enter Project title emailReportsDemo-> Click OK.
Step 5: Configure the tests that needs be executed. Enter project home directory in Use custom workspace and batch file name in the Build section as shown below.
Step 6: Go to Post Build Actions and select Editable Email Notification. This option only available if Email Extension Plugin installed.
Step 7: Under Editable Email Notification section enter Recipients emails, select Content type and Click on Apply.
Step 8: Click on the Advenced Settings... button. And select Always option from Add Trigger drop down list. Which means Jenkins will trigger email every time the tests executed.
Step 9: To attach the content of the report "emailable-report.html" in the email body add the below code in "Pre-send Script" field. The below code gets the path of the report and it's content.
Check whether emails are received or not with reports in the email body.
That's it guys, we did it. Hope this post is helpful to you, please share it with your friends. Thanks!!
#HappyLearning #HappyTesting
Wait for plugin to get installed for few minutes. After Installation the plugin should be available under Installed tab.
Step 3: Once the plugin installed. You need configure email in two sections Extended E-mail Notification and E-mail Notification.
Go to Mange Jenkins-> Configure System. Please enter your details as shown in the below screen shots. In the both places you need to enter same email id and password.
And from this account the emails will be sent. In my case from "seleniumbabuqa@gmail.com" the emails will be sent.
Step 5: Configure the tests that needs be executed. Enter project home directory in Use custom workspace and batch file name in the Build section as shown below.
Step 6: Go to Post Build Actions and select Editable Email Notification. This option only available if Email Extension Plugin installed.
Step 7: Under Editable Email Notification section enter Recipients emails, select Content type and Click on Apply.
Step 8: Click on the Advenced Settings... button. And select Always option from Add Trigger drop down list. Which means Jenkins will trigger email every time the tests executed.
Step 9: To attach the content of the report "emailable-report.html" in the email body add the below code in "Pre-send Script" field. The below code gets the path of the report and it's content.
def reportPath = build.getWorkspace().child("test-output/emailable-report.html")
msg.setContent(reportPath.readToString(), "text/html");
Step 10: Click Apply and Save. We are don with configuration of Email and Tests in Jenkins. Now click on Build Now in the job created.
Check whether emails are received or not with reports in the email body.
That's it guys, we did it. Hope this post is helpful to you, please share it with your friends. Thanks!!
#HappyLearning #HappyTesting
Brother i need configuration of selenium webdriver with python and jenkins.
ReplyDeletemeans after my selenium script run email should be sent to my email address can you write a blog on this
What you want to send in email? Did you try configuring email? facing issues?
DeleteHi, thank you for this explanation. I have an issue however with the emailable-report.html that is being sent. It is the previous test run result. I cannot figure out right now why this is happening. Any ideas you can offer?
ReplyDeleteUpdate: ok so I changed my report path to be: target/surefire-reports/emailable-report.html but I'm not sure if that was the issue because I believe I had tried that path before. Its working now however. Perhaps the problem was due to having the testNG.xml report open while executing tests? not sure but its working ;)
DeleteHi,
ReplyDeleteFor me build.getWorkspace().child("test-output/emailable-report.html") path is pointing to C:\Program Files (x86)\Jenkins\workspace\project folder.
But inside floder doesn't have any files/folders.
Can you please help on this
This comment has been removed by the author.
DeleteI had the same problem
DeleteYou should set your custom workspace
Go to configuration of your job
Build section
Click on the "Advanced" button
Set "Use custom workspace" ckrckbox
Set path to your project folder
see screenshot
https://www.screencast.com/t/7KLLz741YJL
This comment has been removed by the author.
ReplyDeleteHi Venkat, I tried with outlook, but no success. Do I need to change the configuration for outlook different than gmail?
ReplyDeleteYes you have to. Sorry for the late reply.
DeleteHi i have done the same configuration,it is running in the jenkins but chrome browser will not opened it will be running in background or headless like browser
DeleteHi.. I am using editable email plugin and I have custom HTML report to send. But the issue I am facing is that the html content lack the styling when I email it. Not sure how to resolve the issue.
ReplyDeleteThird party processors are used and various technologies applied to identify dead or closed email accounts without sending any mails to them.email verification
ReplyDeleteIf you are not working on building your email list already, then stick with this article till the end because I'm going to share 16 ways to grow your email list.
ReplyDeleteemail fraud Huntington Beach
Hey, this day is too much good for me, since this time I am reading this enormous informative article here at my home. Thanks a lot for massive hard work. ethereum notifications
ReplyDeleteIf you think email verification is a one trick game, then you could not have been further from the truth.email cleaning
ReplyDeleteThis is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. www.hotmail.com
ReplyDeleteYour article contents are easy to read and understand the topic which i searched before.We expect your valuable blog posting in the future.
ReplyDeleteSelenium Training in Adyar
Selenium Training in OMR
Software Testing Training in Tambaram
Software Testing Training in Anna nagar
Software Testing Training in OMR
Selenium Training in Porur
Selenium Training in Chennai
Selenium Course in Chennai
Thanks a lot for massive hard work , very nice article. hotmail.com
ReplyDeletewhat if i have more than one HTML, in that case how i am supposed to configure 2 customized HTML report file?
ReplyDeleteSo, people may notice you from videos. You can also add offers and email sign-up cards & annotations on your videos. While watching your videos people notice this annotations and cards. Email List for Marketing
ReplyDeleteThanks for sharing nice information with us. i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. ActveCampaign Support
ReplyDeleteI really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people.
ReplyDeleteemail search
very interesting keep posting. find social media links
ReplyDeleteA very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. como abrir correo hotmail
ReplyDeleteHi! This is my first visit to your blog! We are a team of volunteers and new initiatives in the same niche. Blog gave us useful information to work. You have done an amazing job! hotmail-inicio-sesion.com
ReplyDeleteI was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post. https://hotmail-account.email
ReplyDeleteI’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... make money
ReplyDeleteThank you for taking the time to publish this information very useful! https://45.77.247.58/
ReplyDeleteWow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though. bulk extractor email
ReplyDeleteI am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. free bulk email accounts
ReplyDeleteThanks for the blog filled with so many information. Stopping by your blog helped me to get what I was looking for. Now my task has become as easy as ABC. how to send 100 emails at once
ReplyDeleteI am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work. Email List Collection
ReplyDeleteI would like to say that this blog really convinced me to do it! Thanks, very good post. judi online
ReplyDeleteThis is a decent post. This post gives really quality data. I'm unquestionably going to investigate it. Truly exceptionally valuable tips are given here. Much obliged to you to such an extent. Keep up the acts of kindness. domino 105
ReplyDeleteBuy Gmail PVA Accounts from our company because we have the best experts in the markeet who create accounts with different USA Ips Buy Aged Instagram Accounts
ReplyDelete