TestNG's default emailable report displays exceptions when a test case is failed or an assert message.
But here I want to add a message to the passed Test cases, say some output value in the TestNG report. To be specific:
1. Submit a form in UI.
2. A success message with ID will be displayed.
3. Retrieve that ID using selenium's getText().
4. In the TestNG report, print the above-retrieved ID as "Submitted form ID: {id}".
When the user clicks on the report's passed test cases, I want these messages to be displayed.

You can display the message in Testng report using Reporter.log if the test case got success then it will print the message as "the value of id is" .
See Below code reference :
@Test
public void testCaseEnabling() {
System.out.println("I'm Not Ready, please don't execute me");
Assert.assertEquals(actual, expected);
int id = 10;
Reporter.log("the value of id is " + id);
}
Also: import org.testng.Reporter;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With