question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Listeners may invoked not by the definition order / Have a way to order listeners

See original GitHub issue

TestNG Version

6.9.13.6

Expected behavior

Listeners are invoked by the definition order.

Diagnosis

In TestRunner.initListeners, classes of listeners were put into a HashSet which would lost the order.

    Set<Class<? extends ITestNGListener>> listenerClasses = Sets.newHashSet();
    Class<? extends ITestNGListenerFactory> listenerFactoryClass = null;

    for (IClass cls : getTestClasses()) {
      Class<?> realClass = cls.getRealClass();
      ListenerHolder listenerHolder = findAllListeners(realClass);
      if (listenerFactoryClass == null) {
        listenerFactoryClass = listenerHolder.listenerFactoryClass;
      }
      listenerClasses.addAll(listenerHolder.listenerClasses);
    }

Variable “listenerClasses” could be a LinkedHashSet.

Is the issue reproductible on runner?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Test case sample

Please, share the test case (as small as possible) which shows the issue

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
juherrcommented, Nov 30, 2017
0reactions
krmahadevancommented, Mar 16, 2022

Fixed via #2737

Read more comments on GitHub >

github_iconTop Results From Across the Web

EventTarget.addEventListener() - Web APIs | MDN
However, the new listener may be triggered during a later stage of ... See DOM Level 3 Events and JavaScript Event order for...
Read more >
java - How can I ensure that a Spring @EventListener will be ...
Use the @Order annotation on the @EventListener method: ... It is also possible to define the order in which listeners for a certain...
Read more >
EventBus listener order - Google Groups
Dear all,. Does the EventBus class guarantee that the listener are invoked in the same order as they were registered to the event...
Read more >
JavaScript Event Listeners Ultimate Guide
It is important to note that the event listeners on the same element will trigger in the order they are defined so if...
Read more >
Events and Event Listeners (Symfony Docs)
Creating an Event Subscriber; Request Events, Checking Types; Listeners or ... event listeners invokable);; If the __invoke() method is not defined either, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found