Class BaseAbstractTest

java.lang.Object
com.version1.tests.BaseAbstractTest

public abstract class BaseAbstractTest extends Object
BaseAbstractTest to handle things that testers shouldn't need to worry about (like starting up a WebDriver instance and getting everything in the right space for consumers to run tests that are correctly configured etc).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static ResultsManager
     
    protected org.openqa.selenium.support.events.EventFiringWebDriver
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    This will run before every test class.
    Provides a test ID that can be used to identify the test
    void
    This will run before EVERY @Test that extends this class The method will create a new instance of WebDriver and a browser and open Google.com This ensures we always have a fresh browser window and a guaranteed starting point
    void
    This will run after EVERY @Test that extends this class The method will close the current browser and WebDriver instance down This ensures we have cleaned up after ourselves (this happens even if the test fails)

    Methods inherited from class java.lang.Object

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

    • webDriver

      protected org.openqa.selenium.support.events.EventFiringWebDriver webDriver
    • resultsManager

      protected static ResultsManager resultsManager
  • Constructor Details

    • BaseAbstractTest

      public BaseAbstractTest()
  • Method Details

    • beforeAll

      @BeforeAll public static void beforeAll()
      This will run before every test class. This method gets the configuration and constructs the WebDriver instance, the screenshot directory and the makes these items accessible.
    • setUp

      @BeforeEach public void setUp() throws IOException
      This will run before EVERY @Test that extends this class The method will create a new instance of WebDriver and a browser and open Google.com This ensures we always have a fresh browser window and a guaranteed starting point
      Throws:
      IOException - if results directory isn't created or config file cannot be found
    • tearDown

      @AfterEach public void tearDown()
      This will run after EVERY @Test that extends this class The method will close the current browser and WebDriver instance down This ensures we have cleaned up after ourselves (this happens even if the test fails)
    • getTestId

      public String getTestId()
      Provides a test ID that can be used to identify the test
      Returns: