Пример #1
0
 /// <summary>
 /// Fills the actual test case with steps of another test case
 /// </summary>
 /// <param name="oldTestCase"></param>
 public void Merge(TestCase aTestCase)
 {
     if (Steps.Count != aTestCase.Steps.Count)
     {
         throw new Exception("The number of steps of " + Name + " changed");
     }
     else
     {
         int cnt = 0;
         foreach (Step step in Steps)
         {
             Step oldStep = aTestCase.Steps[cnt] as Step;
             if (aTestCase != null)
             {
                 if (step.getTCS_Order() == oldStep.getTCS_Order())
                 {
                     step.Merge(oldStep);
                 }
                 else
                 {
                     throw new Exception("The new version of the test case " + Name + " contains the step " + step.Name + " instead of " + oldStep.Name);
                 }
             }
             cnt++;
         }
     }
 }
Пример #2
0
        /// <summary>
        ///     Fills the actual test case with steps of another test case
        /// </summary>
        /// <param name="previousTestCase"></param>
        /// <param name="keepManualTranslations">Indicates that manual translation for be kept during import</param>
        public void Merge(TestCase previousTestCase, bool keepManualTranslations)
        {
            if (previousTestCase != null)
            {
                setGuid(previousTestCase.getGuid());
                foreach (Step step in Steps)
                {
                    Step previousStep = null;
                    foreach (Step other in previousTestCase.Steps)
                    {
                        if (other.getDescription() == step.getDescription() &&
                            other.getTCS_Order() == step.getTCS_Order())
                        {
                            previousStep = other;
                            break;
                        }
                    }

                    if (previousStep != null)
                    {
                        if (step.getTCS_Order() == previousStep.getTCS_Order())
                        {
                            step.Merge(previousStep, keepManualTranslations);
                        }
                        else
                        {
                            throw new Exception("The new version of the test case " + Name + " contains the step " +
                                                step.Name + " instead of " + previousStep.Name);
                        }
                    }
                }

                if (keepManualTranslations)
                {
                    int index = 0;
                    foreach (Step step in previousTestCase.Steps)
                    {
                        if (step.getTCS_Order() == 0 && !step.getTranslationRequired())
                        {
                            // This step has been added manually
                            allSteps().Insert(index, step);
                            step.setFather(this);
                        }
                        index += 1;
                    }
                }

                foreach (ReqRef reqRef in previousTestCase.Requirements)
                {
                    appendRequirements(reqRef);
                }
            }
        }