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 data. Is it possible to use TestNG parameterization. If it is the case can anyone explain to me how these can be parameterized using TestNG??
Asked
Active
Viewed 339 times
0
-
Welcome to Stack Overflow! Please read [ask] and [How much research effort is expected?](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) Please provide the code you have tried and the execution result including any error messages, etc. – JeffC May 06 '17 at 19:36
-
@JeffC thank you for your response we are having different testcases and the test data is different for each test case in the csv files.So,how should I use TestNG?? – Raja Ram May 07 '17 at 13:46
-
I read your question. Did you read the links I posted? You haven't shown an appropriate amount of research into your own question. SO is not a code writing service. – JeffC May 07 '17 at 22:41
-
@JeffC I am not asking you to write a code and I will never expect without doing some effort. But what I am asking is a suggestion that's it and thanks for your contribution. – Raja Ram May 08 '17 at 05:12
1 Answers
0
Use DataProviders where you read in your CSV file. You'll have one DataProvider function per CSV file. I suggest you read up on DataProviders on the official docs and about how to read in a CSV file anywhere else, e.g. mkyong.com
Hint: this has nothing to do with Selenium, but only with TestNG.

Hubert Grzeskowiak
- 15,137
- 5
- 57
- 74
-
thank you for your reply. Here I am facing a situation like I have to test the same case with different data some where around 30 times. Is it possible to use TestNG DataProvider at that time. – Raja Ram May 06 '17 at 17:07
-
When using a test with a DataProvider the test method is run once per line of your CSV. The DataProvider uses a two-dimensional array, which in your case will be rows and columns of the CSV. – Hubert Grzeskowiak May 06 '17 at 17:10
-
Grzeskowaik we are having different testcases and the test data is different for each test case in the csv files.So,how should I use TestNG?? – Raja Ram May 07 '17 at 13:48
-
@RajaRam a DataProvider is a function that reads in a CSV file and returns it in a two-dimensional array. You use such providers on your test methods. Usually you use one DataProvider per test method. That one test method is then executed as many times as there are rows in the CSV file. For multiple CSV files you would write multiple DataProviders. So each CSV file corresponds to one test method (or class if applicable). – Hubert Grzeskowiak May 15 '17 at 03:01