diff --git a/docs/Reference/Generated/MigrationTools.Host.xml b/docs/Reference/Generated/MigrationTools.Host.xml index ea7b400ef..26af43b78 100644 --- a/docs/Reference/Generated/MigrationTools.Host.xml +++ b/docs/Reference/Generated/MigrationTools.Host.xml @@ -26,17 +26,17 @@ - => @"3351d3f" + => @"6a99c83" - => @"3351d3f7d0ea9699e65e5c1ed2b3e26e5547bed3" + => @"6a99c8370a13b1807e23ff34c7b12888435a15d6" - => @"2023-11-23T10:22:02+00:00" + => @"2023-11-23T13:43:28+00:00" @@ -46,12 +46,12 @@ - => @"v14.3.1" + => @"v14.3.2" - => @"v14.3.1" + => @"v14.3.2" @@ -66,7 +66,7 @@ - => @"1" + => @"2" @@ -81,7 +81,7 @@ - => @"1" + => @"2" diff --git a/src/VstsSyncMigrator.Core/Execution/MigrationContext/TestPlansAndSuitesMigrationContext.cs b/src/VstsSyncMigrator.Core/Execution/MigrationContext/TestPlansAndSuitesMigrationContext.cs index f75dea7fa..6baf47dd6 100644 --- a/src/VstsSyncMigrator.Core/Execution/MigrationContext/TestPlansAndSuitesMigrationContext.cs +++ b/src/VstsSyncMigrator.Core/Execution/MigrationContext/TestPlansAndSuitesMigrationContext.cs @@ -624,18 +624,26 @@ private ITestSuiteBase FindSuiteEntry(IStaticTestSuite staticSuite, string title private ITestPlan FindTestPlan(TestManagementContext tmc, string name) { + Log.LogDebug("TestPlansAndSuitesMigrationContext::FindTestPlan"); ITestPlan testPlan = (from p in tmc.Project.TestPlans.Query("Select * From TestPlan") where p.Name == name select p).SingleOrDefault(); + if (testPlan != null) { + Log.LogDebug("TestPlansAndSuitesMigrationContext::FindTestPlan:: FOUND Test Plan with {name}", name); //Check test plan is in fact the right one var sourceWI = Engine.Source.WorkItems.GetWorkItem(testPlan.Id.ToString()); string expectedReflectedId = Engine.Source.WorkItems.CreateReflectedWorkItemId(sourceWI).ToString(); string workItemReflectedId = (string)sourceWI.Fields[Engine.Target.Config.AsTeamProjectConfig().ReflectedWorkItemIDFieldName].Value; if (workItemReflectedId != expectedReflectedId) { + Log.LogDebug("TestPlansAndSuitesMigrationContext::FindTestPlan:: Fouund test plan with name {name} does not match {workItemReflectedId} ", name, workItemReflectedId); testPlan = null; } } + else + { + Log.LogDebug("TestPlansAndSuitesMigrationContext::FindTestPlan:: NOT FOUND Test Plan with {name}", name); + } return testPlan; } @@ -914,9 +922,17 @@ private void ProcessTestPlan(ITestPlan sourcePlan) // Load the plan again, because somehow it doesn't let me set configurations on the already loaded plan InnerLog(sourcePlan, $"ApplyConfigurationsAndAssignTesters {targetPlan.Name}", 5); ; ITestPlan targetPlan2 = FindTestPlan(_targetTestStore, targetPlan.Name); - ApplyConfigurationsAndAssignTesters(sourcePlan.RootSuite, targetPlan2.RootSuite); - ////////////////////////////// - TagCompletedTargetPlan(targetPlan.Id); + if (targetPlan2 != null) + { + ApplyConfigurationsAndAssignTesters(sourcePlan.RootSuite, targetPlan2.RootSuite); + ////////////////////////////// + TagCompletedTargetPlan(targetPlan.Id); + } + else + { + Log.LogError("Unable to ApplyConfigurationsAndAssignTesters: When loading the test plan again with the name it was found that they do not match!"); + } + /////////////////////////////////////////////// metrics.Add("ElapsedMS", stopwatch.ElapsedMilliseconds); Telemetry.TrackEvent("MigrateTestPlan", parameters, metrics);