private async Task ExecuteTestCaseAsync(TestCase testCase) { var correlationId = Correlation.GetTickBasedId(); using var scope = _logger.BeginScope(correlationId); _logger.LogDebug("Starting processing test case [{0}]", testCase.Id); var isMuted = testCase.Contains(".muted"); if (isMuted) { _logger.LogDebug("Test is muted, not executing."); } var testResult = new TestCaseExecutionResult(testCase, isMuted); _results.Add(testResult); using var testCaseContext = CreateContext(testCase, correlationId, Options); var descriptionWriter = new XDocumentDescriptionWriter(testCaseContext.Logger); try { _customTestSession?.OnBegin(testCaseContext); await testCaseContext.ExecuteActionsAsync(_pipelineActionFactory, testCase.Actions, testCaseContext.Options.GetDeferExceptions(), _logger); } catch (Exception ex) { testCaseContext.Logger.LogError(ex, "an error occured"); testResult.MarkAsFailed(ex); } try { testResult.Description = testCaseContext.DescriptionWriter.GetContent(); _customTestSession?.OnFinish(testResult, testCaseContext.Logger); } catch (Exception ex) { testCaseContext.Logger.LogError(ex, "an error occured"); } _logger.LogDebug("Finished processing test case [{0}]", testCase.Id); }