Which Test Management notifications are available?


Test Management service in Team Foundation Server 2012 raises notifications on some specific actions by its users. You can subscribe to these notifications to understand what’s going on in the server. Here are some of the important notifications which are raised by test management service.

  • TestRunStartedNotification
  • TestRunChangedNotification
  • TestRunCompletedNotification 
  • TestPlanChangedNotification
  • TestSuiteChangedNotification 
  • TestConfigurationChangedNotification

   

    (Update 11/20) 

    Let us go through these events one by one and understand each of them in detail.

    • TestRunStartedNotification: – This event is raised when a new test run is started or when a test case belonging to a completed run is reset. This event contains the complete TestRun object, so from this event you can easily find out who fired this test run, which is the associated build,  what time was it started, whether it is automated or manual run, under which test plan is this run fired and so on.

     

    • TestRunChangedNotification: – This event is raised few times within a run and the exact operations which raise this event are: –
      • When a new test run is created. (Most of the time it will be raised “just before” test run started notification is raised)
      • When a exiting test run is updated. (Attachment is uploaded to a run, Run state change etc)
      • When an ongoing test run is aborted.
      • When a test run is deleted.

    This event contains the run id which got changed and you can query the server to find out what is the new test run object.

    • TestRunCompletedNotification: – This event is raised when a test run gets completed. This event contains the complete TestRun object, so from this event you can easily find out when all the details which you could find in the above TestRunStartedNotification. In addition, you can find out the completion time, test run stats etc as well.

     

    • TestPlanChangedNotification: – This event is raised whenever a new test plan is created, updated or deleted. Note that the update of a test plan here means only the update of test plan properties like test plan name, area path, build associated with the plan etc and it does not mean the update of the contained test suites. This event contains the plan id which got changed and you can query the server to find out the updated test plan object.

     

    • TestSuiteChangedNotification: – This event is raised whenever a test suite is created, updated or deleted. Note that here update of test suite means update of the test suite properties (name, state configurations etc), addition/removal of tests from a suite, change in test point assignment, refresh of suite for query based suite and requirement based suite etc. This event contains the suite Id which got changed and you can query the server to find out the updated test suite object.

     

    • TestConfigurationChangedNotification: – This event is raised whenever a new configuration is created, updated or deleted. This event contains the configuration Id which got changed and you can query the server to find out the updated configuration object.
    Comments (4)

    1. User1101 says:

      Why would the TestRunStatistics array be null after a TestRunCompletedNotification is fired and caught in an event handler?

    2. Pradeep says:

      Hi User1101 – The TestRunStatistics is populated in the TestRun object when you query the test run and not when the TestRunCompletedNotification is triggered. If you can use the run id and query the test run, you will get the TestRunStatistics.

      Regards,

      Pradeep

    3. User1101 says:

      Thank you very much for your reply, it is appreciated!

      Could you maybe post a small example?  I ask because the TestRunCompletedNotification houses a TestRun object already which already has the TestRunId set, so I would think the TestRunStatistics[] would be populated based on that id.

    4. Pradeep says:

      Hi User1101 – Can you please reach me at pradeepn[at]microsoft.com. I will send a code snippet for this. Basically, the TestRun object that gets passed with the event notification does not have the TestRunStatistics set. You can use the Client Object model to get the run object to access the statistics. You should do a couple of settings on the server to enable using the Client OM to query test run. I will send those instructions to you over mail.

      Regards,

      Pradeep