-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscratch.txt
More file actions
44 lines (39 loc) · 1.55 KB
/
scratch.txt
File metadata and controls
44 lines (39 loc) · 1.55 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
Types of Assertions in Testing Frameworks:
Hard Assertions:
Stop the test execution if an assertion fails.
Soft Assertions:
Continue the test execution even if an assertion fails,
collecting all failures to report at the end.
Creating a object -> SoftAssert softAssertobject = new SoftAssert()
softAssertobject.assertTrue .........
after asserting all the assert scenarios
need to use assertAll() , to report all the failures at once.
-> softAssertobject.assertAll()
1. Assert Equals
- Compares two values for equality.
- Example: Assert.assertEquals(expectedValue, actualValue);
2. Assert Not Equals
- Verifies that two values are not equal.
- Example: Assert.assertNotEquals(unexpectedValue, actualValue);
3. Assert True
- Checks if a condition is true.
- Example: Assert.assertTrue(condition);
4. Assert False
- Checks if a condition is false.
- Example: Assert.assertFalse(condition);
5. Assert Null
- Verifies that an object is null.
- Example: Assert.assertNull(object);
6. Assert Not Null
- Verifies that an object is not null.
- Example: Assert.assertNotNull(object);
7. Assert Same
- Checks if two references point to the same object.
- Example: Assert.assertSame(expectedObject, actualObject);
8. Assert Not Same
- Checks if two references do not point to the same object.
- Example: Assert.assertNotSame(unexpectedObject, actualObject);
9. Assert Array Equals
- Compares two arrays for equality.
- Example: Assert.assertArrayEquals(expectedArray, actualArray);
2.Understanding testNg priority