2

The way that we use Microsoft Test Manager means that we want every test case to be included in at least one test suite. However, we have (manually) discovered some test cases that are not part of any test suite. Finding these by hand is very time consuming.

Therefore: Is there any way to find all test cases that are not part of any test suite?

(We're using Microsoft Test Manager 2012/2013.)

Matthew Watson
  • 104,400
  • 10
  • 158
  • 276
  • Which TFS version are you using? – Elena Jul 30 '14 at 16:43
  • @Elena The version that comes with Visual Studio 2012 – Matthew Watson Jul 30 '14 at 17:13
  • I'm not asking about the version of Team Explorer (that comes with Visual Studio) but about the version of Team Foundation Server, e.g. you can use Visual Studio 2012 with both versions of TFS (2012 and 2013). Since you wrote "We're using Microsoft Test Manager 2012/2013" I suppose you are using TFS 2012, right? – Elena Jul 30 '14 at 17:26

1 Answers1

3

You can't do it using MTM (no matter which version you are using).

Using TFS 2012 the only way is to use TFS-API, here a short example how to check if a particular Test Case is a part of any Test Suite:

using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.TestManagement.Client;

// Current user credentials will be used to access to TFS
TfsTeamProjectCollection tfsCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(<TFS Url>));
tfsCollection.EnsureAuthenticated();

ITestManagementService testManagementService = tfsCollection.GetService<ITestManagementService>();
ITestManagementTeamProject  teamProject = testManagementService.GetTeamProject(<team project name>);

// Get all Test Suites your Test Case belongs to
// (Across all Test Plans in the Team Project)
ITestSuiteCollection testSuites = teamProject.TestSuites.ReferencingTestCase(<test case id>);
bool doesItBelongToAnyTestSuite = testSuites.Any();

If you would use TFS 2013 it will be possible to achieve this using Work Item queries since Test Plan and Test Suite become Work Items with TFS 2013 Update 3 (RC was released on 2. July 2014).

Elena
  • 1,928
  • 1
  • 15
  • 23