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
0
votes
0 answers

Writing to an Excel File : Apache POI, TestNG & Selenium

I have been trying to read and write an excel file using TestNG Data Provider + Apache POI. The problem that I am having is when writing to the excel file. In a nutshell I have done the following: reading from an excel using that data to search…
frz
  • 59
  • 8
0
votes
2 answers

Clarify my doubts in testng extend report

@Test(priority = 0) public void verify_Templete_BG(){ logger =report.startTest("Verify TempleteBG"); String expectedBG = "White"; for(int pageNo = 1; pageNo<=3 ; pageNo++){ Assert.assertTrue(expectedBG.equals("White")); } …
Anandh R
  • 109
  • 1
  • 1
  • 9
0
votes
1 answer

DataProvider returning Object[][] does not match argument type

I have a TestNG dataProvider that needs to return an Object[][]. Here is how I get this object array I am returning. The test method looks like this: public void testUser(UserModel testData) Get the parent "Test" method's argument type. (Method…
0
votes
2 answers

TestNG @DataProvider to Return Dynamic Class

So to start off, I am building out an automation library built on top of Selenium and Java. I'm building out a way to parameterize data that is being passed into test methods. I am using TestNG. Right now I have two sample Test methods that take in…
dpace
  • 21
  • 1
  • 7
0
votes
1 answer

TestNG with DataProvider skips all tests

I have a simple class with just one test and this test uses DataProvider public class dataProviderExample { @DataProvider(name = "test1") public Object[][] createData1() { return new Object[][] { { "Cedric", new…
donatelo
  • 103
  • 2
  • 12
0
votes
1 answer

TestNG: How to get class that is about to create by Factory from DataProvider

I have a class with @Factory(dataProvider = "dp") at constructor. How can I obtain that class inside data provider? class Test { @Factory(dataProvider = "dp") public Test(int i) { //... some code } @DataProvider public static…
Sergey Irisov
  • 468
  • 4
  • 7
0
votes
2 answers

how to run multiple test cases in junit or testng with different set of test data from csv file

I hope this scenario is bit confused me lot. I want to run a few test cases using junit or testng with different set of data from csv file. The code snippet i have tried is given below but it dint work, private static CSVReader csvReader =…
Jugi
  • 1,244
  • 3
  • 23
  • 51
0
votes
1 answer

Not able to Run script, Error with parameter in TestNG,

I am trying to execute a script for login into webpage.Can any1 help me solve dis problem? I am getting below error:- The data provider is trying to pass 7 parameters but the method efgh.DataDriven#login takes 2 public class DataDriven { public…
sarfaraz
  • 15
  • 7
0
votes
1 answer

Can I use TestNG DataProvider in Spring Context i.e. in my Test Code which runswith SpringJUnit4ClassRunner

I am doing some Junit testing in Spring and in my Test Class I have to use some test data. I searched google and there are many ways like - Parameterized Class, TestNG Data Providers, [junit-dataprovider][1] etc. I though to try TestNG data Provider…
Vivek Malhotra
  • 59
  • 1
  • 2
  • 10
0
votes
2 answers

How to pass the parameter from dataprovider excel sheet to Test method

I am trying to fetch the values from excel sheet using data provider with hash map.For now I can read the entire rows from the excel sheet.The excel sheet has 3 columns "TestcaseId","Testdata","scriptname".Here I need to pass the script name as a…
Ak17
  • 75
  • 3
  • 15
0
votes
1 answer

How to create a 1D Dataprovider method in TestNG?

I am trying to create a testNG dataprovider method which will return an array of objects of a custom class from my project. This array is a one dimensional array and I dont want to return two dimensional array from this dataprovider method. Please…
Nikunj Aggarwal
  • 754
  • 2
  • 12
  • 32
0
votes
1 answer

Is it possible to run a test over a complete data set passing the complete data set in @dataprovider and report the result of the whole?

I have a testNg class where I have to run the same test over a complete set of data. I could provide each data line in the @dataprovider, however, the result for each data line would be displayed in the report file. In my case, I have to test…
Moses
  • 611
  • 5
  • 20
0
votes
2 answers

Running test classes in parallel with @Factory in TestNG

There are 5 test classes in total. Each of them are initialized using @Factory(dataprovider = "data"). What I want to achieve is, the test methods in each test class should run in parallel with the dataprovider instance. Also, the test classes…
Sarath
  • 1,438
  • 4
  • 24
  • 40
0
votes
1 answer

Getting the value of parameters passed in @Factory annotated class using TestNG

Is it possible to get the value of parameters that are used to initialize a @Factory annotated test class from any of the ITestListener, ISuiteListener or any other listener methods? Below is a sample test class. My intention is to get the value of…
Sarath
  • 1,438
  • 4
  • 24
  • 40
0
votes
2 answers

How to pass data from number of sheets in a workbook with the help of dataprovider

I like to pass test data from number of sheets in a workbook with the help of data provider.Means i like to run one test case from one sheet and another test case from another sheet.Is it possible through dataprovider?
Gobi
  • 283
  • 1
  • 5
  • 15