6. Get Data From the MySQL Database

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
  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
  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

Configure a JDBC connection

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

    ReadyAPI: Selecting the type of the data source
  2. To configure the connection string, click Configure.

    ReadyAPI: Opening the Database Configuration dialog
  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.

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

    ReadyAPI: The JDBC data source configuration
  7. For this tutorial, you need to set a limit for the amount of data you will get from the database.

    Click configure-new.png in the data source toolbar at the top.

    source-options.png
  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

Publication date: