• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in Selenium by
Q:
How can we create a data-driven framework using TestNG?

1 Answer

0 votes
by
By using @DataProvider annotation,  we can create a Data Driven Testing Framework.

@DataProvider(name="getData")

public Object[][] getData(){

//Object [][] data = new Object [rowCount][colCount];

Object [][] data = new Object [2][2];

data [0][0] = "FirstUid";

data [0][1] = "FirstPWD";

data[1][0] = "SecondUid";

data[1][1] = "SecondPWD";

return data;

}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

@DataProvider(name="getData")

 public Object[][] getData(){

 //Object [][] data = new Object [rowCount][colCount];

 Object [][] data = new Object [2][2];

 

 data [0][0] = "FirstUid";

 data [0][1] = "FirstPWD";

 

 data[1][0] = "SecondUid";

 data[1][1] = "SecondPWD";

 

 return data;

 

 }

Practical Example

Related questions

+1 vote
asked Aug 22, 2019 in Selenium by john ganales
0 votes
asked Aug 22, 2019 in Selenium by john ganales
...