Reputation: 1007
I am currently creating TestNG test cases for a big project with a lot of modules. Most of the unit tests that are existing are actually Integration Tests as they rely a lot on configuration files located in the /opt folder as well as running database and message queues.
To complicate things further the test case use TestNG Listeners with the configuration located in the resources/META-INF/services/org.testng.ITestNGListener file. The listeners in this file fire for all the test cases (as expected).
Is there a way I can disable the listeners from firing for some of the test classes? I already tried annotating the test class with @Listener({}) to indicate that no listeners will be used but it does not work.
Upvotes: 1
Views: 1210
Reputation: 5740
For the moment, it's not possible to remove listeners defined via service locator. If you really need it, you can ask the feature and/or try to propose a pull-request: https://github.com/cbeust/testng/issues
For your information, it will be possible to remove listeners from @Listeners
in the next release of TestNG: https://github.com/cbeust/testng/pull/900
Upvotes: 1