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

Streamline dependencies for configurations #3107

Merged
merged 1 commit into from Apr 4, 2024

Conversation

krmahadevan
Copy link
Member

@krmahadevan krmahadevan commented Apr 3, 2024

Closes #3000

Fixes #3000 .

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 issues with method predecessors lookup and sorting in specific inheritance scenarios.
    • Fixed super class annotations causing exceptions.
    • Addressed discrepancies with shared thread pool and method interceptor combination.
    • Improved controlling of listener inclusion at runtime.
  • New Features
    • Enhanced method sorting logic to prioritize independent methods before dependent ones in test configurations.
  • Tests
    • Added new tests to ensure independent configurations always run first when using dependencies.
    • Introduced test infrastructure for better handling and testing of dependencies within test configurations.

@krmahadevan krmahadevan requested a review from juherr as a code owner April 3, 2024 16:05
Copy link

coderabbitai bot commented Apr 3, 2024

Walkthrough

The overall change addresses issues in TestNG related to method sorting and execution order in certain inheritance scenarios, enhancements in handling method dependencies, and improvements in parallel execution setups. It includes fixes for superclass annotations causing exceptions and introduces a mechanism to control listener inclusion at runtime, thereby improving TestNG's robustness and flexibility in test execution management.

Changes

File(s) Change Summary
CHANGES.txt Fixed issues with method predecessors lookup, sorting in inheritance setups, super class annotations, discrepancies with shared thread pool and method interceptor combination, and runtime listener inclusion control.
.../MethodHelper.java Added Optional import, modified group dependency handling, and refactored method sorting to prioritize independent methods.
.../BeforeClassTest.java Added imports and a new test method to ensure independent configurations run first when using dependencies.
.../issue3000/* Introduced new classes and interfaces to support testing of method dependency and inheritance issues.

Assessment against linked issues

Objective Addressed Explanation
Method predecessors lookup and sorting in inheritance setups (#3000)
Execution order of dependent methods in parallel instances (#2372) The changes do not directly address parallel execution issues or the specific order of dependent methods when parallel=instances is used.
Address ClassCastException in parallel execution with shared thread pools (#3081) The summary does not mention a fix related to ClassCastException in parallel execution scenarios.

Possibly related issues

Poem

A rabbit hopped through fields of code, 🐇💻
Fixing bugs where they showed.
With each leap, a test would pass,
Through inheritance and class.
"To sort, to fix, a quest so bold,
Ensuring stories of success are told.
In TestNG's garden, I'll make my mark,"
Whispered the coderabbit in the dark. 🌌🚀

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/coderabbit-overrides.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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2e5d8bf and b5be6ca.
Files selected for processing (6)
  • CHANGES.txt (1 hunks)
  • testng-core/src/main/java/org/testng/internal/MethodHelper.java (5 hunks)
  • testng-core/src/test/java/test/configuration/BeforeClassTest.java (2 hunks)
  • testng-core/src/test/java/test/configuration/issue3000/MyBaseTestSample.java (1 hunks)
  • testng-core/src/test/java/test/configuration/issue3000/MyInterface.java (1 hunks)
  • testng-core/src/test/java/test/configuration/issue3000/TestClassSample.java (1 hunks)
Additional comments not posted (9)
testng-core/src/test/java/test/configuration/issue3000/MyInterface.java (1)

7-9: Consider adding documentation to the getDependency method to clarify its expected behavior and the implications of its default implementation returning null.

testng-core/src/test/java/test/configuration/issue3000/TestClassSample.java (1)

15-16: Consider adding a comment to the test method to clarify its purpose, especially if it's intended to remain empty as a placeholder or example.

testng-core/src/test/java/test/configuration/issue3000/MyBaseTestSample.java (1)

8-8: Consider adding a comment to the setDependency method to clarify its purpose, especially since its implementation is empty.

testng-core/src/test/java/test/configuration/BeforeClassTest.java (1)

57-81: LGTM! The test method ensureIndependentConfigurationsAlwaysRunFirstWhenUsingDependencies is well-implemented and thoroughly checks the functionality introduced in the PR.

testng-core/src/main/java/org/testng/internal/MethodHelper.java (2)

384-403: The new sorting logic to prioritize independent methods before dependent ones is a significant improvement and is well-implemented.


363-368: The handling of potentially null groupsDependedUpon using Optional.ofNullable in isGroupAgnosticConfigMethod enhances the method's robustness.

CHANGES.txt (3)

1-6: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-22]

Verify that all issues linked with their respective GITHUB or JIRA identifiers have been correctly resolved as mentioned in this update.


1-6: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-22]

Ensure that the documentation of changes is consistent with the actual code modifications and issue resolutions for each item listed.


1-6: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-22]

Confirm that all new features and fixes listed have been properly implemented and tested to ensure they work as expected.

CHANGES.txt Show resolved Hide resolved
@krmahadevan krmahadevan merged commit 05d629d into testng-team:master Apr 4, 2024
7 of 9 checks passed
@krmahadevan krmahadevan deleted the fix_3000 branch April 4, 2024 02:43
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.

Method predecessors lookup and/or method sorting is broken in certain inheritance and naming setups
2 participants