问题描述
作业完成后,我需要通过Jenkins通过电子邮件发送testng报告,但是每次测试开始时报告的名称都会更改.如何发送最新报告?我在网上看过,但只能找到具有相似报告名称的教程.报告的命名约定为:程序的名称_程序的开始日期和时间(例如:Program1_Tue_Oct_09_13-16-36_EDT_2018).该报告还会作为附件发送,还是作为报告内容发布在电子邮件中?我正在考虑以某种方式添加正则表达式来查找最新文件吗?
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?
推荐答案
您是否尝试安装Email-ext插件?这有很多选择...
Have you tried to install the Email-ext plugin? This has a lot of options...
Jenkins系统配置页面>管理詹金斯>管理插件
然后,在您的构建中:
点击添加生成后操作"下拉菜单.
Click the ‘Add post-build action’ drop-down.
选择电子邮件通知"值.
Select the ‘E-mail Notification’ value.
在电子邮件通知"框中输入收件人的电子邮件ID,然后选中为每个不稳定的版本发送电子邮件"选项旁边的复选框.
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.
这篇关于如何在Jenkins中通过电子邮件发送Testng报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!