Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 232
Varun Bajpai Avatar asked Oct 02 '22 06:10

Varun Bajpai


1 Answers

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.

like image 198
Elena Avatar answered Oct 23 '22 02:10

Elena