O'Reilly logo

Selenium Testing Tools Cookbook by Unmesh Gundecha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reading test data from a database using JUnit and JDBC

In the earlier recipes, we used CSV and Excel spreadsheets to maintain the test data and read this test data in JUnit.

The test data can also be read from a database. This works similar to the previous recipes, however, we will create a helper method using JDBC to read the test data from a Microsoft Access database. This recipe can be used with any database.

Getting ready

  • Set up a new project and add JUnit4 to the project's build path.
  • Create a database with the required data in a test data table. This example uses a Microsoft Access database. The sample file is available with the book's sample code.

How to do it...

Let's implement a parameterized test with CSV by using the following steps:

  1. Create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required