How to use extent report loggin in BeforeSuite and AfterSuite annotations | Selenium Forum
A
avani.garimella Posted on 01/05/2019

A
Ashish Thakur Replied on 08/05/2019

We have to generate report for every test case

So we us beforemethod and aftermethod annotations and not before suite


A
avani.garimella Replied on 08/05/2019

i got that , but am asking if i need logging to be done for actions performed in BeforeSuite and AfterSuite annotations, how do i do it?


A
Ashish Thakur Replied on 23/05/2019

In the current framework. It wont happen. You neet to write your own logic for this.


A
avani.garimella Replied on 29/09/2020

what should the logic be like i was using the following for failures, but when a failure happens the log is not written and if i use Assert.fail(msg) the log is written but the tests following the before suite are executing. i need to understand how to write the log on a failure and also to skip the excution of tests. the below code does not write into log but skips the tests. if i use the Assert.fail it writes to the log but does not skip the tests. Am looking for some help on how to build this logic

public void reportFailure_setup(String msg){
test.log(LogStatus.FAIL, msg);

softAssert.fail(msg);
softAssert.assertAll();
}


A
Ashish Thakur Replied on 30/09/2020

In that case its better to use ITestListener interface

Using listener, the control comes in specific functions if the test passes, fails or skips.

Please watch testng. In it we have explained listener