Beispiel #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);
        }
Beispiel #2
0
        private void AddMissedTest(ITestResult result)
        {
            var testResult = new Allure.Commons.Model.TestResult
            {
                uuid      = result.Test.Id,
                historyId = result.Test.FullName,
                name      = result.Test.MethodName,
                fullName  = result.Test.FullName,
                labels    = new List <Label>
                {
                    Label.Suite(result.Test.ClassName),
                    Label.Thread(),
                    Label.Host(),
                    Label.TestClass(result.Test.ClassName),
                    Label.TestMethod(result.Test.MethodName),
                    Label.Package(result.Test.Fixture?.ToString() ?? result.Test.ClassName)
                },
                status        = GetNunitStatus(result.ResultState),
                statusDetails = new StatusDetails
                {
                    message = result.Message,
                    trace   = result.StackTrace
                }
            };

            Allure.StartTestCase(testResult);
            Allure.StopTestCase(result.Test.Id);
            Allure.WriteTestCase(result.Test.Id);
        }
Beispiel #3
0
        internal static void StartAllureLogging(ITest test, string testUuid, string testContainerUuid,
                                                TestFixture fixture)
        {
            var testFullNameForLog = GenerateFullNameWithParameters(test, test.FullName);
            var ourFixture         = new TestResultContainer
            {
                uuid = testContainerUuid,
                name = test.ClassName
            };

            AllureLifecycle.Instance.StartTestContainer(ourFixture);
            var testResult = new TestResult
            {
                uuid     = testUuid,
                name     = test.Name,
                fullName = testFullNameForLog,
                labels   = new List <Label>
                {
                    Label.Thread(),
                Label.Host(),
                Label.TestClass(test.ClassName),
                    Label.TestMethod(test.MethodName),
                    Label.Package(test.ClassName)
                },
                historyId     = testFullNameForLog,
                statusDetails = new StatusDetails()
            };

            AllureLifecycle.Instance.StartTestCase(testResult);
            AddInfoInTestCase(test, testUuid, fixture);
        }
Beispiel #4
0
        public void BeforeTest()
        {
            var nunitTest = TestExecutionContext.CurrentContext.CurrentTest;

            var testResult = new Allure.Commons.Model.TestResult
            {
                uuid      = nunitTest.Id,
                historyId = nunitTest.FullName,
                name      = nunitTest.MethodName,
                fullName  = nunitTest.FullName,
                labels    = new List <Label>
                {
                    Label.Suite(nunitTest.ClassName),
                    Label.Thread(),
                    Label.Host(),
                    Label.TestClass(nunitTest.ClassName),
                    Label.TestMethod(nunitTest.MethodName),
                    Label.Package(nunitTest.Fixture.ToString().Replace('+', '.'))
                }
            };

            Allure.StartTestCase(testResult);
            Browser.GetInstance().WindowMaximize();
        }