@DataProvider being a MySQL DataBase- JAVA,Selenium,Real time examples



In TestNG we use the @DAtaProvider for passing the data values to the testcases. In majority of these cases the Data source used as an two dimensional Array,XLS or XLSX.
In this post we will look into the example where the Data source is MYSQL. For using the MYSQL to read the contents of the DB we have to use the following dependency in the maven pom.xml.
MYSQL Connector Dependency

Preconditions:

  1. Install MYSQL in the laptop. Refer to the

    link

    for more details on installation,configuration and examples on MYSQL.

  2. Open Workbench and make sure the MYSQL server is started.

for more information on installation.

DataProvider Example using DataSource as MYSQL

Refer to the pom.xml details as mentioned below:

OUTPUT

PASSED: login(“james”, “1000”)
PASSED: login(“john”, “2000”)

Leave a Reply

Your email address will not be published. Required fields are marked *