Exemple #1
0
        internal override void InternalExecute()
        {
            ITestPlanCollection sourcePlans = sourceTestStore.GetTestPlans();

            Trace.WriteLine(string.Format("Plan to copy {0} Plans?", sourcePlans.Count), "TestPlansAndSuites");
            foreach (ITestPlan sourcePlan in sourcePlans)
            {
                string newPlanName = string.Format("{0}-{1}", sourceWitStore.GetProject().Name, sourcePlan.Name);
                Trace.WriteLine(string.Format("Process Plan {0} - ", newPlanName), "TestPlansAndSuites");
                ITestPlan targetPlan = FindTestPlan(targetTestStore, newPlanName);
                if (targetPlan == null)
                {
                    Trace.WriteLine(string.Format("    Plan missing...creating"), "TestPlansAndSuites");
                    targetPlan = CreateNewTestPlanFromSource(sourcePlan, newPlanName);
                    targetPlan.Save();
                }
                else
                {
                    Trace.WriteLine(string.Format("    Plan found"), "TestPlansAndSuites");
                }
                if (HasChildSuits(sourcePlan.RootSuite))
                {
                    Trace.WriteLine(string.Format("    Source Plan has {0} Suites", sourcePlan.RootSuite.Entries.Count), "TestPlansAndSuites");
                    foreach (ITestSuiteBase sourcerSuiteChild in sourcePlan.RootSuite.SubSuites)
                    {
                        ProcessStaticSuite(sourcerSuiteChild, targetPlan.RootSuite, targetPlan);
                    }
                    // Add Test Cases
                    ProcessChildTestCases(sourcePlan.RootSuite, targetPlan.RootSuite, targetPlan);
                }
            }
        }
        internal override void InternalExecute()
        {
            ITestPlanCollection sourcePlans = sourceTestStore.GetTestPlans();

            Trace.WriteLine(string.Format("Plan to copy {0} Plans?", sourcePlans.Count), "TestPlansAndSuites");
            foreach (ITestPlan sourcePlan in sourcePlans)
            {
                if (CanSkipElementBecauseOfTags(sourcePlan.Id))
                {
                    continue;
                }

                var newPlanName = config.PrefixProjectToNodes
                    ? $"{sourceWitStore.GetProject().Name}-{sourcePlan.Name}"
                    : $"{sourcePlan.Name}";

                Trace.WriteLine($"Process Plan {newPlanName}", Name);
                var targetPlan = FindTestPlan(targetTestStore, newPlanName);
                if (targetPlan == null)
                {
                    Trace.WriteLine("    Plan missing... creating", Name);
                    targetPlan = CreateNewTestPlanFromSource(sourcePlan, newPlanName);

                    RemoveInvalidLinks(targetPlan);

                    targetPlan.Save();

                    ApplyFieldMappings(sourcePlan.Id, targetPlan.Id);
                    AssignReflectedWorkItemId(sourcePlan.Id, targetPlan.Id);
                    FixAssignedToValue(sourcePlan.Id, targetPlan.Id);

                    ApplyDefaultConfigurations(sourcePlan.RootSuite, targetPlan.RootSuite);

                    ApplyFieldMappings(sourcePlan.RootSuite.Id, targetPlan.RootSuite.Id);
                    AssignReflectedWorkItemId(sourcePlan.RootSuite.Id, targetPlan.RootSuite.Id);
                    FixAssignedToValue(sourcePlan.RootSuite.Id, targetPlan.RootSuite.Id);
                    // Add Test Cases & apply configurations
                    AddChildTestCases(sourcePlan.RootSuite, targetPlan.RootSuite, targetPlan);
                }
                else
                {
                    Trace.WriteLine("    Plan already found, not creating", Name);
                }
                if (HasChildSuites(sourcePlan.RootSuite))
                {
                    Trace.WriteLine($"    Source Plan has {sourcePlan.RootSuite.Entries.Count} Suites", Name);
                    foreach (var sourceSuiteChild in sourcePlan.RootSuite.SubSuites)
                    {
                        ProcessTestSuite(sourceSuiteChild, targetPlan.RootSuite, targetPlan);
                    }
                }

                targetPlan.Save();
                // Load the plan again, because somehow it doesn't let me set configurations on the already loaded plan
                ITestPlan targetPlan2 = FindTestPlan(targetTestStore, targetPlan.Name);
                ApplyConfigurationsAndAssignTesters(sourcePlan.RootSuite, targetPlan2.RootSuite);
            }
        }
        internal override void InternalExecute()
        {
            ITestPlanCollection sourcePlans = sourceTestStore.GetTestPlans();

            Trace.WriteLine(string.Format("Plan to copy {0} Plans?", sourcePlans.Count), "TestPlansAndSuites");
            foreach (ITestPlan sourcePlan in sourcePlans)
            {
                if (CanSkipElementBecauseOfTags(sourcePlan.Id))
                {
                    continue;
                }

                var newPlanName = config.PrefixProjectToNodes
                    ? $"{sourceWitStore.GetProject().Name}-{sourcePlan.Name}"
                    : $"{sourcePlan.Name}";

                Trace.WriteLine($"Process Plan {newPlanName}", Name);
                var targetPlan = FindTestPlan(targetTestStore, newPlanName);
                if (targetPlan == null)
                {
                    Trace.WriteLine("    Plan missing... creating", Name);
                    targetPlan = CreateNewTestPlanFromSource(sourcePlan, newPlanName);
                    targetPlan.Save();
                    AssignReflectedWorkItemId(sourcePlan.Id, targetPlan.Id);
                    FixAssignedToValue(sourcePlan.Id, targetPlan.Id);
                    AssignReflectedWorkItemId(sourcePlan.RootSuite.Id, targetPlan.RootSuite.Id);
                    FixAssignedToValue(sourcePlan.RootSuite.Id, targetPlan.RootSuite.Id);
                }
                else
                {
                    Trace.WriteLine("    Plan found", Name);
                }
                if (HasChildSuits(sourcePlan.RootSuite))
                {
                    Trace.WriteLine($"    Source Plan has {sourcePlan.RootSuite.Entries.Count} Suites", Name);
                    foreach (var sourcerSuiteChild in sourcePlan.RootSuite.SubSuites)
                    {
                        ProcessStaticSuite(sourcerSuiteChild, targetPlan.RootSuite, targetPlan);
                    }
                    // Add Test Cases
                    ProcessChildTestCases(sourcePlan.RootSuite, targetPlan.RootSuite, targetPlan);
                }
            }
        }