-
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 data providers to be non cacheable #3076
Conversation
WalkthroughThe recent updates to the TestNG framework address a notable discrepancy in DataProvider behavior between versions 6.x and 7.x, specifically regarding data generation and caching for test retries. The changes introduce mechanisms to control whether data for retried tests should be reused or regenerated, enhancing flexibility and aligning with previous behavior. Additionally, enhancements include the ability to order TestNG listeners and the migration of Ant support. Changes
Assessment against linked issues
Poem
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 (
|
Closes testng-team#3041 We can now configure TestNG to enable/disable caching of test data produced by a data provider when TestNG is retrying a failed test method using the attribute “cacheDataForTestRetries” on the “@dataProvider” annotation. Below is a sample, which forces TestNG to re-invoke the data provider when a test method fails and it needs to be retried. ``` @dataProvider(name = "dp", cacheDataForTestRetries = false) public Object[][] getData() { return new Object[][] {{1}, {2}}; } ```
57424cf
to
cc37588
Compare
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (11)
- CHANGES.txt (1 hunks)
- testng-core-api/src/main/java/org/testng/IDataProviderMethod.java (1 hunks)
- testng-core-api/src/main/java/org/testng/annotations/DataProvider.java (1 hunks)
- testng-core-api/src/main/java/org/testng/annotations/IDataProviderAnnotation.java (1 hunks)
- testng-core/src/main/java/org/testng/internal/DataProviderMethod.java (1 hunks)
- testng-core/src/main/java/org/testng/internal/Parameters.java (1 hunks)
- testng-core/src/main/java/org/testng/internal/annotations/DataProviderAnnotation.java (2 hunks)
- testng-core/src/main/java/org/testng/internal/annotations/JDK15TagFactory.java (1 hunks)
- testng-core/src/main/java/org/testng/internal/invokers/TestInvoker.java (2 hunks)
- testng-core/src/test/java/test/dataprovider/DataProviderTest.java (1 hunks)
- testng-core/src/test/java/test/dataprovider/issue3041/SampleTestCase.java (1 hunks)
Files skipped from review as they are similar to previous changes (11)
- CHANGES.txt
- testng-core-api/src/main/java/org/testng/IDataProviderMethod.java
- testng-core-api/src/main/java/org/testng/annotations/DataProvider.java
- testng-core-api/src/main/java/org/testng/annotations/IDataProviderAnnotation.java
- testng-core/src/main/java/org/testng/internal/DataProviderMethod.java
- testng-core/src/main/java/org/testng/internal/Parameters.java
- testng-core/src/main/java/org/testng/internal/annotations/DataProviderAnnotation.java
- testng-core/src/main/java/org/testng/internal/annotations/JDK15TagFactory.java
- testng-core/src/main/java/org/testng/internal/invokers/TestInvoker.java
- testng-core/src/test/java/test/dataprovider/DataProviderTest.java
- testng-core/src/test/java/test/dataprovider/issue3041/SampleTestCase.java
Hi @krmahadevan, thank you for your contribution. Here’s the relevant code snippet for reference: `import org.testng.IRetryAnalyzer; import java.util.UUID; public class TestngRetryDpTest extends BaseTest {
} While the DataProvider method is being called again, and I can see a newly generated UUID in the ParameterHandler.ParameterBag within the org.testng.internal.invokers.TestInvoker.retryFailed() method, it seems that the new value is not being propagated to the test method. Instead, the TestMethodArguments continues to hold the original value. Could you please take a look at this issue? Your assistance would be greatly appreciated. Many thanks in advance! Environment: |
@Riabchykova please help create a new issue and include the sample there. For additional context you can always cross link this PR in the new issue. |
Closes #3041
We can now configure TestNG to enable/disable
caching of test data produced by a data provider
when TestNG is retrying a failed test method using the attribute “cacheDataForTestRetries” on the
“@dataProvider” annotation.
Below is a sample, which forces TestNG to re-invoke the data provider when a test method fails and it needs to be retried.
Fixes #3041
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