Integrate Momentum Suite Automate with MySQL

A. Introduction

momentum suite integrations collaborate with mysql databases

Momentum Suite Automate provides a good experience for those who do not have enough software development knowledge. This plugin allows you to establish various connections of MySQL, and read, and write data into the database easily. Dynamically create DB Test Data files support for automation needs.

B. Configuration

1. Login to Momentum Suite Automate and go to the Settings page.

login to momentum suite automate

2. Under the Data Sources tab, click the MySQL icon.

Screen Shot 2022 09 27 at 15.25.06

3. After clicking, a pop-up gives you information about the integration, comes up. Click Setup on it.

Screen Shot 2022 09 27 at 15.25.58

4. After clicking the Setup, fill in your database connection strings.

image 42

B.1. Connection within your code

B.1.1. Javascript Usage

const { DB } = require('../setup/database-connector');
 
  before(async function () {
    connection = await DB.mySqlConnection(
      process.env.db_host,
      process.env.db_user,
      process.env.db_password,
      process.env.db_name
    );
    // await driverHelper.getDriver((connector) => {
    //   driver = connector;
    // });
  });
  
   it('Step_16624', async function () {
    connection.connect((err) => {
      if (err) console.log(err);
      console.log('connection successfuly');
    });
  });

B.1.2. Java Usage

import java.sql.Connection;

public void BeforeAll() throws MalformedURLException, Exception {
        driver = DriverManager.CreateDriver();
        _connection = DatabaseConnector.GetMySqlConnection(System.getenv("db_host"),
                System.getenv("db_user"),
                System.getenv("db_password"),
                System.getenv("db_name")
                );
    }

B.1.3. C# Usage

private MySqlConnection _connection;

_connection = DatabaseConnector.CreateMysqlConnection(
                Environment.GetEnvironmentVariable("db_host"),
                Environment.GetEnvironmentVariable("db_user"),
                Environment.GetEnvironmentVariable("db_password"),
                Environment.GetEnvironmentVariable("db_name")
            );
Table of Contents