1- # Automation Framework Selenium Java with TestNG building by Anh Tester (VERSION 1.3)
1+ # Automation Framework Selenium Java with TestNG building by Anh Tester
2+
3+ ** SOME FEATURES IN FRAMEWORK**
24
3- ** SOME FEATURES IN VERSION 1.3**
451 . Run the parallel test case
562 . Read Object web element from a properties file
673 . Extent Report
12139 . Base function in the package: utils, helpers
131410 . Read data from Json file
141511 . Main Keyword: WebUI (call common function)
15-
16-
16+ 12 . Sample test function
17+
1718## ** SYSTEM REQUIREMENTS**
19+
1820- ** JDK 11, 15, 16** (not run with 8, 17, 18)
1921- Chrome Browser, Edge Browser
2022- Setup ** Allure** :
21- https://mvnrepository.com/artifact/io.qameta.allure/allure-java-commons
22- or
23- https://anhtester.com/blog/selenium-java/selenium-java-tai-nguyen-cai-dat-moi-truong )
24- Download jar and setting Variable Environment as Java JDK
25-
26- ![ image] ( https://user-images.githubusercontent.com/87883620/161661705-b8706957-5a26-4faf-8ddf-2f9aef78418e.png )
23+ https://mvnrepository.com/artifact/io.qameta.allure/allure-java-commons
24+ or
25+ https://anhtester.com/blog/selenium-java/selenium-java-tai-nguyen-cai-dat-moi-truong )
26+ Download jar and setting Variable Environment as Java JDK
27+
28+ ![ image] ( https://user-images.githubusercontent.com/87883620/161661705-b8706957-5a26-4faf-8ddf-2f9aef78418e.png )
2729
2830- ** IntelliJ** is the best choice (to change JDK version)
2931
3032![ image] ( https://user-images.githubusercontent.com/87883620/161707184-7ad558f2-0d7d-4851-bfd6-2796d4e46593.png )
3133
32-
33-
3434## ** HOW TO USE**
3535
36-
3736** 1. Run parallel the test case**
37+
3838- Run test case in suite XML (** src/test/resources/suites/** )
3939- Run test case from Maven pom.xml file
4040 (** mvn clean test** )
41-
42- ![ image] ( https://user-images.githubusercontent.com/87883620/161658761-5040e527-b410-46b3-8697-3298523e201d.png )
43-
4441
42+ ![ image] ( https://user-images.githubusercontent.com/87883620/161658761-5040e527-b410-46b3-8697-3298523e201d.png )
4543
4644** 2. Read Object web element from a properties file**
4745
4846![ image] ( https://user-images.githubusercontent.com/87883620/161658681-58f3a183-cbfd-433d-853a-927e4373f51c.png )
4947
50-
51-
5248** 3. Extent Report**
49+
5350- Insert Framework Annotation as sample:
5451
5552![ image] ( https://user-images.githubusercontent.com/87883620/161657646-3dd652c6-a310-4006-a0cb-de63e2e87e36.png )
5956
6057![ image] ( https://user-images.githubusercontent.com/87883620/161657754-c29b1ee9-f2fb-44b3-bee0-9f425a7cab6f.png )
6158
62-
63-
6459** 4. Allure Report**
6560
66- - Open Terminal: *** allure serve target/allure-results * **
61+ - Open Terminal: ** _ allure serve target/allure-results _ **
6762
6863![ image] ( https://user-images.githubusercontent.com/87883620/161662507-9e4dc698-e452-4b43-a4f5-9808c81419a2.png )
6964
70-
71- - Insert ** @Step ("title/message")** above *** @Test *** or any *** Method*** in the project
65+ - Insert ** @Step ("title/message")** above ** _ @Test_ ** or any ** _ Method_ ** in the project
7266- (As sample picture above step 3)
7367
7468![ image] ( https://user-images.githubusercontent.com/87883620/161657680-af29973d-4e52-451f-b1d6-40b12d182845.png )
7569
7670![ image] ( https://user-images.githubusercontent.com/87883620/161657689-10365747-ed8f-4ca8-9d84-8060514f216b.png )
7771
78-
79-
8072** 5. Send Mail after the run test**
8173
8274- Config ** true/false** in config.properties
83- (*** src /test/resources/config/config.properties * ** )
75+ (** _ src /test/resources/config/config.properties _ ** )
8476- send_email_to_users=** true** is enable send mail
85- - Config mail with email and password in *** src /main/java/anhtester/com/mail/EmailConfig.java * **
86- Note: enabled Allow less secure apps
77+ - Config mail with email and password in ** _ src /main/java/anhtester/com/mail/EmailConfig.java _ **
78+ Note: enabled Allow less secure apps
8779
8880![ image] ( https://user-images.githubusercontent.com/87883620/161658851-2aa41091-ac99-45d9-a79f-aaa828052efb.png )
8981
9082![ image] ( https://user-images.githubusercontent.com/87883620/161659238-88337f69-b742-4cd7-87f2-76670519c8dd.png )
9183
9284![ image] ( https://user-images.githubusercontent.com/87883620/161710836-8f3eee7c-19ba-410d-8498-5f314e6289a5.png )
9385
94-
95-
9686** 6. Log to file**
9787
98- - Call class: Log.info , Log.pass, Log.error,... (** Log** is a custom global class from Log4j)
99- (*** import anhtester.com.utils.Log.java*** )
100-
101- ![ image] ( https://user-images.githubusercontent.com/87883620/161657858-d333ac1d-9e7b-4c1b-baac-151a237a1fa0.png )
102-
88+ - Call class: Log.info , Log.pass, Log.error,... (** Log** is a custom global class from Log4j2)
89+ (** _ import anhtester.com.utils.Log.java_ ** )
10390
91+ ![ image] ( https://user-images.githubusercontent.com/87883620/161657858-d333ac1d-9e7b-4c1b-baac-151a237a1fa0.png )
10492
10593** 7. Record video and Screenshot**
10694
107- - Setup in *** config.properties*** file
108- (*** src/test/resources/config/config.properties*** )
109- screenshot_passed_steps=yes or no
110- screenshot_failed_steps=yes or no
111- screenshot_skipped_steps=yes or no
112-
113- ![ image] ( https://user-images.githubusercontent.com/87883620/161657881-5235139a-9982-43c0-ac37-09f22fff1206.png )
114-
95+ - Setup in ** _ config.properties_ ** file
96+ (** _ src/test/resources/config/config.properties_ ** )
97+ - screenshot_passed_steps=yes or no
98+ - screenshot_failed_steps=yes or no
99+ - screenshot_skipped_steps=yes or no
100+ - screenshot_all_steps=yes or no
115101
102+ ![ image] ( https://user-images.githubusercontent.com/87883620/161657881-5235139a-9982-43c0-ac37-09f22fff1206.png )
116103
117104** 8. Read data test from Excel file**
118105
119- - Create function with annotaion ** DataSupplier** on *** src /main/java/anhtester/com/utils/DataProviderUtils.java * **
106+ - Create function with annotaion ** DataSupplier** on ** _ src /main/java/anhtester/com/utils/DataProviderUtils.java _ **
120107- Call the name of ** DataSupplier** above in the test cases as DataProvider of TestNG
108+ - Read excel with Map and Hashtable
121109
122110** 9. Base function in the package**
123111
124- - *** src/main/java/anhtester/com/utils***
125- - *** src/main/java/anhtester/com/helpers***
126-
127- ** 10. Read data from JSON file**
112+ - ** _ src/main/java/anhtester/com/utils_ **
113+ - ** _ src/main/java/anhtester/com/helpers_ **
128114
115+ ** 10. Read data from JSON file**
129116
130117- ** JsonUtils** class select the json file path and call ** "get"** method with ** key**
131118
@@ -136,19 +123,20 @@ Note: enabled Allow less secure apps
136123- Example: WebUI.setWindowSize(1024, 768), WebUI.screenshotElement(By by, String elementName),...
137124
138125** 12. Call function to using sample**
126+
139127- All in one package: src/test/java/anhtester/com/projects/website/crm/testcases
128+
140129```
141130+ ClientTest
142131+ SignInTest
143132+ TestHandle
144133+ TestSimpleCode
145134```
146135
147-
148136## Project structure
149137
150138```
151- AutomationFrameworkSelenium
139+ 📦 AutomationFrameworkSelenium
152140 ┣ 📂src
153141 ┃ ┣ 📂main
154142 ┃ ┃ ┣ 📂java
@@ -208,23 +196,23 @@ AutomationFrameworkSelenium
208196 ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜EmailSendUtils.java
209197 ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜IconUtils.java
210198 ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜JsonUtils.java
199+ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜LanguageUtils.java
200+ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜LocalStorageUtils.java
211201 ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜Log.java
212202 ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜ObjectUtils.java
213203 ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜ReportUtils.java
214204 ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜WebUI.java
215205 ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜ZipUtils.java
216206 ┃ ┃ ┗ 📂resources
217207 ┃ ┃ ┃ ┣ 📜drag_and_drop_helper.js
218- ┃ ┃ ┃ ┣ 📜extent.properties
219208 ┃ ┃ ┃ ┣ 📜jquery_load_helper.js
220209 ┃ ┃ ┃ ┗ 📜log4j2.properties
221210 ┃ ┗ 📂test
222211 ┃ ┃ ┣ 📂java
223212 ┃ ┃ ┃ ┗ 📂anhtester
224213 ┃ ┃ ┃ ┃ ┗ 📂com
225214 ┃ ┃ ┃ ┃ ┃ ┣ 📂common
226- ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜BaseTest.java
227- ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜CommonTest.java
215+ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜BaseTest.java
228216 ┃ ┃ ┃ ┃ ┃ ┣ 📂listeners
229217 ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜TestListener.java
230218 ┃ ┃ ┃ ┃ ┃ ┗ 📂projects
@@ -237,9 +225,8 @@ AutomationFrameworkSelenium
237225 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜DashboardPage.java
238226 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂Projects
239227 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜ProjectPage.java
240- ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂SignIn
228+ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📂SignIn
241229 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜SignInPage.java
242- ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜CommonPage.java
243230 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📂testcases
244231 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜ClientTest.java
245232 ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜SignInTest.java
@@ -265,10 +252,8 @@ AutomationFrameworkSelenium
265252 ┗ 📜README.md
266253```
267254
268-
269255## I shall write document for my Framework. Coming soon...
270256
271-
272257# Copyright 2022 Anh Tester
273258
274259> Anh Tester Blog: https://anhtester.com/
0 commit comments