-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestNgAnnotations5.java
66 lines (55 loc) · 1.4 KB
/
TestNgAnnotations5.java
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
60
61
62
63
64
65
66
package TestNg;
import org.junit.Assert;
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.annotations.AfterMethod;
public class TestNgAnnotations5 {
WebDriver driver;
@BeforeMethod
public void dbconnect()
{
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("Test case 1 passed");
}
@Test(priority=2)
public void verifythegoogletitle()
{
driver.get("https://www.google.co.in/");
Assert.assertEquals("Google", driver.getTitle());
System.out.println("Test case 1 passed");
}
@Test(priority=3)
public void verifyseleniumTitle()
{
driver.get("https://www.selenium.dev/");
Assert.assertEquals("Selenium", driver.getTitle());
System.out.println("Test case 2 passed");
}
@Test(priority=4)
public void verifyyoutubeTitle()
{
driver.get("https://www.youtube.com/");
Assert.assertEquals("YouTube", driver.getTitle());
System.out.println("Test case 3 passed");
}
@Test(priority=5)
public void closebrowser()
{
driver.close();
}
@AfterMethod
public void Dbdisconnected()
{
System.out.println("Db is disconnetd");
}
}