次の方法で共有


MTM Empty Tester Field

Issue with the Tester field empty in the test cases while working with MTM 2010

 

Problem Description:

You may face issue with the Tester field empty in the test cases in MTM 2010.

 

Resolution:

This issue may occur due to two reasons:

  1. Either you have any groups in TFS (at collection or team project level which is having large number of users. Try reducing the number of users in the group, or you can check if you have any custom group with large number of users in it, try removing that group.

 

     2. Or this issue may occur in case any users has special character in logon, description attributes in the active directory.

 

For second scenario, the below code may help you in finding out which user might be causing the problem, make a console application in C# using below code:

 

=========================================================================================================================================

  

using Microsoft.TeamFoundation.Client;

using Microsoft.TeamFoundation.Common;

using Microsoft.TeamFoundation.TestManagement.Client;

using Microsoft.TeamFoundation.TestManagement.Common;

    
static void Main(string[] args)

       
{

           
string tpcUrl = @"<you project collection url";

           
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(tpcUrl), new UICredentialsProvider());

            
tpc.EnsureAuthenticated(); // this line is responsible for showing the login prompt.

            
IIdentityManagementService ims = tpc.GetService<IIdentityManagementService>();

           
List<TeamFoundationIdentity> userIdentities = new List<TeamFoundationIdentity>();

            
IdentityDescriptor everyoneGroup = new IdentityDescriptor(IdentityConstants.TeamFoundationType, GroupWellKnownSidConstants.EveryoneGroupSid);

           
TeamFoundationIdentity[] groupIdentities = ims.ReadIdentities(new IdentityDescriptor[] { everyoneGroup }, MembershipQuery.Expanded, ReadIdentityOptions.None);

           
int errorCount = 0;

           
if (groupIdentities != null)

           
{

               
if (groupIdentities.Length > 0)

               
{

                   
TeamFoundationIdentity everyoneTeamFoundationIdentity = groupIdentities[0];

                    
Console.WriteLine("Total group membership count: " + everyoneTeamFoundationIdentity.Members.Length);

                    
HashSet<Guid> userIds = new HashSet<Guid>();

                    
foreach (var descriptor in everyoneTeamFoundationIdentity.Members)

                   
{

                       
if (errorCount >= 10)

                   
    {

                           
Console.WriteLine("Aborting as 10 errors have been hit");

                           
break;

                       
}

 

                       
try

                       
{

                           
TeamFoundationIdentity identity = ims.ReadIdentity(descriptor, MembershipQuery.None, ReadIdentityOptions.None);

                           
if ((!identity.IsContainer) && (!userIds.Contains(identity.TeamFoundationId)))

                           
{

      
                         userIdentities.Add(identity);                               
                        userIds.Add(identity.TeamFoundationId);

                           
}

                       
}

                       
catch (Exception ex)

                       
{

 
                          Console.WriteLine("Error reading identity for descriptor {0}. Error:{1}", descriptor.Identifier, ex.Message);

                           
                          errorCount++;

                       
}

                   
}

               
}

           
}

 

           
// userIdentities contains list of TeamFoundationIdentity objects representing each user.

           
Console.WriteLine("Total valid user count: " + userIdentities.Count);

           
Console.WriteLine("Error count {0}", errorCount);

 

============================================================================================================================================

 

If any of the users is causing this issue, then the above code will throw the error, something like  this:

 

Total group membership count: 3500

Error reading identity for descriptor
S-1-5-21-1111111111-222222222222-333333333333-44

835.Error:'?', hexadecimal value 0x1A, is an invalid character. Line 1, position 800.

Error reading identity for descriptorS-1-5-21-1111111111-222222222222-333333333333-44

834.
Error:'?', hexadecimal value 0x1A, is an invalid character. Line 1, position 794.

Total
valid user count: 2500

Error
count 2

 

and will give you the SID for the offended users. Now to search which user this SID belongs to, query the [Tfs_Configuration].[dbo].[tbl_security_identity_cache] in TFS database table to find the offending user.

 

Select * from [Tfs_Configuration].[dbo].[tbl_security_identity_cache] where Sid = 'S-1-5-21-1111111111-222222222222-333333333333-44'

 

Check if any field contains special characters for the user in the database, remove that special character.

 

Hope this should help in case you face the issue mentioned in this blog.

Content developed by: Deepak Mittal
Content reviewed by: Teodora Stanev