9

We use TFS at my workplace to manage our source code and track development.

Whenever we have a bug or work to do, we always have to do the following two tasks as a minimum:

  • Test the work, or decide whether testing is needed.
  • Update the release notes for the current release, or decide whether it needs a specific entry.

Other tasks are specific to the work being done, but I find myself constantly typing "Testing" and "Release notes" when adding new work items.

Is there a way to get TFS to automatically add these two tasks whenever a new bug or work item is created? In the rare case these tasks are not required, they can simply be marked as done or removed for that work item, so I'm not concerned about the impact in making this automatic.

I have had a look around and it looks like I might be able to create a PowerShell script to add the tasks to any work items that are missing them, which may be the way to go.

m-smith
  • 454
  • 2
  • 7
  • 20

1 Answers1

11

Important note

There is no out-of-the-box feature for this, and usually I try to steer people away from generic tasks like "Test", "Deploy" and have them think about testing all the way through the work and to have them define intermediate tests they want to execute along the way.

Generic stuff such a Release Notes and Deployment can be completely automated. Probably also using powershell ;).

So I try to have people put their focus on using their Powershell-fu on automating these generic and bad tasks.

The answer

Of course that's not the answer to your question per-se. So here is the real answer, yes, powershell is an option, you can call into the REST api or the Client Object model and use that to query wok items and to create new work items. The API broadly used and there is a lot of information out there in terms of blog posts and the like. Or you can create a small console application that also uses the same Client Object Model.

You can also use the SOAP api from the alerts to get notified when a workitem is added or changed and have your code act on that by adding the required child work items.

An alternative to the SOAP api is to use something like the TFS Aggregator, which integrates into the server itself. It uses the same TFS client object model. I'm part of the team building it and we've released for both 2013u2+ and 2015+. The TFS Aggregator allows you to write rules that use Powershell of C#-script to act on work item changes. It already has a lot of work done to it to prevent common pitfalls when working with the Client Object Model from an automation perspective.

The TFS Aggregator is a serverside pugin for TFS 2013 (update 2 and later) which now has the ability to create new work items based on rules. An example task can be found here:

jessehouwing
  • 1,044
  • 8
  • 14