6. Get Data From the MySQL Database

Applies to ReadyAPI 3.10, last modified on November 23, 2021

Now you have a test case and a project, so you can create the Data Source test step.

Create a data source

  1. In the request editor, click the Generate Values button:

    ReadyAPI: Generating values

    Click the image to enlarge it.

  2. In the Create Data-Driven Loop dialog, select the request parameters that will be configured automatically:

    ReadyAPI: Create Data-Driven Loop dialog

    ReadyAPI will automatically create a data source loop and add a property expansion that will refer to the email property in the Data Source test step:

    ReadyAPI: The project with the data source loop

    Click the image to enlarge it.

  3. Open the Data Source test step. As you see, ReadyAPI has automatically configured the data source to generate random email addresses as values of the email property:

    ReadyAPI: The data source step

    Click the image to enlarge it.

Configure a JDBC connection

  1. In the data source editor, select the JDBC data source type.

    ReadyAPI: Selecting the type of the data source

    Click the image to enlarge it.

  2. To configure the connection string, click Configure.

    ReadyAPI: Opening the Database Configuration dialog

    Click the image to enlarge it.

  3. In the Database Configuration dialog, select the MySQL JDBC driver.

    • Specify the settings of your MySQL Server: the host, port and so on.

    • In the Database field, specify the sakila sample database.

    • Click Test connection to verify the settings are correct.

    ReadyAPI: The Database Configuration dialog
  4. Click Yes in the Change Connection Properties dialog.

  5. The Build SQL Query wizard will appear.

    • Select the customer table in the list of tables and check the email column in the list of table columns.

    • In the Alias column, input email – the name of the property in the data source test step.

      ReadyAPI: The Build SQL Query wizard

      Click the image to enlarge it.

  6. Click OK to add your new query to the data source configuration.

    ReadyAPI: The JDBC data source configuration

    Click the image to enlarge it.

  7. For this tutorial, you need to set a limit for the amount of data you will get from the database.

    Click in the data source toolbar at the top.

    ReadyAPI: Opening the data source test step options
  8. On the Settings tab, set End Row to 5.

    ReadyAPI: Setting the row limit
  9. Click OK.

Now you can run your test.

Prev          Next

See Also

MySQL Databases as Data Sources

Highlight search results