Use of ITestContext instead of inheritance | Selenium Forum
Y
Yousuf Syed Posted on 30/07/2021

Hi Ashish,

In the "TestNG - Raw Project Structure, Running of Tests, Report Generation - LIVE PROJECT", video no. 2 - Feed data from external source and report Test Failures, Passes, Skips, at 29:00 we see that we are not able to print the failure message because we are not able to access the test object of ExtentReport class.

 

Can we not access the test object of class ExtentReports by writing

public class CustomListener extends TestBase implements ITestListener{

 

}

Now we can access the ExtentReports's test object and can use it to fail the test in ExtentReports. Please correct me if I am wrong.

 

Thanks,

Yousuf


A
Ashish Thakur Replied on 04/08/2021

Yes we will have the access but instance of that will be different than instance in test case

Different objects of extentreports will be created at both places. We need just 1 object


Related Posts