DB Testing in Selenium

Price: INR 8,999.00
Price: INR 14,999.00
Was: INR 16,999.00

Let’s see, How can you perform DB Testing in Selenium. In this tutorial we will see, How can we write the Database testing script in Selenium using TestNG.

It’s very easy to perform the Database testing using TestNG.


In our example, we will parameterize the DB Connection Test using TestNG. Suppose we have a Test Case test DB Connection before performing any query on Database. In this tutorial, we will perform this testing using TestNG.


DB Testing in Selenium

We will test the Database Connectivity test using TestNG parameterization .

To explore more about TestNG, Learn TestNG Tutorial from here.

Let’s test the Database Connectivity Test using TestNG.


In above example, We have Parameterized the Test Case using testng.xml file.

(You can learn the complete TestNG Parameterization tutorial from here!)


Let’s see the structure of our Testng.xml file.

<!DOCTYPE suite SYSTEM “http://testng.org/testng-1.0.dtd” >

<suite name=”DBTestSuite” parallel=”methods” thread-count=”1″>


        <listener class-name=”org.uncommons.reportng.HTMLReporter” />
        <listener class-name=”org.uncommons.reportng.JUnitXMLReporter” />

    <test name=”Verify the DB Connection”>

        <!– Declare Parameters –>
        <parameter name=”dbUrl” value=”jdbc:mysql://localhost:3306/” />
        <parameter name=”db_Name” value=”seleniumbix” />
        <parameter name=”user_Name” value=”root” />
        <parameter name=”pass” value=”anshul123″ />

            <class name=”com.Seleniumbix.WebDriver.DBTestParameterization” />



Now let’s execute our TestNG test suite using testng.xml and verify the test result in Test Report. Now execute the Test report.

0 Comment

Leave a Reply