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
3 answers

How to call Dataprovider from my Test method with parameters

@DataProvider (name=getData) public static Object[][] getData(){ Excelreader excel = new Excelreader("C:\\WorkspaceExcel\\Datasource.xlsx"); private static String sheetName="SmokeTest"; // Test Data…
user3660045
  • 1
  • 1
  • 3
0
votes
2 answers

WebDriver datadriven (using TestNG) scripts takes a long time to start

I have extended Selenium using the Java WebDriver library and the TestNG framework. When running test scripts, I notice an inordinate amount of time for the test to start execution, when the test takes in input parameters from an Excel file (using…
rs79
  • 2,311
  • 2
  • 33
  • 39
0
votes
1 answer

Can any one help me , my Test Ng annotations are not running .In the Below code my @before class only running but not other

In the below code i am trying to automate gmail by data driven frame work using TestNg , but my code @Before annotation only executing not other two .Please healp me. import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import…
0
votes
0 answers

data provider doesn't take actual file path and read the data

I have used @Dataprovider in testNG test case, what i need to do is take the data from excel and use that data wherever i need in my test. @DataProvider(name="productdata") public Object[][] productdata(){ Object[][]…
autoD
  • 109
  • 2
  • 14
0
votes
2 answers

How to run selenium test in parallel using the same dataprovider

I have a scenario where i need to run my selenium test in parallel using the same data provider. From what i have read it is possible but could not get it to work.I have a hub and a node running on one machine and have another node running on…
Ahmed Yaslem
  • 123
  • 1
  • 4
  • 20
0
votes
2 answers

TestNG and cucumber for integration testing

We are using TestNG for integration testing. is it possible to use the cucumber feature file layer on top of the testNG testcases to have the traceability of test scenarios?
0
votes
3 answers

TestNg - How to merge two dataproviders horizontally

Can you please let me know if we can merge the below 2 dataproviders public Object[][] dp1() { User user = new User(1L, "Arun"); Transaction trx = new Transaction(1L, "atm"); return new Object[][] { new Object[] { user , trx, true …
Tarun Gupta
  • 107
  • 3
  • 16
0
votes
1 answer

How to run test with same data on multiple browser

I am currently struggling running a test on multiple browser using the same data. I have my data in xls file and using data provider to supply the data into my test. But when i run the test on multiple browser parallel, both browser open but nothing…
0
votes
0 answers

Running TestNG tests in parallel

I wanted to run tests defined by TestNG in parallel. I have @DataProvider method which contains the list of IDs @BeforeClass method gets every ID, does some processing and stores the result in the Map. There is one @Test method which uses the values…
0
votes
1 answer

How to get data provider method from TestNG data provider name?

Does anyone know how TestNG figures out what the data provider method is based on the data provider name specified for a test method? I found this solution: https://gist.github.com/ae6rt/3805639 However, it doesn't take into account that the data…
mac
  • 2,672
  • 4
  • 31
  • 43
0
votes
3 answers

How to get total amount of tests (incl. taking data providers into account) at TestNG start?

Can anyone tell me how to get (expected) count of all tests / method executions at TestNG (suite) start? You can easily get the amount of all test methods, but this doesn't count each test method times the amount of the data provider size (each…
mac
  • 2,672
  • 4
  • 31
  • 43
0
votes
1 answer

How @Factory annotation works-TestNG

How this @Factory annotation works, when we need to use @Factory public class Factory1 { @Factory public Object[] testMy() { return new Object[]{new Login1()}; } } Please tell me what below…
J_Coder
  • 707
  • 5
  • 14
  • 32
0
votes
1 answer

I have a testng class inside testng method , invoking another method via reflection it fails to log in testng report

Code Sample : Test1 class would be a parent class which would be responsible to execute Test2 class method import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.testng.annotations.Test; public class Test1…
Rajiv
  • 179
  • 1
  • 2
  • 16
0
votes
1 answer

I am getting this error when executing Testng in selenium

Data Provider public java.lang.Object[] as.get() must return either Object[][] or Iterator[], not class java.lang.Object;
Mani
  • 37
  • 6
0
votes
1 answer

running depend testng method using @factory

Scenario:- My Testdata is 1)String A 2) String B 3) String C Now i have class in which i have data provider and factory and Data provider has 3 value as String public class TestParent { public String tenant; @Factory(dataProvider =…