/// <summary> /// Sets the associated automation of specific test case. /// </summary> /// <param name="testCase">The test case.</param> /// <param name="testManagementTeamProject">The test management team project.</param> /// <param name="testForAssociation">The test to be associated with.</param> /// <param name="testType">Type of the test.</param> public static void SetAssociatedAutomation(this ITestCase testCase, ITestManagementTeamProject testManagementTeamProject, Test testForAssociation, string testType) { try { log.InfoFormat("Associate test case with title= {0}, id= {1} to test: {2}, test type= {3}", testCase.Title, testCase.Id, testForAssociation, testType); ITmiTestImplementation imp = testManagementTeamProject.CreateTmiTestImplementation(testForAssociation.FullName, testType, testForAssociation.ClassName, testForAssociation.MethodId); testCase.Implementation = imp; } catch (NullReferenceException ex) { log.Error(ex); } }
public static void SetAssociatedAutomation(this ITestCase testCase, ITestManagementTeamProject project, AutomatedTestMethod testMethod) { if (testCase == null) { return; } //create a GUID ID var cryptoServiceProvider = new SHA1CryptoServiceProvider(); var hash = cryptoServiceProvider.ComputeHash(Encoding.Unicode.GetBytes(testMethod.Name)); var bytes = new byte[16]; Array.Copy(hash, bytes, 16); var automationGuid = new Guid(bytes); testCase.Implementation = project.CreateTmiTestImplementation(testMethod.FullName, testMethod.Type, testMethod.Assembly, automationGuid); }
/// <summary> /// Sets the associated automation of specific test case. /// </summary> /// <param name="testCase">The test case.</param> /// <param name="testManagementTeamProject">The test management team project.</param> /// <param name="testForAssociation">The test to be associated with.</param> /// <param name="testType">Type of the test.</param> public static void SetAssociatedAutomation(this ITestCase testCase, ITestManagementTeamProject testManagementTeamProject, Test testForAssociation, string testType) { try { log.InfoFormat("Associate test case with title= {0}, id= {1} to test: {2}, test type= {3}", testCase.Title, testCase.Id, testForAssociation, testType); ITmiTestImplementation imp = testManagementTeamProject.CreateTmiTestImplementation(testForAssociation.FullName, testType, testForAssociation.ClassName, testForAssociation.MethodId); testCase.Implementation = imp; } catch (NullReferenceException ex) { log.Error(ex); } }