当测试用例通过或失败时发送电子邮件警报 [英] Sending out email alert when a test case is pass or fail

查看:46
本文介绍了当测试用例通过或失败时发送电子邮件警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在测试管理器上执行测试执行结果为通过或失败或任何其他状态时,我想向用户发送电子邮件警报.我知道测试经理不能做到,但 TFS 可以,我尝试了各种查询组合来设置相同的警报.我想为自动化测试用例做这件事.我将创建的构建不会有太大变化,因为我要测试服务.只会在同一个构建中执行测试用例并显示结果.

i want to send an email alert to the user when a test execution result is pass or fail or any other status when it is executed on test manager. i know test manager can not do it yet the TFS can, i have tried various combination of queries to set an alert for the same. I want to do it for an automated test case. the build i'll create will not be changing much as i am up to testing of services. only test cases will be executed on the same build and results are to be displayed.

推荐答案

如果您从 MTM手动开始自动化测试,则无法创建警报(或在至少没有标准方式).

If you start automated tests manually from MTM there is no way to create an alert (or at least no standard way).

原因是如果您运行测试,测试用例不会改变.而是创建了一个新的测试用例结果,它与测试用例相关.
由于此测试用例结果不是工作项,因此您无法为电子邮件警报创建查询.

The reason is that the Test Case does not change if you run the test. A new Test Case Result is created instead which is related to the Test Case.
Since this Test Case Result is not a Work Item you can not create a query for e-mail alert.

如果是关于失败的测试运行,解决方法可能是为每个失败的测试运行创建一个错误,并将这些错误分配给特定的人,这些人已经为分配给他们的新错误设置了 TFS 警报.

If it is about failed test runs the workaround could be to create a Bug for each failed test run and assign these bugs to particular people who have been set up TFS alerts for new bugs assigned to them.

另一种可能性是使用 TFS API 访问测试用例结果并自己实现发送电子邮件.但这不是您正在寻找的解决方案,我想.

Another possibility would be to access Test Case Result using TFS API and implement sending e-mail yourself. But this is not the solution you are looking for, I suppose.

但是这样使用它肯定会更好:

  1. 使用LabDefaultTemplate11.xaml创建构建定义
    请参阅如何:创建构建-部署-测试标准环境的工作流程了解更多详情.
  2. 使用此构建定义来启动您的测试,而不是从 MTM 启动它们.
    这意味着您只能使用此构建定义来启动测试(没有构建,如果您不需要它们,则没有部署).
  3. 现在,您可以在每次想要运行测试时将此构建定义加入队列.
  4. 创建警报,如果此构建完成,将发送电子邮件.
    如果测试成功,则此构建将成功,如果测试失败,则此构建将失败.
    添加: 检查收到构建通知,了解有关如何执行此操作的更多详细信息.
  1. Create a build definition using LabDefaultTemplate11.xaml
    See How to: Create a Build-Deploy-Test Workflow for a Standard Environment for more details.
  2. Use this build definition for starting your tests instead of starting them from MTM.
    That means you can use this build definition for starting tests only (no build, no deployment if you don't need them).
  3. Now you can just queue this build definition each time you want to run your tests.
  4. Create alerts that will send e-mails if this build is complete.
    This build will be successful if tests are successful and will fail if tests fail.
    Added: Check Received build notifications for more details on how to do this.

这就是它的用途,基本上.

That is the way it's intended to be used, basically.

这篇关于当测试用例通过或失败时发送电子邮件警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆