0
votes

I have three testng xml files with names test1.xml,test2.xml and test3.xml.Each file is having their own testng suites.I am invoking test2.xml and test3.xml in test1.xml .In test1.xml I configured a listener and I want this listener to be disable when the suite in test2.xml is invoked.I did not find any thing related to this in Testng java doc.Any help would be appreciated.

1

1 Answers

0
votes

Currently, it is not possible to do what you want easily because a TestNG instance shares listeners between all suite-files: https://github.com/cbeust/testng/blob/master/src/main/java/org/testng/TestNG.java#L1253

But I think it could be considered as an issue (or at least a evident improvment). You should fill an issue on Github: https://github.com/cbeust/testng/issues

A possible work-arround would be to create yourself 3 testng instances with one diffrent suite-file by instance.