Class HookGSpec

    • Constructor Summary

      Constructors 
      Constructor Description
      HookGSpec​(CommonG spec)
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activateLogLevel​(io.cucumber.java.Scenario scenario)
      Changes the logging level of the log4j logger used in the specs package to the given value
      void addCapabilitiesFromFile​(String filePath, org.openqa.selenium.MutableCapabilities capabilities)  
      void AppiumSetup​(io.cucumber.java.Scenario scenario)
      If the feature has the @mobile annotation, creates a new Appium driver before each scenario.
      void deactivateLogLevel()
      Returns logging level back to default value (WARN)
      void globalSetup​(io.cucumber.java.Scenario scenario)
      Clean the exception list before each scenario.
      void ignoreTag​(io.cucumber.java.Scenario scenario)
      Skips an scenario/feature if it contains the @ignore tag
      void runOnEnvTag​(io.cucumber.java.Scenario scenario)
      Allows conditional scenario execution using @skipOnEnv and @runOnEnv tags
      void seleniumSetup​(io.cucumber.java.Scenario scenario)
      If the feature has the @web annotation, creates a new selenium web driver before each scenario.
      void seleniumTeardown​(io.cucumber.java.Scenario scenario)
      If the feature has the @web or @mobile annotation, closes selenium web driver after each scenario is completed.
      void teardown​(io.cucumber.java.Scenario scenario)
      Checks if the scenario contains any reference to a Jira ticket and will try to update its status based on the result of the scenario execution.
    • Constructor Detail

      • HookGSpec

        public HookGSpec​(CommonG spec)
        Default constructor.
        Parameters:
        spec - commonG object
    • Method Detail

      • globalSetup

        public void globalSetup​(io.cucumber.java.Scenario scenario)
        Clean the exception list before each scenario.
        Parameters:
        scenario - scenario reference
      • seleniumSetup

        public void seleniumSetup​(io.cucumber.java.Scenario scenario)
                           throws Exception
        If the feature has the @web annotation, creates a new selenium web driver before each scenario. This method allows the configuration of certain capabilities for the initialization of the driver, specifically, the ones used by selenium for browser selection: browserName, platform, version. These variables should be passed as VM arguments (-DbrowserName, -Dplatform, -Dversion). Additionally, then using a selenium grid (-DSELENIUM_GRID), the user can use the VM argument -DCAPABILITIES=/path/to/capabilities.json, to override the default capabilities with the ones from the json file
        Parameters:
        scenario - Scenario
        Throws:
        MalformedURLException - MalformedURLException
        Exception
      • AppiumSetup

        public void AppiumSetup​(io.cucumber.java.Scenario scenario)
                         throws IOException
        If the feature has the @mobile annotation, creates a new Appium driver before each scenario. By default, the system will try to create a set of default capabilities for the driver. However, the user can set any of the general capabilities of Appium (i.e. -Dapp=/path/to/app, -DplatformName=android, etc). The user can use the VM argument -DCAPABILITIES=/path/to/capabilities.json, to override the default capabilities with the ones from the json file
        Parameters:
        scenario - Scenario
        Throws:
        MalformedURLException - MalformedURLException
        IOException
      • addCapabilitiesFromFile

        public void addCapabilitiesFromFile​(String filePath,
                                            org.openqa.selenium.MutableCapabilities capabilities)
                                     throws IOException
        Throws:
        IOException
      • seleniumTeardown

        public void seleniumTeardown​(io.cucumber.java.Scenario scenario)
        If the feature has the @web or @mobile annotation, closes selenium web driver after each scenario is completed.
        Parameters:
        scenario - Instance of the scenario just executed
      • teardown

        public void teardown​(io.cucumber.java.Scenario scenario)
                      throws com.slack.api.methods.SlackApiException,
                             IOException,
                             SQLException
        Checks if the scenario contains any reference to a Jira ticket and will try to update its status based on the result of the scenario execution. Checks if there's any reference to a Slack channel and sends a notification to that channel if the scenario failed Closes any remaining SSH connection
        Parameters:
        scenario - Scenario
        Throws:
        com.slack.api.methods.SlackApiException - SlackApiException
        IOException - IOException
        SQLException - SQLException
      • activateLogLevel

        public void activateLogLevel​(io.cucumber.java.Scenario scenario)
        Changes the logging level of the log4j logger used in the specs package to the given value
        Parameters:
        scenario - Scenario
      • deactivateLogLevel

        public void deactivateLogLevel()
        Returns logging level back to default value (WARN)
      • ignoreTag

        public void ignoreTag​(io.cucumber.java.Scenario scenario)
        Skips an scenario/feature if it contains the @ignore tag
        Parameters:
        scenario - Scenario
      • runOnEnvTag

        public void runOnEnvTag​(io.cucumber.java.Scenario scenario)
                         throws Exception
        Allows conditional scenario execution using @skipOnEnv and @runOnEnv tags
         
              \@runOnEnv(param1,param2,param3,..): The scenario will only be executed if ALL the params are defined.
              \@skipOnEnv(param1,param2,param3,..) The scenario will be omitted if ANY of params are defined.
         
        Parameters:
        scenario - Scenario
        Throws:
        Exception - Exception