TestNG Integration

Assertions and Reporting

Use this slide if there is no Heading
Note - Create Content inside Red Layout

[Delete Red Outline After creating slide]

Learning Outcome

5

Validate page title, URL, and element text during testing

4

Apply SoftAssert to verify multiple conditions in a test

3

Use assert methods to validate application behavior

2

Differentiate between Hard Assertions and Soft Assertions

1

Understand the role of assertions in test automation

Topic Name-Recall(Slide3)

Hook/Story/Analogy(Slide 4)

Transition from Analogy to Technical Concept(Slide 5)

Hard vs. Soft Assertions

Type

Behavior

Description

Hard Assert

Soft Assert

Continues execution even after failures

Stops test immediately if condition fails

Execution is aborted

All failures reported at the end

org.testng.Assert class
  • Hard assertions use
org.testng.asserts.SoftAssert class
  • Soft assertions use

Using Assert Class for Critical Checks

@Test 
public void testTitle() { S
tring expected = "Dashboard"; 
String actual = driver.getTitle(); 
Assert.assertEquals(actual, expected); 
}
  • assertTrue(condition)

Verifies a condition evaluates to true

  • assertFalse(condition)

Verifies a condition evaluates to false

  • assertNotNull(object)

Confirms an object reference is not null

Core Concepts (Slide 7)

Core Concepts (.....Slide N-3)

Summary

5

Without assertions, tests may run successfully but verify nothing

4

Assertions help validate title, URL, and page elements

3

Soft assertions continue test execution and report failures later

2

Hard assertions stop the test immediately when a failure occurs

1

Assertions verify whether expected results match actual results

Choose cool, soft colors instead of vibrant colors
Max 5 Points for Summary & Min 2

Quiz

Which assertion type reports failures at the end of execution?

A. Hard Assertion

B. Static Assertion

C. Soft Assertion

D. Manual Assertion

Quiz-Answer

Which assertion type reports failures at the end of execution?

A. Hard Assertion

B. Static Assertion

C. Soft Assertion

D. Manual Assertion

Assertions and Reporting

By Content ITV

Assertions and Reporting

  • 14