Questions tagged [testng-dataprovider]

TestNG @DataProvider annotation

Refers to @DataProvider, a TestNG annotation that allows combinations of parameters (test data) to be automatically injected into your test methods. It's encountered often with Selenium.

Related tags :

Reference links :

449 questions
3
votes
2 answers

Reading test data from JSON with TestNG in Java

I'm trying to find the easiest way to parse simple json to java Object for use json data in autotest (TestNG), but I don't understand another examples with various libraries. I have this code: @Test(dataProvider = "SearchData") public void…
3
votes
1 answer

Step Definition not found with io.Cucumber (java8 - testng - spring)

I upgraded the cucumber version I was using to run each cucumber scenario in a different @Test but now my runner can't find my step definition My tests were running fine when I was using cucumber 1.2.5 with the groupId Info.cukes but know that I…
3
votes
1 answer

Run all Test for one iteration of dataprovider and so on till the end of data in data provider

actually data provider have date and brand name so my first @test can only select date and brand name then in second @test it will fetch data against the same date and brand name and on second iteration first @test take second date and second brand…
3
votes
0 answers

TestNG, Multiple duplicate listener warnings on implementing multiple listener interfaces

I have a single Listener class that implements IAnnotationTransformer, IInvokedMethodListener, ITestListener and IReporter. My Test run successfully BUT i get a warning "[TestNG] [WARN] Ignoring duplicate listener : com.NGtest.RetryListener". This…
Bipo K
  • 395
  • 3
  • 20
3
votes
0 answers

Passing data to DataProvider from Excel sheet- Getting Exception - java.lang.RuntimeException and java.lang.NullPointerException

Below code is for submitting the flight details and multiple rows are getting fetched from the Excel and Multiple Rows are getting passed to DataProvider from ExcelSheet. 'VerifyInvalidLogin' is getting skipped and throwing Exceptions…
3
votes
2 answers

Not able to run more than 10 Tests in parallel via TestNG Dataprovider

Hi i have designed a selenium test to run in parallel (25) @Test(dataProvider = "getData" ) public void multiUserTest(String url, String username, String password) throws InterruptedException, IOException, FindFailed { …
3
votes
5 answers

TestNG non static data provider method not working

I have a test class and test method. This depends on data provider method. The data provider method is in different class other than the test class or one of its base classes. As per TestNG documentation If you want to put your data provider in a…
Sourav Chandra
  • 952
  • 2
  • 7
  • 11
3
votes
1 answer

Multithreaded TestNG DataProvider Execution

I am trying for a multithreaded test via TestNG. @BeforeMethod instantiates the WebDrivers for the test. @AfterMethod closes the WebDrivers after the test. @Dataprovider provides the data for the test to run multiple times in a loop. import…
3
votes
1 answer

Return an Iterator over Map from Data Provider

public class DemoTest { private static final ThreadLocal webDriverThreadLocal= new InheritableThreadLocal<>(); private String baseUrl; Random random = new Random(); int no; private final Map map =new…
Grishma Oswal
  • 303
  • 1
  • 7
  • 22
3
votes
3 answers

Skip Certain Test Iterations Using TestNG DataProvider

I'm using the TestNG DataProvider to read a datapool.xls file that contains 1017 test cases and 214 columns in a class called ReadData. I then pass the 214 String parameters into an @Test annotation in a separate class called…
Dustin N.
  • 785
  • 1
  • 14
  • 32
3
votes
1 answer

Set expectedExceptions using dataprovider

Is it possible to set the expectedExceptions option in a TestNG @Test from a @DataProvider? If so, how is it done? Here is a non-intuitive example: @DataProvider private Object[][] methodABadArgsProvider() { return new Object[][] { {null,…
ishan3243
  • 1,870
  • 4
  • 30
  • 49
3
votes
2 answers

Java testng single dataprovider multiple test

Scenario: I have a csv file with 10 columns of test data. For each column I want to have a test method. Now I know how to use dataprovider to read the csv file and provide the test data to a test method. But how can I use the same testprovider for…
user2285451
  • 107
  • 1
  • 2
  • 11
2
votes
1 answer

How can I dynamically assign test groups to test methods and @BeforeXXX and @AfterXXX annotated methods during runtime?

My Requirement: I have around 100 tests in my test suite. I don't want to hardcode the group name in the tests source code. I want to choose the tests that I want to run each time but want to pass that list from an external source (csv/json/xml,…
2
votes
2 answers

Data Provider Mismatch in Selenium with TestNG and Java

Got some problem here, could you please navigate me how to resolve it? So here is my code to read Excel import java.io.IOException; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import…
2
votes
2 answers

Is there a way to give a specific name to test case using TestNG data providers?

I am writing unit tests in Java with TestNG 6.14.3 using @DataProvider What I want to achieve: I want to give each data provider case a name. I do not want to the name to be one of the parameters but a custom name. (just an example: "Good flow no…
1
2
3
29 30