I am trying to build an e2e test automation solution using TestNG, extentreports and this adapter. I like using the extentreports test logger in the test methods I am using like so:
However, the problem comes if I want to use the performAction1() as a setup, like when it makes sense that all tests in the suite perform this action before the actual test starts:
This will obviously fail, because ExtentTestManager.getTest() will return null when we are in the @Before method.
Is there a graceful way to include the ExtentTest.log() method in @Before methods?
Alternatives I have considered:
I have already considered switching to org.testng.Reporter.log() together with the ExtentIReporterSuiteClassListenerAdapter listener. But then, the logs are not shown in the Test view (Spark Reporter), which I find a bit inconvenient when investigating the report.
I have also tried cheating by extending the @Before method like so
Hi there,
I am trying to build an e2e test automation solution using TestNG, extentreports and this adapter. I like using the extentreports test logger in the test methods I am using like so:
However, the problem comes if I want to use the performAction1() as a setup, like when it makes sense that all tests in the suite perform this action before the actual test starts:
This will obviously fail, because
ExtentTestManager.getTest()
will returnnull
when we are in the @Before method.Is there a graceful way to include the
ExtentTest.log()
method in @Before methods?Alternatives I have considered:
I have already considered switching to
org.testng.Reporter.log()
together with theExtentIReporterSuiteClassListenerAdapter
listener. But then, the logs are not shown in the Test view (Spark Reporter), which I find a bit inconvenient when investigating the report.I have also tried cheating by extending the @Before method like so
However, then testSomething will appear as two tests in the log