Skip to content

Files

Latest commit

raveerocksanirudha13Ethan0507MadCoder200OK
Nov 19, 2021
e2fafd9 · Nov 19, 2021

History

History

webdriver-framework-junit5

Webdriver Framework JUnit5

A library that contains the glue code and the necessary instructions for using webdriver-framework-core with the JUnit5 hooks. This library also contains JUnit5 specific code for managing the lifecycle of the WebDriver with Test Method.

Integration Instructions

This is the JUnit5 specific framework library intended to be used by developers who are using JUnit5 as their Testing framework. The steps to include this into your code is as follows,

  1. Add the library dependency to your pom.xml.
<dependency>
  <groupId>com.browserstack</groupId>
  <artifactId>webdriver-framework-junit5</artifactId>
  <version>LATEST</version>
</dependency>
  1. Create Webdriver Test: Create your test methods with Webdriver as a parameter.
public class SampleTest {

   public void test (WebDriver webDriver) {
      ...
   }
   
}
  1. Annotate your tests with @WebDriverTest Annotations: This will inject Webdrivers based on your configuration files.
public class SampleTest {
    
   @WebDriverTest
   public void test (WebDriver webDriver) {
      ...
   }
   
}
  1. To ensure that the WebDriver instances are stopped when the test is completed, a Test Watcher is provided as part of this library

The TestWatcher class is responsible for,

  • Marking the tests as pass/fail along with the appropriate error messages.

  • Quitting the WebDriver instance such that the test session on BrowserStack also is ended cleanly.