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

Testng - Skip dependent tests for only failed data sets

I am attempting to modify my dependent tests so they are ran in a specific way and have yet find a way possible. For instance, say I have the following two tests and the defined data provider: @Dataprovider(name = "apiResponses") Public void…
0
votes
1 answer

How to get testcase data on method invocation in TestNG?

I am using the IInvokedMethodListener in the TestNG package to listen for each method execution of my test case. In each method, I am trying to retrieve the data (test case data) for each case. I have been searching around the API but am unable to…
toffee.beanns
  • 435
  • 9
  • 17
0
votes
1 answer

How to read a numeric value (i.e. double value) from excel sheet using apache poi

When I am passing numeric values into excel sheet, it is taking as double so that there was DataProvider Mismatch exception. How to handle this exception and how to pass only numeric values instead of double values? Below is my…
Vidhya Hari
  • 13
  • 1
  • 8
0
votes
1 answer

Selenium/TestNG: How to run a part of code only once with DataProvider

Is there a way I can use Data Provider for only part of the code but not for the entire class? For example, if I want to do 1. Function A - Login 2. Function B - X (with 5 rows in the data sheet excel and I'd like this function to repeat for 5…
0
votes
3 answers

Using Selenium WebDriver with TestNG and DataProviders - how to assert?

I'm trying to test the login functionality of a website. I want my first test case to provide invalid credentials with the first set of data that I defined in the DataProvider method. Than I want to execute the first assert…
oren kostin
  • 169
  • 3
  • 7
0
votes
0 answers

I need to avoid passing multiple arguments from the data provider

Using data provider I am fetching data from excel into a class and the test class contain multiple @Test. So now I need to pass all the arguments in the data provider to all the tests instead of using required parameters in a Test. So is there any…
Raj
  • 1
  • 1
0
votes
1 answer

How to run conditional TestNG Tests with data from Excel

I have a class with multiple @Test methods each with a different functionality. class myTests { @Test test1() { ............... } @Test test2() { ............... } } Am following the Data driven approach where I have the data in Excel. Each row…
0
votes
0 answers

How to use DataProvider with a lot objects (TestNG)

could you please help me with my problem. I am running testNG UT. Code dataProvider is: @DataProvider(name = "inputData") private Object[][] createInputData() { return new Object[][] { {new Object1 (1, "string", "string",…
liotur
  • 809
  • 2
  • 17
  • 36
0
votes
2 answers

Selenium java testNG: Is it possible to use dataprovider data partially in testng test method

I am new to Page-Object model automation using selenium and java. I am using the Page Object model and have each page as a single class and the actions in that page as methods.Using excel to keep read test data. I have a test for searching for…
0
votes
1 answer

How can I read different datatypes from excel using @dataprovider in testNG

I am trying to get input from excel for my testcase . My input contains both string and numeric values. I know how to retrieve value for single datatype using the below code public Object[][] readnumericvalue() throws IOException { File src =…
Manoj Kumar
  • 93
  • 1
  • 3
  • 11
0
votes
2 answers

TestNG Dataprovider Need help to run @Test individually based on test data

I'm working on Rest API testing (POST method) for which I'm reading json data from spreadsheet using TestNg Dataprovider. My Dataprovider returns HashMap with key: Integer Row_Number and value: ArrayList (String) of test data. Below is the sample…
0
votes
2 answers

Dataprovider in Testng using ITestContext

I am trying to use data provider using ITestContext and Groups using xml but i am getting error and not sure how to resolve it. Can someone please check and let me know. Actual class to run is below which consumes data provider class in another…
puchu
  • 69
  • 1
  • 9
0
votes
1 answer

TestNG data provider with folder contents using lambda

I want to give a list of file names through a TestNG data provider, so the test can load each file. Object[][] result = Files.list(Paths.get("tst/resources/json")) .filter(Files::isRegularFile) .map(fileName -> new Object[] {…
Cristian Cotoi
  • 163
  • 1
  • 7
0
votes
1 answer

How to exclude methods with particular invocation numbers in testng xml?

**** The above testng XML simply excludes the "testMethod" as a whole. However, if I replace…
Ela
  • 313
  • 3
  • 14
0
votes
1 answer

How to read data from 2 sheets of same excel using same DataProvider in same class in Selenium WebDriver

I tried searching for relevant information for this question but wasn't able to find. Here is the question: There are 2 sheets in same excel. I want to print the data from both sheets using TestNG DataProvider only once in the same…
user0450
  • 15
  • 1
  • 5