private async Task <RunOutcome> ProcessTestRunStep(TestRunStep step, TestReadModel test, TestRunReadModel testRun) { _processingRunData.CurrentTestStep = step; _processingRunData.CurrentTestStepIndex = TestRunStepHelper.GetStepIndex(step); SendRunData(); var started = DateTime.Now; var items = new List <TestRunStepItem>(); switch (step) { case TestRunStep.GenerateInputFiles: items = await GenerateInputFiles(test, testRun); break; case TestRunStep.GenerateExeOutputFiles: items = await GenerateExeOutputFiles(test, testRun); break; case TestRunStep.GenerateCilAntroOutputFiles: items = await GenerateCilAntroOutputFiles(test, testRun); break; case TestRunStep.CompareOutputFiles: items = await CompareOutputs(test, testRun); break; } _processingRunData.CurrentItemIndex = null; _processingRunData.CurrentItemName = null; SendRunData(); var finished = DateTime.Now; var outcome = items.All(i => i.Outcome == RunOutcome.Ok) ? RunOutcome.Ok : RunOutcome.Wrong; var newStepInfo = new TestRunStepInfo { Id = Guid.NewGuid(), ProcessedForMilliseconds = (int)(finished - started).TotalMilliseconds, Step = step, TestRunId = testRun.Id, Items = items, Outcome = outcome }; using (var scope = _serviceScopeFactory.CreateScope()) { var stepsRepository = scope.ServiceProvider.GetRequiredService <AppKeyRepository <TestRunStepInfo> >(); await stepsRepository.CreateAsync(newStepInfo); } return(outcome); }
public void LogResult_SupportFormattingCharacters() { var config = BuildConfiguration.CreateInstance(); var step = new TestRunStep(); var resultFailure = RunStepResult.Failure(config, step, @"{}{{}}{0}{s}%s%%\s±@£¢¤¬¦²³¼½¾"); Assert.DoesNotThrow(() => { LogAssert.Expect(LogType.Error, new Regex(@"Run.* failed\.\n.+")); resultFailure.LogResult(); }); }
public static TestRunStep?GetNextStep(TestRunStep step) { switch (step) { case TestRunStep.GenerateInputFiles: return(TestRunStep.GenerateExeOutputFiles); case TestRunStep.GenerateExeOutputFiles: return(TestRunStep.GenerateCilAntroOutputFiles); case TestRunStep.GenerateCilAntroOutputFiles: return(TestRunStep.CompareOutputFiles); default: return(null); } }
public static int GetStepIndex(TestRunStep step) { return(GetAllSteps().IndexOf(step)); }