Class SerenityRunner

java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
org.junit.runners.BlockJUnit4ClassRunner
net.serenitybdd.junit.runners.SerenityRunner
All Implemented Interfaces:
net.thucydides.model.tags.Taggable, org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Orderable, org.junit.runner.manipulation.Sortable

@Deprecated(since="5.0.0", forRemoval=true) public class SerenityRunner extends org.junit.runners.BlockJUnit4ClassRunner implements net.thucydides.model.tags.Taggable
Deprecated, for removal: This API element is subject to removal in a future version.
JUnit 4 support is deprecated and will be removed in Serenity 6.0.0. Please migrate to JUnit 5 using SerenityJUnit5Extension. JUnit 5 has been stable since 2017 and offers superior parallel execution, modern extension model, and better IDE support. See the Serenity documentation for migration guidance.
A test runner for WebDriver-based web tests. This test runner initializes a WebDriver instance before running the tests in their order of appearance. At the end of the tests, it closes and quits the WebDriver instance. The test runner will by default produce output in XML and HTML. This can extended by subscribing more reporter implementations to the test runner.
Author:
johnsmart
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    SerenityRunner(Class<?> klass, net.thucydides.core.webdriver.WebDriverFactory webDriverFactory)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    SerenityRunner(Class<?> klass, net.thucydides.core.webdriver.WebDriverFactory webDriverFactory, net.thucydides.core.webdriver.DriverConfiguration configuration)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    SerenityRunner(Class<?> klass, net.thucydides.core.webdriver.WebDriverFactory webDriverFactory, net.thucydides.core.webdriver.DriverConfiguration configuration, net.thucydides.model.batches.BatchManager batchManager)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    SerenityRunner(Class<?> klass, net.thucydides.core.webdriver.WebdriverManager webDriverManager, net.thucydides.core.webdriver.DriverConfiguration configuration, net.thucydides.model.batches.BatchManager batchManager)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    SerenityRunner(Class<?> klass, net.thucydides.model.batches.BatchManager batchManager)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected org.openqa.selenium.WebDriver
    driverFor(org.junit.runners.model.FrameworkMethod method)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected net.thucydides.model.batches.BatchManager
    Deprecated, for removal: This API element is subject to removal in a future version.
    Batch Manager used for running tests in parallel batches
    protected net.thucydides.core.webdriver.DriverConfiguration
    Deprecated, for removal: This API element is subject to removal in a future version.
    The Configuration class manages output directories and driver types.
    protected Collection<net.thucydides.model.reports.AcceptanceTestReporter>
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected org.openqa.selenium.WebDriver
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected org.openqa.selenium.WebDriver
    getDriver(String driver, String driverOptions)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    net.thucydides.core.pages.Pages
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
    The Step Listener observes and records what happens during the execution of the test.
    List<net.thucydides.model.domain.TestOutcome>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Find the current set of test outcomes produced by the test execution.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    initListenersUsing(net.thucydides.core.pages.Pages pageFactory)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Instantiates the @ManagedPages-annotated Pages instance using current WebDriver.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Instantiate the @Managed-annotated WebDriver instance with current WebDriver.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Instantiates the @ManagedPages-annotated Pages instance using current WebDriver.
    protected org.junit.runners.model.Statement
    methodInvoker(org.junit.runners.model.FrameworkMethod method, Object test)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Running a unit test, which represents a test scenario.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    run(org.junit.runner.notification.RunNotifier notifier)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Runs the tests in the acceptance test case.
    protected void
    runChild(org.junit.runners.model.FrameworkMethod method, org.junit.runner.notification.RunNotifier notifier)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    subscribeReporter(net.thucydides.model.reports.AcceptanceTestReporter reporter)
    Deprecated, for removal: This API element is subject to removal in a future version.
    To generate reports, different AcceptanceTestReporter instances need to subscribe to the listener.
    void
    useQualifier(String qualifier)
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner

    collectInitializationErrors, computeTestMethods, createTest, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout

    Methods inherited from class org.junit.runners.ParentRunner

    childrenInvoker, classBlock, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation

    Methods inherited from class org.junit.runner.Runner

    testCount

    Methods inherited from class java.lang.Object

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

    • SerenityRunner

      public SerenityRunner(Class<?> klass) throws org.junit.runners.model.InitializationError
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      org.junit.runners.model.InitializationError
    • SerenityRunner

      public SerenityRunner(Class<?> klass, net.thucydides.core.webdriver.WebDriverFactory webDriverFactory) throws org.junit.runners.model.InitializationError
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      org.junit.runners.model.InitializationError
    • SerenityRunner

      public SerenityRunner(Class<?> klass, net.thucydides.core.webdriver.WebDriverFactory webDriverFactory, net.thucydides.core.webdriver.DriverConfiguration configuration) throws org.junit.runners.model.InitializationError
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      org.junit.runners.model.InitializationError
    • SerenityRunner

      public SerenityRunner(Class<?> klass, net.thucydides.core.webdriver.WebDriverFactory webDriverFactory, net.thucydides.core.webdriver.DriverConfiguration configuration, net.thucydides.model.batches.BatchManager batchManager) throws org.junit.runners.model.InitializationError
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      org.junit.runners.model.InitializationError
    • SerenityRunner

      public SerenityRunner(Class<?> klass, net.thucydides.model.batches.BatchManager batchManager) throws org.junit.runners.model.InitializationError
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      org.junit.runners.model.InitializationError
    • SerenityRunner

      public SerenityRunner(Class<?> klass, net.thucydides.core.webdriver.WebdriverManager webDriverManager, net.thucydides.core.webdriver.DriverConfiguration configuration, net.thucydides.model.batches.BatchManager batchManager) throws org.junit.runners.model.InitializationError
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      org.junit.runners.model.InitializationError
  • Method Details

    • getPages

      public net.thucydides.core.pages.Pages getPages()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getConfiguration

      protected net.thucydides.core.webdriver.DriverConfiguration getConfiguration()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The Configuration class manages output directories and driver types. They can be defined as system values, or have sensible defaults.
      Returns:
      the current configuration
    • getBatchManager

      protected net.thucydides.model.batches.BatchManager getBatchManager()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Batch Manager used for running tests in parallel batches
      Returns:
      the current batch manager object
    • getOutputDirectory

      public File getOutputDirectory()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • subscribeReporter

      public void subscribeReporter(net.thucydides.model.reports.AcceptanceTestReporter reporter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      To generate reports, different AcceptanceTestReporter instances need to subscribe to the listener. The listener will tell them when the test is done, and the reporter can decide what to do.
      Parameters:
      reporter - an implementation of the AcceptanceTestReporter interface.
    • useQualifier

      public void useQualifier(String qualifier)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • run

      public void run(org.junit.runner.notification.RunNotifier notifier)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Runs the tests in the acceptance test case.
      Overrides:
      run in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
    • generateReports

      protected void generateReports()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getStepListener

      protected JUnitStepListener getStepListener()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The Step Listener observes and records what happens during the execution of the test. Once the test is over, the Step Listener can provide the acceptance test outcome in the form of an TestOutcome object.
      Returns:
      the current step listener
    • setStepListener

      protected void setStepListener(JUnitStepListener stepListener)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • initStepEventBus

      protected void initStepEventBus()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • initListenersUsing

      protected JUnitStepListener initListenersUsing(net.thucydides.core.pages.Pages pageFactory)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • initListeners

      protected JUnitStepListener initListeners()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • runChild

      protected void runChild(org.junit.runners.model.FrameworkMethod method, org.junit.runner.notification.RunNotifier notifier)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      runChild in class org.junit.runners.BlockJUnit4ClassRunner
    • additionalBrowserCleanup

      protected void additionalBrowserCleanup()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • prepareBrowserForTest

      protected void prepareBrowserForTest()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • methodInvoker

      protected org.junit.runners.model.Statement methodInvoker(org.junit.runners.model.FrameworkMethod method, Object test)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Running a unit test, which represents a test scenario.
      Overrides:
      methodInvoker in class org.junit.runners.BlockJUnit4ClassRunner
    • injectDriverInto

      protected void injectDriverInto(Object testCase)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Instantiate the @Managed-annotated WebDriver instance with current WebDriver.
      Parameters:
      testCase - A Serenity-annotated test class
    • driverFor

      protected org.openqa.selenium.WebDriver driverFor(org.junit.runners.model.FrameworkMethod method)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • injectScenarioStepsInto

      protected void injectScenarioStepsInto(Object testCase)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Instantiates the @ManagedPages-annotated Pages instance using current WebDriver.
      Parameters:
      testCase - A Serenity-annotated test class
    • injectAnnotatedPagesObjectInto

      protected void injectAnnotatedPagesObjectInto(Object testCase)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Instantiates the @ManagedPages-annotated Pages instance using current WebDriver.
      Parameters:
      testCase - A Serenity-annotated test class
    • injectEnvironmentVariablesInto

      protected void injectEnvironmentVariablesInto(Object testCase)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getDriver

      protected org.openqa.selenium.WebDriver getDriver()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getDriver

      protected org.openqa.selenium.WebDriver getDriver(String driver, String driverOptions)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getTestOutcomes

      public List<net.thucydides.model.domain.TestOutcome> getTestOutcomes()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Find the current set of test outcomes produced by the test execution.
      Returns:
      the current list of test outcomes
    • getDefaultReporters

      protected Collection<net.thucydides.model.reports.AcceptanceTestReporter> getDefaultReporters()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      The default reporters applicable for standard test runs.