exasol / test-db-builder-java   2.1.0

MIT License GitHub

Java library for creating and cleaning up test database structures and contents for integration tests

Test Database Builder Java

Build Status Maven Central – Test Database Builder for Java

Quality Gate Status

Security Rating Reliability Rating Maintainability Rating Technical Debt

Code Smells Coverage Duplicated Lines (%) Lines of Code

Overview

Exasol's Test Database Builder for Java (TDBJ) is a library that makes writing integration tests for database applications easier.

The main design goals are to make the code of the integration test compact and readable at the same time.

In a Nutshell

import com.exasol.dbbuilder.dialects.DatabaseObjectFactory;

class OnlineShopIT {
    final static DatabaseObjectFactory factory;

    @BeforeAll

    static void beforeAll() {
        // ... get a JDBC connection and store it in variable "connection"
        factory = new ExasolObjectFactory(connection);
    }

    @Test
    void testShopItemList() {
        // Test preparation in the database:
        final Schema schema = factory.createSchema("ONLINESHOP");
        final Table table = schema.createTable("ITEMS", "PRODUCT_ID", "DECIMAL(18,0)", "NAME", "VARCHAR(40)")
                .insert("1", "Cat food")
                .insert("2", "Toy mouse");
        final User user = factory.createUser("KIMIKO")
                .grant(CREATE_SESSION)
                .grant(table, SELECT, UDPATE);
        // ... the actual test
    }
}

For more details, please refer to the user guide.

What it is

This module is designed to be used in test code. It helps you write tests, quickly, easily while still focusing on readability.

What it isn't

TDBJ is not suited for production code. We sacrifice speed and features for compactness and ease-of-use. If you are looking for code that helps writing production code, please refer to

Supported Databases

  • Exasol
  • MySQL
  • PostgreSQL

Features

  • Create: schemas, tables, adapter scripts, users, connection definitions, virtual schemas
  • Grant privileges to users
  • Insert data into tables

Customer Support

This is an open source project which is written by enthusiasts at Exasol and not officially supported. We will still try to help you as much as possible. So please create GitHub issue tickets when you want to request features or report bugs.

Table of Contents

Information for Users