You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: only the latest version is supported
7.7.1 (behaviour exists in 6.14.3 as well)
I have a test method
The test method is powered by a data provider
The test method also has a RetryAnalyzer to perform retries
Test method fails
TestNG invokes the RetryAnalyser to attempt at retrying the test
But in doing so, it ends-up invoking the data provider once again.
In short, TestNG re-invokes data provider when it deals with a failed test that is being retried, even though it does not use data computed by the re-invocation.
Expected behaviour
Data provider for a test method should be called only once, irrespective of whether a particular iteration of the test method, fails.
Actual behaviour
TestNG re-invokes data provider when it deals with a failed test that is being retried, even though it does not use data computed by the re-invocation.
Is the issue reproducible on runner?
Shell
Maven
Gradle
Ant
Eclipse
IntelliJ
NetBeans
Test case sample
Please, share the test case (as small as possible) which shows the issue
Below is the output (Notice how the data provider is being invoked multiple times but the object that is being used to run the test is the same (even though a new one was created every-time the data provider was re-invoked)
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Data Provider invocation count #1
Instantiated com.rationaleemotions.DemoTest$Pojo@72cde7cc
Test is started for data com.rationaleemotions.DemoTest$Pojo@72cde7cc
Test ignored.
Data Provider invocation count #2
Instantiated com.rationaleemotions.DemoTest$Pojo@f736069
Test is started for data com.rationaleemotions.DemoTest$Pojo@72cde7cc
Test ignored.
Data Provider invocation count #3
Instantiated com.rationaleemotions.DemoTest$Pojo@4229bb3f
Test is started for data com.rationaleemotions.DemoTest$Pojo@72cde7cc
java.lang.AssertionError: null
at org.testng.Assert.fail(Assert.java:110)
at org.testng.Assert.fail(Assert.java:115)
at com.rationaleemotions.DemoTest.testMethod(DemoTest.java:21)
===============================================
Default Suite
Total tests run: 3, Passes: 0, Failures: 1, Skips: 0, Retries: 2
===============================================
Data Provider was invoked 3 time(s).
Process finished with exit code 0
Contribution guidelines
Incase you plan to raise a pull request to fix this issue, please make sure you refer our Contributing section for detailed set of steps.
The text was updated successfully, but these errors were encountered:
Closestestng-team#2884
When a data driven test fails, then ensure that
we don’t call the data provider once again when
retrying the test (we seem to invoke the data
provider multiple times, but ignore the value)
As part of fixing this, getting rid of the test for
testng-team#2157.
testng-team#2157 - deals with null pointer exceptions arising
Out of data provider that was re-invoked as a result
Of us retrying a failed test.
But now since a data provider is NOT going to be
re-invoked the changes for testng-team#2157 become irrelevant.
Closes#2884
When a data driven test fails, then ensure that
we don’t call the data provider once again when
retrying the test (we seem to invoke the data
provider multiple times, but ignore the value)
As part of fixing this, getting rid of the test for
#2157.
#2157 - deals with null pointer exceptions arising
Out of data provider that was re-invoked as a result
Of us retrying a failed test.
But now since a data provider is NOT going to be
re-invoked the changes for #2157 become irrelevant.
TestNG Version
RetryAnalyzer
to perform retriesIn short, TestNG re-invokes data provider when it deals with a failed test that is being retried, even though it does not use data computed by the re-invocation.
Expected behaviour
Data provider for a test method should be called only once, irrespective of whether a particular iteration of the test method, fails.
Actual behaviour
TestNG re-invokes data provider when it deals with a failed test that is being retried, even though it does not use data computed by the re-invocation.
Is the issue reproducible on runner?
Test case sample
Below is the output (Notice how the data provider is being invoked multiple times but the object that is being used to run the test is the same (even though a new one was created every-time the data provider was re-invoked)
Contribution guidelines
Incase you plan to raise a pull request to fix this issue, please make sure you refer our Contributing section for detailed set of steps.
The text was updated successfully, but these errors were encountered: