Reputation: 159
I need to send a testng report through email in Jenkins after the job is completed, but the name of the report changes each time the test is started. How can I send the latest report? I looked online but can only find tutorials with similar report names only. The naming convention of the report is: the name of the program_the date it started_and the time it started on (Ex: Program1_Tue_Oct_09_13-16-36_EDT_2018). Also will the report send as an attachment or will it be posted as a report content on the email? I was thinking of somehow adding like a regular expression to look for the latest file?
Upvotes: 1
Views: 11388
Reputation: 29
Just import the generated JUnit report using the JUnit plugin. Example:
junit 'target/surefire-reports/junitreports/*.xml'
Upvotes: -1
Reputation: 1726
Have you tried to install the Email-ext plugin? This has a lot of options...
Jenkins System configuration page> Manage Jenkins > Manage Plugins
Then, in your build:
Click the ‘Add post-build action’ drop-down.
Select the ‘E-mail Notification’ value.
Enter the recipient email id in the ‘E-mail Notification’ box and select the checkbox next to the ‘Send e-mail for every unstable build’ option.
Click the ‘Add post-build action’ drop-down and select the ‘Editable Email Notification’ value.
Fill the ‘Editable Email Notification’ fields.
Click the ‘Advance Settings…’ button in the ‘Editable Email Notification’ box.
Upvotes: 2