-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestNgAnnotations6.java
More file actions
59 lines (50 loc) · 1.28 KB
/
TestNgAnnotations6.java
File metadata and controls
59 lines (50 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package TestNg;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.testng.annotations.BeforeMethod;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
public class TestNgAnnotations6 {
WebDriver driver;
@BeforeMethod
public void dbconnected()
{
System.out.println("Db is connected");
}
@Test(priority=1)
public void launchbrowser()
{
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
driver.manage().window().maximize();
System.out.println("Testcase 1 passed");
}
@Test(priority=2)
public void verifyfacebooktitle()
{
driver.get("https://www.facebook.com/");
String atitle = driver.getTitle();
Assert.assertEquals("www.facebook.com", atitle);
System.out.println("Testcase 2 passed");
}
@Test(priority=3)
public void verifytitle()
{
driver.get("https://www.w3schools.com/");
String atitle = driver.getTitle();
Assert.assertEquals("W3Schools Online Web Tutorials", atitle);
System.out.println("Testcase 3 passed");
}
@Test(priority=4)
public void closebrowser()
{
driver.close();
}
@AfterMethod
public void dbdisconnected()
{
System.out.println("Db is dsconnected");
}
}