Select statement Testing in Selenium

Let’s see, How can you perform Select Statement testing in Selenium. In previous tutorials, We have seen, How can we establish the DB connection and fire query using Java Application.

In this tutorial, We will see how can we verify the DB using assertion in TestNG/JUnit.

 

Suppose we have a scenario, We are going to release an application in the market and we are providing some sample Data in the database with the application. Now we need to verify that data, is that present in the application.

The best way to perform this is automation testing.

 

You can design automation scripts and you can execute them before release.

We know in our database ‘seleniumbix’ we have the table ’emp’. Now we are going to verify that record with empID =1 is persisted in the DB or not.

 

Select Statement Testing in Selenium

We keep the expected data in different files and compare these with the actual data. Let’s see, How we can do this –

 

In the above example, we can see clearly, How we can verify the DB in selenium.

 

Let’s talk how can we use this is real life examples, Suppose you have automated test case ‘User Registration’ and in your test case you need to verify that data is persisting in DB or not. So in the first test script, you can perform the Registration process and create second Test script using TestNG make it dependent on the first script, In this second script you can verify the same data in the database using the way what we have described in this tutorial.

 

There could be many possible scenarios, In these, we can verify the DB. We can verify our DB after each DML operation and make sure our application is working fine.

So in real life testing scenarios there could be many possible scenarios but now you are able to perform all kind of DB Testing in selenium.

 

I hope these tutorials are helping you, in the case of any query you can write us on our given email.

0 Comment

Leave a Reply