MySql@1

MySql@1 provider lets you read data from MySQL, MariaDB, Azure database for MySQL and other database systems compatible with MySQL.

MySql@1 provider works out-of-the-box, you don’t need any drivers installed.

Example

This example shows how to connect to two databases, one is MariaDB running localy on your computer, one is an Azure database for MySQL:

Data Sources:

- Name: DWH
  Provider: Mysql@1
  Connection string: Server=localhost;User ID=root;Password=%TESTING_PASSWORD%;Database=aero

- Name: Azure DWH
  Provider: Mysql@1
  Connection string: >
    Server=aero.mysql.database.azure.com;
    User ID=craftsman;
    Password=%TESTING_PASSWORD%;
    Database=Aero;
    SslMode=Required;

Notice you can use an environment variable instead of real password (enclose the environment variable name with percents). See How to work with Passwords.

Details

This provider is built on top of MySqlConnector for .NET.

For connection options, please review this site: https://mysqlconnector.net/connection-options/

The driver supports all major “variants” of MySQL, like Amazon Aurora RDS, Azure Database for MySQL, Google Cloud SQL for MySQL, MariaDB, and even MySQL :-) If you are not sure if your server is compatible with this driver, please check this site: https://mysqlconnector.net/#server-compatibility.

For more details about the underlying driver, please review these:

Prerequisites

CAT already contains the underlying drivers out of the box, you don’t need to install any other prerequisites.

Storing Test definitions and Data Source definitions in DB

Reading and testing data is not the only purpose of providers. You can also use them for retrieving (potentially also automatically generating) test defintions and / or data sources.

Any SQL statement that returns columns expected by Test definition or Data source defintition will work. But if you want to persist those, you might find useful these scripts that prepares the necessary tables:

CREATE TABLE test.cat_test_definition
(
  cat_test_definition_id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
  test_suite VARCHAR(300) NULL,
  `order` INT NULL,
  test_case VARCHAR(300) NULL,
  test_name VARCHAR(300) NOT NULL,
  `description` TEXT NULL,
  first_data_source VARCHAR(200) NULL,
  first_query TEXT NULL,
  second_data_source VARCHAR(200) NULL,
  second_query TEXT NULL,
  expectation VARCHAR(50) NOT NULL,
  categories VARCHAR(100) NULL,
  tolerance DECIMAL(19, 4) NULL,
  timeout INT NULL,
  `key` VARCHAR(100) NULL,
  maximum_errors_logged INT NULL
);
CREATE TABLE test.cat_connection_definition(
  connection_definition_id INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
  `name` VARCHAR(200) NOT NULL,
  `provider` VARCHAR(200) NOT NULL,
  connection_string VARCHAR(2000) NOT NULL
);

Just fill them up with data and let CAT know about them (see Project files).