Пример #1
0
        public void AddCompleteTestRun(ITestRun testRun)
        {
            _action.Safe(() =>
            {
                _currentRun.RunSummary.Total++;

                var finishDateTime = testRun.TestInfo.Finish;
                var testGuid       = testRun.TestInfo.Guid.ToString();
                var testPath       = Path.Combine(TestsPath, testGuid);
                var fileName       = finishDateTime.GetTestName();

                _currentRun.RunSummary = _currentRun.RunSummary.Update(testRun);

                testRun.TestInfo.FileName = fileName;
                testRun.RunGuid           = _currentRunGuid;
                testRun.TestInfo.Start    = testRun.TestInfo.Start.Equals(default(DateTime))
                    ? finishDateTime
                    : testRun.TestInfo.Start;
                testRun.TestInfo.Finish = testRun.TestInfo.Finish.Equals(default(DateTime))
                    ? finishDateTime
                    : testRun.TestInfo.Finish;
                testRun.TestDuration = testRun.TestDuration.Equals(0.0)
                    ? (testRun.TestInfo.Finish - testRun.TestInfo.Start).TotalSeconds
                    : testRun.TestDuration;
                testRun.Save(testPath, fileName);
                _currentRun.TestRunFiles.Add(Paths.GetRelativeTestRunPath(testGuid, fileName));

                TestRunsHelper.SaveCurrentTestInfo(testPath, testRun.TestInfo);
            });
        }
Пример #2
0
        public void TestFinished(ITestRun testRun)
        {
            lock (_lock)
            {
                _actionHelper.SafeAction(() =>
                {
                    _currentRun.RunSummary.Total++;

                    var finishDateTime = DateTime.Now;
                    var currentTest    = _currentTestRuns.GetTest(testRun);
                    var finalTest      = testRun.Update(currentTest);
                    var testGuid       = finalTest.TestInfo.Guid.ToString();
                    var testPath       = Path.Combine(TestsPath, testGuid);
                    var fileName       = finishDateTime.GetTestName();

                    _currentRun.RunSummary = _currentRun.RunSummary.Update(finalTest);

                    finalTest.TestInfo.FileName = fileName;
                    finalTest.RunGuid           = _currentRunGuid;
                    finalTest.TestInfo.Start    = finalTest.TestInfo.Start.Equals(default(DateTime))
                        ? finishDateTime
                        : finalTest.TestInfo.Start;
                    finalTest.TestInfo.Finish = finalTest.TestInfo.Finish.Equals(default(DateTime))
                        ? finishDateTime
                        : finalTest.TestInfo.Finish;
                    finalTest.TestDuration = finalTest.TestDuration.Equals(0.0)
                        ? (finalTest.TestInfo.Finish - finalTest.TestInfo.Start).TotalSeconds
                        : finalTest.TestDuration;
                    finalTest
                    .TakeScreenshot(testPath, TakeScreenshotAfterFail)
                    .Save(testPath, fileName);
                    _currentTestRuns.Remove(currentTest);
                    _currentRun.TestRunFiles.Add($"{testGuid}\\{fileName}");

                    TestRunsHelper.SaveCurrentTestInfo(testPath, finalTest.TestInfo);

                    if (RealTimeGeneration)
                    {
                        GenerateReport(DateTime.Now);
                    }
                });
            }
        }
Пример #3
0
        public void TestFinished(ITestRun testRun)
        {
            _action.Safe(() =>
            {
                _currentRun.RunSummary.Total++;

                var finishDateTime = DateTime.Now;
                var currentTest    = _currentTestRuns.GetTest(testRun);
                var finalTest      = testRun.Update(currentTest);
                var testGuid       = finalTest.TestInfo.Guid.ToString();
                var testPath       = Path.Combine(TestsPath, testGuid);
                var fileName       = finishDateTime.GetTestName();

                _currentRun.RunSummary = _currentRun.RunSummary.Update(finalTest);

                finalTest.TestInfo.FileName = fileName;
                finalTest.RunGuid           = _currentRunGuid;
                finalTest.TestInfo.Start    = finalTest.TestInfo.Start.Equals(default(DateTime))
                    ? finishDateTime
                    : finalTest.TestInfo.Start;
                finalTest.TestInfo.Finish = finalTest.TestInfo.Finish.Equals(default(DateTime))
                    ? finishDateTime
                    : finalTest.TestInfo.Finish;
                finalTest.TestDuration = finalTest.TestDuration.Equals(0.0)
                    ? (finalTest.TestInfo.Finish - finalTest.TestInfo.Start).TotalSeconds
                    : finalTest.TestDuration;
                finalTest
                .Save(testPath, fileName);
                _currentTestRuns.Remove(currentTest);
                _currentRun.TestRunFiles.Add(Paths.GetRelativeTestRunPath(testGuid, fileName));

                TestRunsHelper.SaveCurrentTestInfo(testPath, finalTest.TestInfo);

                if (Settings.RealTimeGeneration)
                {
                    GenerateReport(DateTime.Now);
                }
            });
        }