-
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
@Test Method is Retried Endlessly When Parameters Are Modified Before Rerun #3167
Comments
@Riabchykova - The problem lies in your test code and not with TestNG You are using the lombok annotation
Now the thing that is goofing up your code is the Everytime you alter your You can fix this by doing one of the following after you get rid of the
Am closing this issue. Please feel free to comment back (possibly with a simple standalone project instead of the sample code) if the issue persists. In a nutshell your |
@krmahadevan |
TestNG Version
7.10.2
Expected behavior
Test method is retried according to IRetryAnalyzer configuration when parameters are modified before rerun
Actual behavior
Test method is retried endlessly when parameters are modified before rerun
Is the issue reproducible on runner?
Summary:
In my current project, test data needs to be slightly modified during retries because the data is saved to a database during test execution and on reruns, errors occur due to the data already existing in the database.
To handle this, parameters are modified within the ITestListener.onTestSkipped method during reruns to generate new values for each retry. The object remains the same type, but some fields (e.g., description or UUID-number) are updated.
Issue:
After upgrading TestNG from 7.7.1 to 7.10.2, test methods with updated parameters are invoked endlessly.
While debugging, I traced the issue to the method org.testng.internal.BaseTestMethod.getRetryAnalyzerConsideringMethodParameters(ITestResult tr). In this method, a unique keyAsString is generated for each rerun, which results in the creation of a new IRetryAnalyzer every time.
Corresponding PR: #2935
Additional Info:
I attempted to use DataProvider with cacheDataForTestRetries = false, but it fails to supply new parameters to the test methods.
As a result, I'm currently blocked from upgrading TestNG due to this issue.
Related issue: #3157
Related pr: #3076
Test case sample
Test class
RetryListener class
Retrier class
Randomizer interface
retry_testng.xml
The output during the test run is as follows:
The text was updated successfully, but these errors were encountered: