SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Update Record In Database For Selenium WebDriver Test

Main usage of database In selenium WebDriver Is getting records from table and use them In your selenium test as per your requirement. Simple example Is you can use that data to perform data driven testing or you can verify data In tables which you have Inserted through web application
forms. Now supposing you wants to update data directly In MySql data table and then you wants to verify same thing In UI then you can do It very easily.

Note : Please read all previous posts on database testing. Links are listed on THIS PAGE.

Updating specific data cell In MySql database table
In my previous post, We learnt how to select specific record using PreparedStatement Interface. Now we will use executeUpdate() method to update specific record which Is selected by where clause.

Bellow given example will set name = "Danial" where id = 5 In user table. Main thing to learn In this example Is how to write query string and set Its parameters to update specific record. Execute bellow given example In eclipse.

DOWNLOAD UpdateRecordInDB.zip folder. You will get UpdateRecordInDB.java test script file In zip folder when extract It. Import It In your eclipse and then execute


At the end of execution, It will show you databse table records In console as shown In above Image. You can see In Image that records with id = 5 Is updated with name = "Danial". Now If you have website UI then you can check same thing there using selenium webdriver.

No comments:

Post a Comment