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.
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.
This module is designed to be used in test code. It helps you write tests, quickly, easily while still focusing on readability.
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
- Exasol
- MySQL
- PostgreSQL
- Create: schemas, tables, adapter scripts, users, connection definitions, virtual schemas
- Grant privileges to users
- Insert data into tables
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.