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
2
votes
1 answer

Providing TestNG factory with data provider to invoke test methods - Not able to invoke test multiple times

I have used test dat provider and factory with sample data more like reading from excel rows with multiple values. So each Map denotes Column name and value of each row and adding it to list have all the values which are read from excel. Now am…
2
votes
1 answer

Clearing overridden testContext values after a test

I extended TestListenerAdapter and added my own custom testName values. This is specifically for the use-cases where I have a data provider and I am using the dataprovider values to set the name. Here is how the listener looks like: public class…
2
votes
3 answers

Passing lambdas as testng parameters using DataProvider?

I was wondering if there is a way to pass lambdas from testng's data providers. So I want to do something like the following: @DataProvider(name="checkProvider") public Object[][] checkProvider() { return new Object[][]{ …
2
votes
2 answers

Can I have TestNG fail/skip if the DataProvider provides no test cases?

If my TestNG DataProvider has some logic in it, but then it results in an empty Object[][], I would like TestNG to count this as a failed test. I would prefer to not have to put logic in the DataProvider which checks that the Object[][].length > 0…
ngflanders
  • 21
  • 2
2
votes
1 answer

How to run tests in parallel on testNG using data provider?

I would like to run many tests on testng in parallel using a data provider. I would like a thread to run a test and the next thread to run the next test. How do I do this? Here is what I tried and it didn't work. @DataProvider(name = "testList",…
2
votes
1 answer

TestNG DataProvider returning object and RetryAnalyzer does not recognize retry

I've looked everywhere I know and I can't seem to find an answer for this one. If I pass a "complex" object from DataProvider to test method the Invoker seems to get a new instance of RetryAnalyzer with each iteration. IRL, my data provider makes a…
Rob G
  • 55
  • 11
2
votes
0 answers

Get test class name from which data provider method is called in TestNG

I am using TestNG @DataProvider Annotation along with @Factory functionality in order to run a flow. When the control goes to @DataProvider method, I want to know from which test class this dataprovider method was called & on basis of that I want to…
2
votes
1 answer

How to add data provider values in testng extent-report version 2.41.2(relevantcodes)

I have used Dataprovider to pass my test values and I want these values to get displayed in my testNG extent report. I have seven test cases and these test cases run on multiple test values passed in DataProvider. By clicking on the method name in…
2
votes
2 answers

Allure TestNG: Custom test method names while using @DataProvider

I am using allure-testng(2.12.1) adapter in my java testng tests. I have tests that are using @DataProvider. My test implements ITest to change the test method instance name during runtime. When I run the tests, I see the different test method…
Veeranna
  • 21
  • 1
  • 4
2
votes
1 answer

Running tests using DataProvider in a particular flow

I have a DataProvider which reads a CSV file like below john|26|mba claire|33|bbl knight|29|mpa Now I have three classes which has one @Test each Classes Names are NameReader.java ProcessStudent.java ValidateDatabase.java My NameReader.java has…
Damien-Amen
  • 7,232
  • 12
  • 46
  • 75
2
votes
0 answers

TestNG DataProvider marks as invalid return type Iterator, but it passes the params into a test method

When creating a Dataprovider that returns Iterator I have it in my test method, but my intellij-idea marks this return type as invalid and shows the message: "Data provider must return either Object[][] or Iterator[], or Iterator". Here is my class/…
Paulus
  • 138
  • 1
  • 11
2
votes
0 answers

Read excel data using dataprovider and java 8

I already have a dataprovider method to read data - i.e it will loop through the excel using two for loops and put that into an object array. Now I want to simplify it instead of using for loops. I have tried the following, but dont know how to put…
divya
  • 21
  • 1
2
votes
2 answers

How to run test cases in parallel?

I have one @Test method and I am getting the Test case names from @Dataprovider. I need to run the test cases in parallel: @Test(dataprovider="testdataprodivder") public void TestExecution(String arg 1) { /* Read the testcases from dataprovider and…
2
votes
3 answers

Getting "java.lang.NoClassDefFoundError" for Testng Dataprovider with Excel

I am not able to get past the error "java.lang.NoClassDefFoundError" Tried: 1- Cleaning the project 2- Updating testng xml 3- Verified the package/class structure Nothing seems to work: Note: I am not using Maven and all jar files are latest…
viki
  • 165
  • 2
  • 11
2
votes
1 answer

Parallel run not working in TestNG in case of common dataProvider

I am trying to run my Tests in parallel , everything works fine if my dataProvider is present in the same class where my @Test are present. However parallel run sometimes runs fine and sometimes fails in case i place my DataProvider in a separate…
Soumyansh Gupta
  • 121
  • 1
  • 2
  • 10
1 2
3
29 30