Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Automation_selenium
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Trình Nguyễn
Automation_selenium
Commits
53c51bee
Commit
53c51bee
authored
May 05, 2026
by
Đỗ Gia Hưng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bai 10: Cach su dung Annotation trong TestNG (priority, description, enabled)
parent
2429975d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
TestNGAnnotationsTest.java
.../java/com/automation/testcases/TestNGAnnotationsTest.java
+12
-5
No files found.
src/test/java/com/automation/testcases/TestNGAnnotationsTest.java
View file @
53c51bee
...
@@ -25,21 +25,28 @@ public class TestNGAnnotationsTest {
...
@@ -25,21 +25,28 @@ public class TestNGAnnotationsTest {
System
.
out
.
println
(
"- @BeforeMethod: Chay truoc moi phuong thuc @Test"
);
System
.
out
.
println
(
"- @BeforeMethod: Chay truoc moi phuong thuc @Test"
);
}
}
@Test
// Bai 10: Su dung thuoc tinh priority de quan ly thu tu chay (so nho chay truoc)
// description dung de mo ta test case giup bao cao de doc hon
@Test
(
priority
=
1
,
description
=
"Kiem tra tieu de trang web Anh Tester"
)
public
void
testCase1
()
{
public
void
testCase1
()
{
System
.
out
.
println
(
"Executing Test Case 1"
);
System
.
out
.
println
(
"Executing Test Case 1
: Kiem tra tieu de
"
);
String
expectedTitle
=
"Anh Tester"
;
String
expectedTitle
=
"Anh Tester"
;
String
actualTitle
=
"Anh Tester"
;
String
actualTitle
=
"Anh Tester"
;
// Su dung Assertion de kiem tra ket qua
Assert
.
assertEquals
(
actualTitle
,
expectedTitle
,
"Tieu de khong khop!"
);
Assert
.
assertEquals
(
actualTitle
,
expectedTitle
,
"Tieu de khong khop!"
);
}
}
@Test
@Test
(
priority
=
2
,
description
=
"Kiem tra trang thai hien thi cua phan tu"
)
public
void
testCase2
()
{
public
void
testCase2
()
{
System
.
out
.
println
(
"Executing Test Case 2"
);
System
.
out
.
println
(
"Executing Test Case 2
: Kiem tra hien thi
"
);
boolean
isDisplayed
=
true
;
boolean
isDisplayed
=
true
;
Assert
.
assertTrue
(
isDisplayed
,
"Phan tu khong hien thi!"
);
Assert
.
assertTrue
(
isDisplayed
,
"Phan tu khong hien thi!"
);
}
}
// Bai 10: Su dung enabled = false de bo qua (skip) mot test case khong muon chay
@Test
(
priority
=
3
,
enabled
=
false
,
description
=
"Test case nay dang bi loi nen tam thoi bo qua"
)
public
void
testCase3
()
{
System
.
out
.
println
(
"Test case nay se khong bao gio duoc chay"
);
}
@AfterMethod
@AfterMethod
public
void
afterMethod
()
{
public
void
afterMethod
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment