Skip to content

Latest commit

 

History

History

webdriverchecker-testng

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Java Maven GitHub Actions

WebDriverChecker for TestNG

Table of Contents

When using TestNG as a testing framework, webdriverchecker-testng should be used.

  • WebDriverChecker automatically get WebDriver instance from the current running test by using org.testng.ITestNGListener listener.
  • You don't need to pass the WebDriver instance to the argument of checker methods.
webdriverchecker webdriverchecker-testng
WebDriverChecker.isChrome(driver) WebDriverChecker.isChrome()

Declaration

Gradle

Add to build.gradle.

implementation("com.github.ngoanh2n:webdriverchecker-testng:2.9.0")

Maven

Add to pom.xml.

<dependency>
    <groupId>com.github.ngoanh2n</groupId>
    <artifactId>webdriverchecker-testng</artifactId>
    <version>2.9.0</version>
</dependency>

Test Structure

  1. Must declare a field of WebDriver type with any modifiers at current class or parent/abstract class.
  2. WebDriverChecker can detect WebDriver instance after the field is assigned a value.
public class MyTest {
    private WebDriver driver;

    @BeforeClass
    public void beforeClass() {
        driver = new ChromeDriver();
        // WebDriverChecker could find WebDriver instance from here.
        // WebDriverChecker.isChrome(driver) <=> WebDriverChecker.isChrome()
    }
}