Exemplo n.º 1
0
        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();
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 5
0
        public void AddScenarioName(ScenarioContext scenarioContext)
        {
            _scenario = _featureName.CreateNode <Scenario>(scenarioContext.ScenarioInfo.Title).AssignCategory(scenarioContext.ScenarioInfo.Tags);

            ExtentTestManager.CreateMethod(_featureContextName.FeatureInfo.Title, scenarioContext.ScenarioInfo.Title);
        }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 9
0
 public void BeforeTestMethod()
 {
     testName = TestContext.CurrentContext.Test.MethodName;
     test     = ExtentTestManager.CreateMethod(testName);
 }