-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Allow users to access factory method params info #3115
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe updates across various TestNG files primarily enhance the handling of factory methods and their parameters using the Optional class, deprecate old functionalities, and streamline instance management. This includes introducing new interfaces and updating existing ones to improve code clarity and maintainability. Changes
Assessment against linked issues
Possibly related issues
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (20)
Files skipped from review as they are similar to previous changes (19)
Additional comments not posted (3)
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? TipsChatThere 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 CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is working but I'm a bit confused as each time we want to change the API because it is complicated to fix after the release.
testng-core-api/src/main/java/org/testng/ITestClassInstance.java
Outdated
Show resolved
Hide resolved
testng-core-api/src/main/java/org/testng/ITestClassInstance.java
Outdated
Show resolved
Hide resolved
testng-core/src/main/java/org/testng/internal/FactoryMethod.java
Outdated
Show resolved
Hide resolved
testng-core/src/main/java/org/testng/internal/ParameterInfo.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
testng-core-api/src/main/java/org/testng/ITestClassInstance.java
Outdated
Show resolved
Hide resolved
Closes testng-team#3111 TestNG now exposes the IParameterInfo interface Via which you can extract the following details Pertaining to a factory powered test. * the index - which would match with what was Specified in the “indices” attribute of the “Factory” Annotation. If nothing was specified, then this Would be equal to a running count on the total instances. * current index - which represents a running count On the total instances. * The parameters of the factory method * The instance that was produced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
new ITestListener() { | ||
@Override | ||
public void onTestSuccess(ITestResult result) { | ||
params.add(result.getMethod().getFactoryMethodParamsInfo()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method getFactoryMethodParamsInfo()
does not exist in the new API. You should use getFactoryMethod().flatMap(IFactoryMethod::getParameters)
instead to align with the updated interfaces.
- params.add(result.getMethod().getFactoryMethodParamsInfo());
+ params.add(result.getMethod().getFactoryMethod().flatMap(IFactoryMethod::getParameters).orElse(null));
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
params.add(result.getMethod().getFactoryMethodParamsInfo()); | |
params.add(result.getMethod().getFactoryMethod().flatMap(IFactoryMethod::getParameters).orElse(null)); |
ping @juherr - Please let me know if there are any other comments that need to be addressed or if this can be merged |
I'm working on it. I'm fighting against the issues of the legacy model. |
May the force be with you :) Will wait to hear back from you |
Closes #3111
TestNG now exposes the IParameterInfo interface
Via which you can extract the following details
Pertaining to a factory powered test.
the index - which would match with what was Specified in the “indices” attribute of the “Factory” Annotation. If nothing was specified, then this
Would be equal to a running count on the total instances.
current index - which represents a running count On the total instances.
The parameters of the factory method
The instance that was produced.
Fixes #3111 .
Did you remember to?
CHANGES.txt
./gradlew autostyleApply
We encourage pull requests that:
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