forked from naveenanimation20/SeleniumJavaCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestNgBasics.java
More file actions
115 lines (83 loc) · 2.22 KB
/
TestNgBasics.java
File metadata and controls
115 lines (83 loc) · 2.22 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package com.test;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class TestNgBasics {
// @BeforeSuite -- setup system property for chrome -- I
// @BeforeTest -- launchBrowser -- II
// @BeforeClass -- login to app --III
// @BeforeMethod -- enter URL --4
// @Test -- google logo test
// @AfterMethod -- logout from app
// @BeforeMethod -- enter URL
// @Test --- Google Title Test
// @AfterMethod -- logout from app
// @BeforeMethod -- enter URL
// @Test -- search test
// @AfterMethod -- logout from app
// @AfterClass -- Close Browser
// @AfterTest -- deleteAllCookies
//Pre-conditions annotations -- starting with @Before
@BeforeSuite //1
public void setUp(){
System.out.println("@BeforeSuite -- setup system property for chrome");
}
@BeforeTest //2
public void launchBrowser(){
System.out.println("@BeforeTest -- launchBrowser");
}
@BeforeClass //3
public void login(){
System.out.println("@BeforeClass -- login to app");
}
/*
* @BeforeMethod
* @Test -1
* @AfterMethod
*
* @BeforeMethod
* @Test -2
* @AfterMethod
*
* @BeforeMethos
* @Test -3
* @AfterMethod
*
*/
@BeforeMethod //4
public void enterURL(){
System.out.println("@BeforeMethod -- enter URL");
}
//test cases--starting with @Test
@Test //5
public void googleTitleTest(){
System.out.println("@Test --- Google Title Test");
}
@Test
public void searchTest(){
System.out.println("@Test -- search test");
}
@Test
public void googleLogoTest(){
System.out.println("@Test -- google logo test");
}
//post conditions -- starting with @After
@AfterMethod //6
public void logOut(){
System.out.println("@AfterMethod -- logout from app");
}
@AfterClass //7
public void closeBrowser(){
System.out.println("@AfterClass -- Close Browser");
}
@AfterTest //8
public void deleteAllCookies(){
System.out.println("@AfterTest -- deleteAllCookies");
}
}