testng-team / testng

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

TestNG Listeners not running if they are in dependency #2101

Closed javydreamercsw closed 5 years ago

javydreamercsw commented 5 years ago

TestNG Version

6.14.3

Expected behavior

Listeners in dependencies are executed

Actual behavior

Listeners are ignored when in a dependency.

Is the issue reproductible on runner?

Test case sample

Sample.zip

krmahadevan commented 5 years ago

@javydreamercsw - Please retry using the latest released version of TestNG viz., 7.0.0-beta5. If the problem still exists, please provide details on what needs to be executed from the zip file you have shared. Its not clear what needs to be run to reproduce the problem etc., because it has 2 projects in it.

javydreamercsw commented 5 years ago

Just run mvn tests on project b after compiling project a.

I'll give it a try ASAP.

javydreamercsw commented 5 years ago

Same behavior in 7.0.0-beta5.

krmahadevan commented 5 years ago

TestNG is working as designed.

The listener that you have added in ProjectA is via the surefire plugin. The entries added via surefire plugin will not have any effect in downstream projects (for e.g., ProjectB).

If you need to have that, you would need to explicitly do one of the following in ProjectB

  1. Use <listeners> tag (or)
  2. Use ServiceLoader approach. Refer here