Ejemplo n.º 1
0
        internal static TestResult StartTestCase(string containerId, FeatureContext featureContext,
                                                 ScenarioContext scenarioContext)
        {
            var featureInfo    = featureContext?.FeatureInfo ?? EmptyFeatureInfo;
            var scenarioInfo   = scenarioContext?.ScenarioInfo ?? EmptyScenarioInfo;
            var tags           = GetTags(featureInfo, scenarioInfo);
            var currentTest    = TestExecutionContext.CurrentContext.CurrentTest;
            var fullNameForLog = ReportHelper.GenerateFullNameWithParameters(currentTest, currentTest.FullName);
            var testResult     = new TestResult
            {
                uuid      = NewId(),
                historyId = fullNameForLog,
                name      = scenarioInfo.Title,
                fullName  = fullNameForLog,
                labels    = new List <Label>
                {
                    Label.Thread(),
                    string.IsNullOrWhiteSpace(AllureLifecycle.Instance.Config.Allure.Title)
                            ? Label.Host()
                            : Label.Host(AllureLifecycle.Instance.Config.Allure.Title),
                    Label.Feature(featureInfo.Title)
                }
                .Union(tags.Item1).ToList(),
                links = tags.Item2
            };

            AllureLifecycle.Instance.StartTestCase(containerId, testResult);
            scenarioContext?.Set(testResult);
            featureContext?.Get <HashSet <TestResult> >().Add(testResult);
            ReportHelper.AddToTestCaseParametersInfo(currentTest, testResult.uuid, new[] { -1 }, new[] { -1 });
            return(testResult);
        }