Streaming working of listener comparator by krmahadevan · Pull Request #3118 · testng-team/testng (original) (raw)

Walkthrough

The recent changes focus on improving the ListenerComparator functionality in TestNG by incorporating logic to set the listenerComparator based on command line arguments. This enhancement aims to ensure that listeners are ordered as specified, addressing the issue where they previously executed without any specific order.

Changes

File Path Change Summary
testng-core/src/main/java/org/.../TestNG.java Added logic to set listenerComparator based on cmdLineArgs in configure method.
testng-core/src/test/java/test/.../ListenersTest.java New test methods added to ensure ordering for various listeners via Maven.

Assessment against linked issues

Objective Addressed Explanation
Allow users to define the order of TestNG listeners invocation (#2874)
Ensure that TestNG uses a comparator to establish order for listeners (#2874)
ListenerComparator should order listeners as expected (#3117)

Poem

🐇💻 Oh hop and code, through fields of Java,
Where bugs lay hidden, in lines so suave.
A fix, a tweak, a test, a cheer,
🎉 Listeners ordered, have no fear!
With every commit, the garden grows,
CodeRabbit 🐰, through the meadows.


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

CommitsFiles that changed from the base of the PR and between fe24aa2 and c1a524c. Files selected for processing (3)

testng-core/src/test/java/test/listeners/ListenersTest.java (11)

67-73: The test method ensureOrderingForExecutionListenersViaMaven is correctly implemented to verify the listener ordering via Maven configuration.


83-89: The test method ensureOrderingForAlterSuiteListenersViaMaven is correctly implemented to verify the listener ordering for alter suite listeners via Maven configuration.


105-109: The test method ensureOrderingForSuiteListenersViaMaven is correctly implemented to verify the listener ordering for suite listeners via Maven configuration.


120-127: The test method ensureOrderingForTestListenersViaMaven is correctly implemented to verify the listener ordering for test listeners via Maven configuration.


137-143: The test method ensureOrderingForInvokedListenersViaMaven is correctly implemented to verify the listener ordering for invoked method listeners via Maven configuration.


154-161: The test method ensureOrderingForConfigurationListenersViaMaven is correctly implemented to verify the listener ordering for configuration listeners via Maven configuration.


169-173: The test method ensureOrderingForClassListenersViaMaven is correctly implemented to verify the listener ordering for class listeners via Maven configuration.


184-191: The test method ensureOrderingForDataProviderListenersViaMaven is correctly implemented to verify the listener ordering for data provider listeners via Maven configuration.


202-209: The test method ensureOrderingForDataProviderInterceptorsViaMaven is correctly implemented to verify the listener ordering for data provider interceptors via Maven configuration.


219-225: The test method ensureOrderingForExecutionVisualisersViaMaven is correctly implemented to verify the listener ordering for execution visualisers via Maven configuration.


235-241: The test method ensureOrderingForMethodInterceptorsViaMaven is correctly implemented to verify the listener ordering for method interceptors via Maven configuration.

testng-core/src/main/java/org/testng/TestNG.java (1)

1776-1779: Ensure that the ListenerComparator is correctly set from the command line arguments.

This change correctly captures the ListenerComparator from the command line arguments and sets it appropriately, aligning with the PR's objectives to ensure the correct functioning of ListenerComparator.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Chat

There are 3 ways to chat with CodeRabbit:

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

Documentation and Community