Class StepFactory

java.lang.Object
net.thucydides.core.steps.StepFactory

public class StepFactory
extends java.lang.Object
Produces an instance of a set of requirement steps for use in the acceptance tests. Requirement steps navigate through pages using a WebDriver driver.
  • Constructor Summary

    Constructors 
    Constructor Description
    StepFactory()
    Create a new step factory without webdriver support.
    StepFactory​(Pages pages)
    Create a new step factory.
  • Method Summary

    Modifier and Type Method Description
    static StepFactory getFactory()  
    <T> T getNewCachedStepLibraryFor​(java.lang.Class<T> scenarioStepsClass)  
    <T> T getNewStepLibraryFor​(java.lang.Class<T> scenarioStepsClass)  
    <T> T getSharedStepLibraryFor​(java.lang.Class<T> scenarioStepsClass)
    Returns a new ScenarioSteps instance, of the specified type.
    <T> T getUniqueStepLibraryFor​(java.lang.Class<T> scenarioStepsClass)  
    <T> T getUniqueStepLibraryFor​(java.lang.Class<T> scenarioStepsClass, java.lang.Object... parameters)  
    <T> T instantiateNewStepLibraryFor​(java.lang.Class<T> scenarioStepsClass, boolean cacheNewInstance)
    Create a new instance of a class containing test steps.
    <T> T instantiateNewStepLibraryFor​(java.lang.Class<T> scenarioStepsClass, Interceptor interceptor, boolean useCache)
    Create a new instance of a class containing test steps using custom interceptors.
    static boolean isAssignableFrom​(java.lang.Object argument, java.lang.Class<?> parameterType)  
    void reset()  
    void usePageFactory​(Pages pages)  
    StepFactory usingPages​(Pages pages)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StepFactory

      public StepFactory​(Pages pages)
      Create a new step factory. All web-testing step factories need a Pages object, which is passed to ScenarioSteps objects when they are created.
    • StepFactory

      public StepFactory()
      Create a new step factory without webdriver support. This is to be used for non-webtest acceptance tests.
  • Method Details

    • getFactory

      public static StepFactory getFactory()
    • usingPages

      public StepFactory usingPages​(Pages pages)
    • getSharedStepLibraryFor

      public <T> T getSharedStepLibraryFor​(java.lang.Class<T> scenarioStepsClass)
      Returns a new ScenarioSteps instance, of the specified type. This is actually a proxy that allows reporting and screenshots to be performed at each step.
      Type Parameters:
      T - the scenario step class type
      Parameters:
      scenarioStepsClass - the scenario step class
      Returns:
      the instrumented step library
    • getNewStepLibraryFor

      public <T> T getNewStepLibraryFor​(java.lang.Class<T> scenarioStepsClass)
    • getNewCachedStepLibraryFor

      public <T> T getNewCachedStepLibraryFor​(java.lang.Class<T> scenarioStepsClass)
    • getUniqueStepLibraryFor

      public <T> T getUniqueStepLibraryFor​(java.lang.Class<T> scenarioStepsClass)
    • getUniqueStepLibraryFor

      public <T> T getUniqueStepLibraryFor​(java.lang.Class<T> scenarioStepsClass, java.lang.Object... parameters)
    • reset

      public void reset()
    • instantiateNewStepLibraryFor

      public <T> T instantiateNewStepLibraryFor​(java.lang.Class<T> scenarioStepsClass, boolean cacheNewInstance)
      Create a new instance of a class containing test steps. This method will instrument the class appropriately and inject any nested step libraries or other dependencies.
    • instantiateNewStepLibraryFor

      public <T> T instantiateNewStepLibraryFor​(java.lang.Class<T> scenarioStepsClass, Interceptor interceptor, boolean useCache)
      Create a new instance of a class containing test steps using custom interceptors.
    • usePageFactory

      public void usePageFactory​(Pages pages)
    • isAssignableFrom

      public static boolean isAssignableFrom​(java.lang.Object argument, java.lang.Class<?> parameterType)