Class QtafTestNGCucumberContext

java.lang.Object
io.cucumber.testng.AbstractTestNGCucumberTests
de.qytera.qtaf.cucumber.context.QtafTestNGCucumberContext
All Implemented Interfaces:
IQtafTestContext

@Guice(modules=QtafModule.class) public class QtafTestNGCucumberContext extends io.cucumber.testng.AbstractTestNGCucumberTests implements IQtafTestContext
Cucumber Test Contexts. Cucumber runner classes need to extend this class
  • Field Details

    • config

      public static ConfigMap config
      Holds values from JSON configuration files.
    • driver

      public static org.openqa.selenium.WebDriver driver
      Web driver instance (chrome, firefox, ...).
    • testFeatureAnnotation

      protected TestFeature testFeatureAnnotation
      Page object annotation reference.
    • testSuiteLogCollection

      public static final TestSuiteLogCollection testSuiteLogCollection
      Global log collection that holds all log messages from the tests.
    • logCollection

      protected TestScenarioLogCollection logCollection
      Log collection for the current method.
    • testFeatureLogCollection

      protected TestFeatureLogCollection testFeatureLogCollection
      Log collection for all methods in this class.
  • Constructor Details

    • QtafTestNGCucumberContext

      public QtafTestNGCucumberContext()
      Constructor with initialization.
    • QtafTestNGCucumberContext

      public QtafTestNGCucumberContext(boolean shallInitialize)
      Constructor with optional initialization.
      Parameters:
      shallInitialize - Whether test context should be initialized or not
  • Method Details

    • restartDriver

      public void restartDriver()
      Description copied from interface: IQtafTestContext
      Destroys the current browser and starts a new one.
      Specified by:
      restartDriver in interface IQtafTestContext
    • initialize

      public final QtafTestNGCucumberContext initialize()
      Description copied from interface: IQtafTestContext
      Initialize test context.
      Specified by:
      initialize in interface IQtafTestContext
      Returns:
      this
    • getLogCollection

      public TestScenarioLogCollection getLogCollection()
      Description copied from interface: IQtafTestContext
      Get current log collection.
      Specified by:
      getLogCollection in interface IQtafTestContext
      Returns:
      log collection
    • setLogCollection

      public IQtafTestContext setLogCollection(TestScenarioLogCollection collection)
      Description copied from interface: IQtafTestContext
      Set the current log collection.
      Specified by:
      setLogCollection in interface IQtafTestContext
      Parameters:
      collection - log collection
      Returns:
      this
    • addLoggerToFieldsRecursively

      public void addLoggerToFieldsRecursively()
      Description copied from interface: IQtafTestContext
      Add logger to all instance fields.
      Specified by:
      addLoggerToFieldsRecursively in interface IQtafTestContext
    • initializeTest

      public void initializeTest(io.cucumber.java.Scenario scenario)
      Before hooks run before the first step of each scenario.
      Parameters:
      scenario - the scenario
    • shallRun

      public boolean shallRun(QTAFCucumberScenarioEntity scenarioEntity)
      Method that check if a scenario shall run or not.
      Parameters:
      scenarioEntity - Scenario entity object
      Returns:
      true if scenario shall run, false otherwise
    • scenarios

      @DataProvider(parallel=false) public Object[][] scenarios()
      Method that loads and provides Cucumber Scenario entities.
      Overrides:
      scenarios in class io.cucumber.testng.AbstractTestNGCucumberTests
      Returns:
      Cucumber scenario entities
    • runScenario

      public void runScenario(io.cucumber.testng.PickleWrapper pickleWrapper, io.cucumber.testng.FeatureWrapper featureWrapper)
      TestNG test that executes all cucumber scenarios.
      Overrides:
      runScenario in class io.cucumber.testng.AbstractTestNGCucumberTests
      Parameters:
      pickleWrapper - Cucumber scenario entity wrapper
      featureWrapper - Cucumber feature entity wrapper
    • onBeforeScenario

      protected void onBeforeScenario(QTAFCucumberScenarioEntity scenarioEntity)
      Method that runs before each scenario.
      Parameters:
      scenarioEntity - Entity object that holds information about feature and scenario that gets executed
    • beforeStep

      public void beforeStep(io.cucumber.java.Scenario scenario)
      Step hooks invoked before and after a step.
      Parameters:
      scenario - the scenario
    • afterStep

      public void afterStep(io.cucumber.java.Scenario scenario)
      Step hooks invoked before and after a step.
      Parameters:
      scenario - the scenario
    • embedScreenshot

      public void embedScreenshot(io.cucumber.java.Scenario scenario)
      After hooks run after the last step of each scenario, even when the step result is failed, undefined, pending, or skipped.
      Parameters:
      scenario - the scenario