我有一个项目,在TFS上使用预定构建运行单元测试。我收到的电子邮件通知如下: Standard email notification on build completion
我需要将一个包含测试结果和测试错误消息的测试列表添加到通知邮件中。可以用TFS做到吗? 如果没有,我如何使用单元测试数据配置构建定义的额外步骤,如“单元测试名称:结果”(已完成/失败)+错误消息。 将带有测试结果的附件添加到电子邮件中也是一个好点。
请向我提供信息/说明/示例。
使用c#和MSTests对带有单元测试的项目进行编码。
答案 0 :(得分:0)
构建警报模板位于:
c:\ Program Files \ Microsoft Team Foundation Server 14.0 \ Application 层\ TFSJobAgent \变换\ 1033 \ BuildCompletedEvent.xsl
找到可以在其中进行自定义的模板。
此外,您可以编写一个powershell脚本来获取测试结果,然后发送电子邮件。然后在TFS构建中运行此脚本。
使用TFS RESI API获取测试结果:How can I get the last test run id from TFS to my powershell script
使用powershell发送电子邮件:https://practical365.com/exchange-server/powershell-how-to-send-email/
以下是另一个代码为http://chamindac.blogspot.sg/2015/10/send-test-result-email-after-running.html
的博客