testng-team / testng

TestNG testing framework
https://testng.org
Apache License 2.0
1.99k stars 1.02k forks source link

It's not possible to register a new ITestListener at the runtime #2055

Closed baflQA closed 5 years ago

baflQA commented 5 years ago

TestNG Version

TestNg 7.0.0-beta5

Expected behavior

ITestListener implementation added on suite start will be registered and executed.

Actual behavior

A listener is not added to the list of the listeners.

Is the issue reproductible on runner?

Test case sample

In the super test class, ITestListener implementation is added to the set of the listeners https://github.com/baflQA/testNG_parallel_debug/blob/b94df072e0749f52e6ed318754d04f2b52ddf556/src/test/java/testngparallel/MasterTestClass.java#L22

When executing this test https://github.com/baflQA/testNG_parallel_debug/blob/b94df072e0749f52e6ed318754d04f2b52ddf556/src/test/java/testngparallel/Class1.java the registered listener should be invoked.

It won't be invoked, because it's not really registered there: https://github.com/cbeust/testng/blob/master/src/main/java/org/testng/SuiteRunner.java#L454

baflQA commented 5 years ago

Hi there! @krmahadevan @juherr @cbeust any plans to release this fix? The official maven repo is stuck on 7.0.0-beta4, which is unusable, so 7.0.0-beta3 is the current release as for now. Would be nice to get something newer in the central repository.

krmahadevan commented 5 years ago

@baflQA 7.0.0-beta5 is already published to Bintray. You could try it today. But unfortunately its not been synced to Maven central.