当前位置:网站首页>[selenium automation] common notes

[selenium automation] common notes

2022-07-05 00:14:00 linrui7

Commonly used annotations

@Test
@BeforeMethod test Before method execution
@AfterMethod test After method execution
@BeforeClass After class initialization
@AfterClass Before class destruction

    static WebDriver webDriver;

    @Test
    public void test1() {
    
        System.out.println("Test");
    }

    @BeforeMethod
    public void test2() {
    
        webDriver = new ChromeDriver();
        System.out.println("BeforeMethod");
    }

    @AfterMethod
    public void test3() {
    
        webDriver.quit();
        System.out.println("AfterMethod");
    }

    @BeforeClass
    public void test4() {
    
        System.out.println("BeforeClass");
    }

    @AfterClass
    public void test5() {
    
        System.out.println("AfterClass");
    }

Execution results :
 Insert picture description here

原网站

版权声明
本文为[linrui7]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050008400157.html