Listeners may invoked not by the definition order / Have a way to order listeners
See original GitHub issueTestNG 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:
- Created 7 years ago
- Comments:13 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@sbabcoc Could you update https://github.com/cbeust/testng/wiki/3rd-party-extensions ? 😃
Fixed via #2737