简体   繁体   English

有没有办法在机器人框架中测试完成后在电子邮件中发送log.html,report.html和output.xml?

[英]Is there a way to send log.html,report.html and output.xml in email after test completion in robot-framework?

I am trying to achieve one scenario in which i need to send log.html, report.html and output.xml directly in the email after completion of test suite and test case. 我试图实现一个场景,我需要在完成测试套件和测试用例后直接在电子邮件中发送log.html,report.html和output.xml。 I saw discussions on this part but not able to get the proper answer. 我看到了这方面的讨论,但没有得到正确的答案。

My questions are: 我的问题是:

  1. How we are able to achieve this task if its possible? 如果可能的话,我们如何才能完成这项任务?
  2. If we are not able to achieve then what's the alternate way? 如果我们无法实现那么替代方式是什么?

There is a new metrics report release thanks to adiralashiva8. 由于adiralashiva8,有一个新的指标报告发布。

The metrics provide more information including graphs. 指标提供了更多信息,包括图表。

This could be an alternative for your problem. 这可能是您的问题的替代方案。

It supports email sending: 它支持电子邮件发送:

To send emails using the new metrics you would need to change the robotmetrics.py file with your email: 要使用新指标发送电子邮件,您需要使用电子邮件更改robotmetrics.py文件:

server = smtplib.SMTP('smtp.office365.com:587')
msg = MIMEMultipart() 
msg['Subject'] = 'MyProject Automation Status'

sender = 'sample@sample.com'
recipients = ['sampleuser@sample.com']

You can find more info here: 你可以在这里找到更多信息:

New metrics 新指标

Update: 更新:

To run your metrics after test execution you can use the following command 要在测试执行后运行指标,可以使用以下命令

 robot test.robot && robotmetrics

Use Jenkins Post-build Actions 使用Jenkins Post-build Actions

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM