Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming working of listener comparator #3118

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

krmahadevan
Copy link
Member

@krmahadevan krmahadevan commented Apr 28, 2024

Closes #3117

The listener comparator was NOT getting wired in
when specified as a property in maven surefire plugin.

Fixes #3117 .

Did you remember to?

  • Add test case(s)
  • Update CHANGES.txt
  • Auto applied styling via ./gradlew autostyleApply

We encourage pull requests that:

  • Add new features to TestNG (or)
  • Fix bugs in TestNG

If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the
TestNG-dev before you spend time working on it.

Note: For more information on contribution guidelines please make sure you refer our Contributing section for detailed set of steps.

Summary by CodeRabbit

  • Bug Fixes
    • Resolved an issue affecting the functionality of listener comparisons in the system.
  • New Features
    • Enhanced configuration settings to adjust listener priorities based on user input.
  • Tests
    • Added multiple new tests to ensure proper ordering of listeners across various scenarios.

Closes testng-team#3117

The listener comparator was NOT getting wired in 
when specified as a property in maven surefire plugin.
Copy link

coderabbitai bot commented Apr 28, 2024

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

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

Commits Files 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 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
Tips

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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to 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.yaml file 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.

@krmahadevan
Copy link
Member Author

@juherr - I was thinking that we should release 7.10.2 with this fix, because this breaks the new feature that we introduced in 7.10.0 which was #2874

We discussed this issue to streamline its behaviour in #2916

@juherr
Copy link
Member

juherr commented Apr 28, 2024

As the release manager, go ahead when you think we need a new release 😉

@krmahadevan krmahadevan merged commit be199b4 into testng-team:master Apr 28, 2024
8 of 9 checks passed
@krmahadevan krmahadevan deleted the fix/3117 branch April 28, 2024 12:20
@missedone
Copy link
Contributor

@krmahadevan sounds good, I will add the configurable UI for the new arg in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ListenerComparator doesn't work
3 participants