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
Context: I don't want a DataProvider to execute if the test is going to be skipped
Create a TestListener that implements both IDataProviderListener and ITestListener
Override the onTestStart method to skip if certain conditions are matched (ex: the test contains a specific group)
Also override the beforeDataProviderExecution method to skip the DataProvider if the test contains a skip condition
Create a TestFile that uses TestListener as Listener
Add a test with a DataProvider that meets the skip condition
(Optional) Add a test without a DataProvider that meets the skip condition to compare
Run the test/s
Expected behavior
Skipping a test with a DataProvider should skip the test and the DataProvider, the test result should show that the test was Skipped.
The test with the DP and one without it should behave the same, everything should be skipped
Actual behavior
The test with the DataProvider is shown as failed with a SkipException
TestNG Version
7.7.1
How to reproduce?
Context: I don't want a DataProvider to execute if the test is going to be skipped
Expected behavior
Skipping a test with a DataProvider should skip the test and the DataProvider, the test result should show that the test was Skipped.
The test with the DP and one without it should behave the same, everything should be skipped
Actual behavior
The test with the DataProvider is shown as failed with a SkipException
Is the issue reproducible on runner?
Test case sample
Here you have a small IntelliJ project containing a test file with two tests, one has the dumb DataProvider:
https://github.com/jmoreira18/TestNG-DataProvider-issue-demo
Code comments
This part of the code is not taking into account that it could be a SkipException, then it's treating it as a failure and failing the test
Thanks in advance!
The text was updated successfully, but these errors were encountered: