Пример #1
0
        private void AppendTestExcel(ReporterTestInfo testInfo)
        {
            // Open Template
            FileStream fsr = new FileStream(outputFolder, FileMode.Open, FileAccess.Read);

            // Load the template into a NPOI workbook
            XSSFWorkbook templateWorkbook = new XSSFWorkbook(fsr);

            // Load the sheet you are going to use as a template into NPOI
            ISheet sheet = templateWorkbook.GetSheet("Sheet1");
            // XSSFRow row;
            // Insert data into template
            var row    = sheet.CreateRow(currRow);
            var cellIn = row.CreateCell(0);

            cellIn.SetCellValue(testInfo.FullyQualifiedTestClassName);
            cellIn = row.CreateCell(1);
            cellIn.SetCellValue(testInfo.TestName);
            cellIn = row.CreateCell(2);
            cellIn.SetCellValue(testInfo.Status.ToString());
            cellIn = row.CreateCell(3);
            cellIn.SetCellValue(testInfo.DurationTime);
            cellIn = row.CreateCell(4);
            cellIn.SetCellValue(failureReason);
            sheet.ForceFormulaRecalculation = true;

            // Save the NPOI workbook into a memory stream to be sent to the browser, could have saved to disk.
            fsr.Close();

            templateWorkbook.Write(new FileStream(outputFolder, FileMode.Create, FileAccess.ReadWrite));
        }
Пример #2
0
        public void StartTest(ReporterTestInfo testInfo)
        {
            currentTest = new Test(index, testInfo.TestName, executionUid + "-" + index);
            DateTime dateTime = DateTime.Now;

            currentTest.timestamp   = dateTime.ToString("HH:mm:ss");
            currentTest.date        = dateTime.ToString("yyyy/MM/dd");
            currentTest.className   = testInfo.FullyQualifiedTestClassName;
            currentTest.description = testInfo.FullyQualifiedTestClassName;
            string   scenarioName = testInfo.FullyQualifiedTestClassName.Split('.')[testInfo.FullyQualifiedTestClassName.Split('.').Length - 2];
            Scenario scenario;

            if (machine.IsChildWithNameExists(scenarioName))
            {
                scenario = (Scenario)machine.GetChildWithName(scenarioName);
            }
            else
            {
                scenario = new Scenario(scenarioName);
                if (machine.children != null)
                {
                    // We need to copy all the properties from the first scenario.
                    // Failing to do so will cause that the tests in the ElsaticSearch, for example, will not have properties.
                    scenario.scenarioProperties = ((Scenario)machine.children[0]).scenarioProperties;
                }
                machine.AddChild(scenario);
            }
            scenario.AddChild(currentTest);
            ExecutionWasAddedOrUpdated(execution);
            testDetails = new TestDetails(currentTest.uid);
        }
Пример #3
0
        public override void EndTest(ReporterTestInfo testInfo)
        {
            if (enabled)
            {
                try
                {
                    if (testInfo.Status != ReporterTestInfo.TestStatus.success)
                    {
                        string videoFileName = recorder.SaveRecording();
                        base.Report("Test Flow Video", videoFileName, ReporterTestInfo.TestStatus.failure, ReportElementType.lnk);
                        File.Delete(videoFileName);
                    }
                    else
                    {
                        recorder.DumpRecording();
                    }
                }
                catch
                {
                    enabled = false;
                }
            }

            base.EndTest(testInfo);
        }
Пример #4
0
 public void EndTest(ReporterTestInfo testInfo)
 {
     TestDetailsWereAdded(testDetails);
     currentTest.status   = testInfo.Status.ToString();
     currentTest.duration = testInfo.DurationTime;
     ExecutionWasAddedOrUpdated(execution);
     index++;
 }
 public void EndTest(ReporterTestInfo testInfo)
 {
     Print(divider);
     Print("[TEST END]: " + testInfo.TestName);
     Print("Test duration: " + testInfo.DurationTime + " milliseconds");
     Print("Test status: " + testInfo.Status);
     Print(divider);
 }
Пример #6
0
 public void EndTest(ReporterTestInfo testInfo)
 {
     //Add one row to the excel report with the test info.
     if (testInfo.Status != ReporterTestInfo.TestStatus.success)
     {
         AppendTestExcel(testInfo);
         currRow++;
     }
 }
 public virtual void EndTest(ReporterTestInfo testInfo)
 {
     currentTest.status   = testInfo.Status.ToString();
     currentTest.duration = testInfo.DurationTime;
     testDetails.duration = testInfo.DurationTime;
     ExecutionToFile();
     TestToFile();
     index++;
 }
Пример #8
0
 public void TestStarted(TestName testName)
 {
     testInfo          = new ReporterTestInfo();
     testInfo.TestName = testName.Name;
     testInfo.FullyQualifiedTestClassName = testName.FullName;
     testInfo.Status = ReporterTestInfo.TestStatus.success;
     report.StartTest(testInfo);
     testStopwatch = new Stopwatch();
     testStopwatch.Start();
 }
Пример #9
0
 public override void StartTest(ReporterTestInfo testInfo)
 {
     base.StartTest(testInfo);
     if (!enabled)
     {
         return;
     }
     try
     {
         recorder.StartRecording();
     }
     catch
     {
         enabled = false;
     }
 }
Пример #10
0
        public void BeforeAll()
        {
            report = ReportManager.Instance;

            TestContext.TestAdapter testAdapter = TestContext.CurrentContext.Test;

            testInfo = new ReporterTestInfo();

            testInfo.TestName = testAdapter.Name;
            testInfo.FullyQualifiedTestClassName = testAdapter.FullName;

            testInfo.Status = DifidoTestStatus.success;

            testStopwatch = new Stopwatch();
            testStopwatch.Start();

            report.StartTest(testInfo);
        }
Пример #11
0
        public void StartTest(ReporterTestInfo testInfo)
        {
            if (firstEntry)
            {
                try
                {
                    this.outputFolder = outputFolder + @"\ExcelReports\ExcelReport " + DateTime.Now.ToString(" MM-dd-yy.hh-mm-ss") + ".xlsx";
                    File.Copy(GetRootFolder() + @"/" + templateFolder, outputFolder);
                }
                catch
                {
                    string folderName = outputFolder2 + @"\ExcelReports";
                    System.IO.Directory.CreateDirectory(folderName);
                    this.outputFolder = outputFolder2 + @"\ExcelReports\ExcelReport" + DateTime.Now.ToString(" MM-dd-yy.hh-mm-ss") + ".xlsx";
                    File.Copy(GetRootFolder() + @"/" + templateFolder, outputFolder);
                }

                firstEntry = false;
            }
        }
        public virtual void StartTest(ReporterTestInfo testInfo)
        {
            currentTest           = new Test(testInfo.TestName);
            currentTest.timestamp = DateTime.Now.ToString("HH:mm:ss");
            currentTest.index     = index;
            string   scenarioName = testInfo.FullyQualifiedTestClassName.Split('.')[testInfo.FullyQualifiedTestClassName.Split('.').Length - 2];
            Scenario scenario;

            if (machine.IsChildWithNameExists(scenarioName))
            {
                scenario = (Scenario)machine.GetChildWithName(scenarioName);
            }
            else
            {
                scenario = new Scenario(scenarioName);
                machine.AddChild(scenario);
            }
            scenario.AddChild(currentTest);
            ExecutionToFile();
            testDetails             = new TestDetails(testInfo.TestName);
            testDetails.description = testInfo.FullyQualifiedTestClassName;
            testDetails.timestamp   = DateTime.Now.ToString();
        }
Пример #13
0
 public void StartTest(ReporterTestInfo testInfo)
 {
 }
 public void StartTest(ReporterTestInfo testInfo)
 {
     Print(divider);
     Print("[TEST START]: " + testInfo.TestName);
     Print(divider);
 }