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) | ✅ |
Possibly related issues
- Issue [Feature] Allow users to define ordering for TestNG listeners #2874: The changes directly address the need to allow users to define and ensure the order of listener invocation, making this issue highly relevant.
- Issue ListenerComparator doesn't work #3117: This issue is directly addressed by the implemented changes ensuring that
ListenerComparatororders listeners correctly.
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)
- CHANGES.txt (1 hunks)
- testng-core/src/main/java/org/testng/TestNG.java (1 hunks)
- testng-core/src/test/java/test/listeners/ListenersTest.java (12 hunks) Files skipped from review due to trivial changes (1)
- CHANGES.txt Additional comments not posted (12)
testng-core/src/test/java/test/listeners/ListenersTest.java (11)
67-73: The test methodensureOrderingForExecutionListenersViaMavenis correctly implemented to verify the listener ordering via Maven configuration.
83-89: The test methodensureOrderingForAlterSuiteListenersViaMavenis correctly implemented to verify the listener ordering for alter suite listeners via Maven configuration.
105-109: The test methodensureOrderingForSuiteListenersViaMavenis correctly implemented to verify the listener ordering for suite listeners via Maven configuration.
120-127: The test methodensureOrderingForTestListenersViaMavenis correctly implemented to verify the listener ordering for test listeners via Maven configuration.
137-143: The test methodensureOrderingForInvokedListenersViaMavenis correctly implemented to verify the listener ordering for invoked method listeners via Maven configuration.
154-161: The test methodensureOrderingForConfigurationListenersViaMavenis correctly implemented to verify the listener ordering for configuration listeners via Maven configuration.
169-173: The test methodensureOrderingForClassListenersViaMavenis correctly implemented to verify the listener ordering for class listeners via Maven configuration.
184-191: The test methodensureOrderingForDataProviderListenersViaMavenis correctly implemented to verify the listener ordering for data provider listeners via Maven configuration.
202-209: The test methodensureOrderingForDataProviderInterceptorsViaMavenis correctly implemented to verify the listener ordering for data provider interceptors via Maven configuration.
219-225: The test methodensureOrderingForExecutionVisualisersViaMavenis correctly implemented to verify the listener ordering for execution visualisers via Maven configuration.
235-241: The test methodensureOrderingForMethodInterceptorsViaMavenis 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 theListenerComparatoris correctly set from the command line arguments.This change correctly captures the
ListenerComparatorfrom the command line arguments and sets it appropriately, aligning with the PR's objectives to ensure the correct functioning ofListenerComparator.
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:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai generate interesting stats about this repository and render them as a table.@coderabbitai show all the console.log statements in this repository.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
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)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger a review. This is useful when automatic reviews are disabled for the repository.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.