示例#1
0
 internal bool Add(Run therun)
 {
     try {
         StepFactory runstepF = therun.StepFactory as StepFactory;
         Step        thestep  = runstepF.AddItem(_stepName) as Step;
         thestep.Status            = _status;
         thestep["ST_ACTUAL"]      = _actual; //add actual field
         thestep["ST_DESCRIPTION"] = _Description;
         thestep["ST_EXPECTED"]    = _Expected;
         thestep.Post(); //add step
         if (File.Exists(_attachmentPath + "\\" + _attachmentName))
         {
             AttachmentFactory attachFact = thestep.Attachments as AttachmentFactory;
             Attachment        attachfile;
             IExtendedStorage  extStor;
             attachfile = attachFact.AddItem(_attachmentName) as Attachment;
             attachfile.Post();
             extStor            = attachfile.AttachmentStorage as IExtendedStorage;
             extStor.ClientPath = _attachmentPath;
             extStor.Save(_attachmentName, true);
         }
     } catch (Exception) {
         return(false);
     }
     return(true);
 }
 /// <summary>
 /// The AddTestStep.
 /// </summary>
 /// <param name="testStepName">The testStepName<see cref="string"/>.</param>
 /// <param name="testStepStatus">The testStepStatus<see cref="string"/>.</param>
 /// <param name="testStepDescription">The testStepDescription<see cref="string"/>.</param>
 /// <param name="testStepExpected">The testStepExpected<see cref="string"/>.</param>
 /// <param name="testStepActual">The testStepActual<see cref="string"/>.</param>
 public void AddTestStep(string testStepName, string testStepStatus, string testStepDescription, string testStepExpected, string testStepActual)
 {
     try
     {
         StepFactory stepFactory = this.TestRun.StepFactory as StepFactory;
         Step        step        = stepFactory.AddItem("Selenium Automated Tests") as Step;
         step["ST_STEP_NAME"]      = testStepName;
         step["ST_STATUS"]         = testStepStatus;
         step["ST_DESCRIPTION"]    = testStepDescription;
         step["ST_EXPECTED"]       = testStepExpected;
         step["ST_ACTUAL"]         = testStepActual;
         step["ST_EXECUTION_DATE"] = DateTime.Now;
         step["ST_EXECUTION_TIME"] = DateTime.Now;
         step.Post();
     }
     catch (Exception)
     {
         throw new CannotAddTestStep(CannotAddTestStep.ErrorMsg + $"({this.Name}) {testStepName} -> {testStepStatus}");
     }
 }