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

Pass dynamic value to test method parameter using TestNG class

I am automating a web page which runs in multi-threading environment, so I am exporting every test result into a file system and I wanted to maintain every test result uniquely for the future reference. So is there a way to pass file name as…
Rajesh Hatwar
  • 1,843
  • 6
  • 39
  • 58
0
votes
1 answer

Dataprovider anotation - Testng Selenium Java

Query - The last set of values keep failing, the error that i am getting is that its unable to fine the xpath, but its working fine for other two cases. So a bit confused. I have pasted the error code as well. Would appreciate any help I can get.…
0
votes
4 answers

is it possible to pass dynamic number of parameters to same testng test with same dataprovider?

I have a testng test method and a data provider for it. I want to make the test case reusable for multiple clients that have this feature to be tested. The only catch is that the feature works differently on different clients that is I have to…
Prasanta Biswas
  • 761
  • 2
  • 14
  • 26
0
votes
1 answer

How to delete data only after all tests, based on inputs from data provider, are run?

I've a test with different inputs, hence used @DataProvider but before inputs, from Object[][], passed to a test, I want to create some data which is common to test with all different inputs @DataProvider(name = "test") public Object[][]…
Alpha
  • 13,320
  • 27
  • 96
  • 163
0
votes
0 answers

Execution is overlapped nodes created by docker selenium grid and distribution with testNG data provider how avoid this?

I am using Docker selenium Grid. Created multiple nodes and Success with launching my scripts in single node but when i use multiple nodes my execution statements has been passes to recent activated node. Ex: I have login verification and this is…
0
votes
1 answer

If we have data in 30 csv files how to parameterize those 30 csv files data using TestNG in Selenium?

I am new to selenium but we have created a data driven framework in Selenium and we are placing all the data into spreadsheets and we are reading the data and we have 30 CSV files and we are reading it with a java code, containing a huge amount of…
Raja Ram
  • 109
  • 4
  • 11
0
votes
2 answers

Can we create run time dataProvider in TestNg

Can we have something like this where public class NewTest { private List id= new ArrayList(); @Test public void Test1() { id.add("First Value"); id.add("Second Value"); id.add("Third Value"); id.add("Fourth…
NiNa
  • 111
  • 1
  • 4
0
votes
0 answers

How can i call all tests methods using testng inside a class where testId's from excel is equal to tests methods

This is sample sample code trying to fetch all test Id's from excel and I need to execute corresponding test methods where testid = testmethod
0
votes
0 answers

Use of TestNG @Test and @DataProvider Features causes log4j to write multiple log file entries

I am using Selenium with TestNG to run automated tests and log4j v1.2 to write log files… TestNG has an @Test and an @DataProvider annotation feature that allows me to pass parameters saved in an Excel file to my test method… When I only have one…
0
votes
1 answer

Facing issue with parallel test execution in TestNG when using @DataProvider with TestNG XML

I've written a TestNG class which contains two methods (one@DataProvider, one @Test) public class BaseTestNG extends BaseTest{ @DataProvider(name="Demo", parallel=true) public Object[][] getData() { Object[][] data = new…
Nagaraj
  • 78
  • 9
0
votes
1 answer

How to carry testNG instance to another class

As IS: Step 1: I am creating instance of testng in servelt.doPost method. public void dummyDoPost(){ TestListenerAdapter adapter = new TestListenerAdapter(); testNG = new TestNG(); List listnerClasses = new…
0
votes
2 answers

How to set a distinct title for each set of data in a parameterized test in testng?

I want to see a different title in each test case. Now the title is created from the method name. Same titles Is it possible to get a title somehow as a step? @Title("Maybe as step: {0}?????") @Step("{0}") @Test(dataProviderClass =…
0
votes
0 answers

Selenium/Java-How to make 'dataProvider' a common function inbetween multiple source folders

I have created a project with seperate source folder for each module, say mod1 & mod2 and the src source folder as common for each source folder. And I created DataProvider_Repository.java file for reading data from excel sheet. Which now I need to…
Adithya
  • 1,687
  • 3
  • 19
  • 34
0
votes
2 answers

Selenium_testng_Java_passing data to both @beforetest and @test

I have my TesTng class with 3 test (A,B, C) and this class extends base class which has @beforemethod and @ aftermethod Now I want to pass browser to @ before method and email to method A Below is my sample data. Email has to be unique every time.
Mahen
  • 9
  • 1
  • 4
0
votes
1 answer

How to fetch URL from excel to @BeforeTest for different Env using DataDriven Testing with TestNG

In this scenario I just wanted to iterate all the Environment one by one using dataprovider or any other way that could be possible. Please see my attached excel file Code for one Environment: LTI given below. Note: Same Code is repeated for all…