Sending out email alert when a test case is pass or fail

时光总嘲笑我的痴心妄想 提交于 2019-12-07 04:15:34

问题


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.


回答1:


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.

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.

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.

But you will definitely be better off using it this way:

  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.



来源:https://stackoverflow.com/questions/20348601/sending-out-email-alert-when-a-test-case-is-pass-or-fail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!