private void ExtractTestContextData() { Type type = _testcontext.GetType(); FieldInfo method = type.GetField("test", BindingFlags.Instance | BindingFlags.NonPublic); ITest test = (ITest)method.GetValue(_testcontext); TestMethodName = test.DisplayName; TestClassName = TypeDescriptor.GetClassName(this); parentTest = ExtentTestManager.CreateTest(TestClassName, test.TestCase.Traits["Description"].First()); testReporter = ExtentTestManager.CreateMethod(TestMethodName); }
public virtual void StartDriver() { TestAdapter currentTest = CurrentContext.Test; childTest = ExtentTestManager.CreateMethod(parentTest.Model.Name, $"{currentTest.Name}"); DriverManager.StartDriver(TestConfig.Browser); Driver = DriverManager.GetDriver(); HomePage homePage = new HomePage(Driver); homePage.Open(); }
public Class1(ClassFixture fixture, ITestOutputHelper output) { _output = output; Type type = output.GetType(); FieldInfo method = type.GetField("test", BindingFlags.Instance | BindingFlags.NonPublic); ITest test = (ITest)method.GetValue(output); output.WriteLine($"Test Name is {test.DisplayName}"); output.WriteLine($"Class name is {TypeDescriptor.GetClassName(this)}"); testReporter = ExtentTestManager.CreateMethod(test.DisplayName); }
public void InsertReportingStepsBefore(ScenarioContext scenarioContext) { var stepType = scenarioContext.StepContext.StepInfo.StepDefinitionType; var scenarioTitle = _scenario.Model.Name; var step = scenarioContext.StepContext.StepInfo.Text; switch (stepType) { case StepDefinitionType.Given: ExtentTestManager.CreateMethod(scenarioTitle, new GherkinKeyword("Given"), step); break; case StepDefinitionType.When: ExtentTestManager.CreateMethod(scenarioTitle, new GherkinKeyword("When"), step); break; case StepDefinitionType.Then: ExtentTestManager.CreateMethod(scenarioTitle, new GherkinKeyword("Then"), step); break; default: break; } }
public void AddScenarioName(ScenarioContext scenarioContext) { _scenario = _featureName.CreateNode <Scenario>(scenarioContext.ScenarioInfo.Title).AssignCategory(scenarioContext.ScenarioInfo.Tags); ExtentTestManager.CreateMethod(_featureContextName.FeatureInfo.Title, scenarioContext.ScenarioInfo.Title); }
public static void BeforeFeature(FeatureContext featureContextInject) { ExtentTestManager.CreateMethod(featureContextInject.FeatureInfo.Title, "1"); }
public void BeforeTest() { ExtentTestManager.CreateMethod(GetType().Name, TestContext.CurrentContext.Test.Name); //ExtentTestManager.GetTest(); }
public void CreateTestMethod(ScenarioContext scenarioContext) { _scenario = ExtentTestManager.CreateMethod(_feature.Model.Name, new GherkinKeyword("Scenario"), scenarioContext.ScenarioInfo.Title); }
public void BeforeTestMethod() { testName = TestContext.CurrentContext.Test.MethodName; test = ExtentTestManager.CreateMethod(testName); }