Esempio n. 1
0
 public void TestStarted(TestRunDto testRun)
 {
     Action.Safe(() =>
     {
         TestRunsRepository.AddNewTestRun(testRun);
     });
 }
Esempio n. 2
0
 public void TestStarted(TestRunDto testRun)
 {
     Action.Safe(() =>
     {
         TestRunsRepository.AddNewTestRun(testRun);
         Logger.Info($"Test '{testRun.Name}' (Guid: {testRun.TestInfo.Guid}) started");
     });
 }
Esempio n. 3
0
 private void InitializeOnRunStarted(DateTime startDateTime)
 {
     Action.Safe(() =>
     {
         RunRepository.OnRunStarted(ReporterSettings, startDateTime);
         TestRunsRepository.OnRunStarted();
         ResourceExtractor.ExtractReportBase(ReporterSettings.OutputPath);
         DataService.SaveReportSettings(ReportSettings);
     });
 }
Esempio n. 4
0
 private void OnTestFinish(TestRunDto testDtoWhenFinished)
 {
     Action.Safe(() =>
     {
         RunRepository.OnTestFinished(testDtoWhenFinished);
         var testDtoWhenStarted = TestRunsRepository.ExtractCorrespondingTestRun(testDtoWhenFinished);
         var finalTest          = TestRunProcessor.Process(testDtoWhenStarted, testDtoWhenFinished, RunRepository.RunGuid);
         DataService.SaveTestRun(finalTest);
     });
 }
Esempio n. 5
0
 private void OnTestFinish(TestRunDto testDtoWhenFinished, TestOutputDto testOutputDto)
 {
     Action.Safe(() =>
     {
         RunRepository.OnTestFinished(testDtoWhenFinished);
         var testDtoWhenStarted = TestRunsRepository.ExtractCorrespondingTestRun(testDtoWhenFinished);
         var finalTest          = TestRunProcessor.Process(testDtoWhenStarted, testDtoWhenFinished, RunRepository.RunGuid);
         Logger.Debug($"Saving test run '{finalTest.Name}' (Guid: {finalTest.TestInfo.Guid})");
         DataWriterService.SaveTestRun(finalTest, testOutputDto);
     });
 }
Esempio n. 6
0
 private void InitializeOnRunStarted(DateTime startDateTime)
 {
     Action.Safe(() =>
     {
         Logger.Debug("Reporter is initializing on run start...");
         RunRepository.OnRunStarted(ReporterSettings, startDateTime);
         TestRunsRepository.OnRunStarted();
         ResourceExtractor.ExtractReportBase(ReporterSettings.OutputPath);
         DataWriterService.SaveReportSettings(ReportSettings);
         Logger.Debug($"Reporter initializing done. Output folder is '{ReporterSettings.OutputPath}'. " +
                      $"Data service file: '{ReporterSettings.DataServiceFile}', Logger file: '{ReporterSettings.LoggerFile}'");
     });
 }
        public void ExtractWithNoTestsInRepository()
        {
            var guid       = Guid.Parse("66e6f6ba-5b35-475a-a617-394696331f11");
            var dto        = new TestRunDto(guid, "Cool test", "Cool test full name");
            var repository = new TestRunsRepository();

            repository.OnRunStarted();
            var extractedDto = repository.ExtractCorrespondingTestRun(dto);

            Assert.AreEqual(extractedDto.TestInfo.Guid, Guid.Empty);
            Assert.AreEqual(extractedDto.FullName, "");
            Assert.AreEqual(extractedDto.Name, "");
        }
        public void ExtractWithOneTestInRepository()
        {
            var guid       = Guid.Parse("66e6f6ba-5b35-475a-a617-394696331f11");
            var dto        = new TestRunDto(guid, "Cool test", "Cool test full name");
            var repository = new TestRunsRepository();

            repository.OnRunStarted();
            Assert.DoesNotThrow(() => repository.AddNewTestRun(dto));
            var extractedDto = repository.ExtractCorrespondingTestRun(dto);

            Assert.AreEqual(dto.TestInfo.Guid, extractedDto.TestInfo.Guid);
            Assert.AreEqual(dto.FullName, extractedDto.FullName);
            Assert.AreEqual(dto.Name, extractedDto.Name);
        }
        public void ExtractWithTwoTestsInRepositoryByGuid()
        {
            var guid1      = Guid.Parse("66e6f6ba-5b35-475a-a617-394696331f11");
            var guid2      = Guid.Parse("66e6f6ba-5b35-475a-a617-394696331f12");
            var dto1       = new TestRunDto(guid1, "Cool test 1", "Cool test full name 1");
            var dto2       = new TestRunDto(guid2, "Cool test 2", "Cool test full name 2");
            var repository = new TestRunsRepository();

            repository.OnRunStarted();
            Assert.DoesNotThrow(() => repository.AddNewTestRun(dto1));
            Assert.DoesNotThrow(() => repository.AddNewTestRun(dto2));
            var extractedDto = repository.ExtractCorrespondingTestRun(new TestRunDto(guid1));

            Assert.AreEqual(guid1, extractedDto.TestInfo.Guid);
            Assert.AreEqual(dto1.FullName, extractedDto.FullName);
            Assert.AreEqual(dto1.Name, extractedDto.Name);
        }
        public void NewRepositoryThrowsExceptionOnAddExtractTest()
        {
            var repository = new TestRunsRepository();

            Assert.Throws <ArgumentNullException>(() => repository.ExtractCorrespondingTestRun(new TestRunDto()));
        }
        public void NewRepositoryThrowsExceptionOnAddNewTest()
        {
            var repository = new TestRunsRepository();

            Assert.Throws <NullReferenceException>(() => repository.AddNewTestRun(new TestRunDto()));
        }