-
Notifications
You must be signed in to change notification settings - Fork 2
Databases Commands
Testlum provides built-in commands to interact with various databases directly from your test scenarios.
You can query, validate, and manipulate data across several types of databases without writing custom code.
- 📊 ClickHouse
- 🌿 Dynamo DB
- 🍃 MongoDB
- 🐬 MySQL
- 🏛️ Oracle DB
- 🐘 PostgreSQL
- 🔥 Redis
- 🛠️ Any Sql Database
ClickHouse
Type: Columnar Database
Description:
ClickHouse is an open-source, columnar database management system designed for online analytical processing (OLAP).
It is optimized for fast analytics on large volumes of data and is ideal for real-time reporting.
Testlum allows executing ClickHouse queries within your testing scenarios.
The <clickhouse>
tag sends SQL queries to a ClickHouse database and optionally validates the result.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the query execution |
alias |
String | ✅ | Unique database alias configured in integration.xml
|
query |
String | ✅ | SQL query to be executed on ClickHouse |
file |
String | ✅ | File name (expected_n.json) containing the expected query result for comparison (JSON) |
condition |
Boolean Expression | ❌ | Optional condition for conditional execution |
threshold |
Integer (ms) | ❌ | Maximum execution time allowed for the command |
<clickhouse comment="Get all users from system" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> </clickhouse>
✅ You can include multiple
<query>
blocks inside a single<clickhouse>
command if you need to perform several queries in sequence.
<clickhouse comment="Run multiple queries" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> <query>SELECT * FROM t_orders</query> </clickhouse>
✅ Tips:
- Use the
file
parameter to validate query results automatically.- Use
threshold
to ensure query execution time is within acceptable limits.alias
must match the configuration in yourintegration.xml
.- Multiple
<query>
blocks can be executed sequentially within one<clickhouse>
command.
DynamoDB
Type: NoSQL Database
Description:
DynamoDB is a managed NoSQL database service provided by AWS.
It is designed for low-latency, high-performance, and scalable applications.
DynamoDB automatically adjusts its capacity based on traffic demands.
Testlum allows executing DynamoDB queries directly within your testing scenarios.
The <dynamo>
tag sends operations to a DynamoDB table and optionally validates the response.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the query or operation |
alias |
String | ✅ | Unique database alias configured in integration.xml
|
query |
String | ✅ | DynamoDB query or command |
file |
String | ✅ | File with expected results for validation |
condition |
Boolean | ❌ | Optional condition for conditional execution |
threshold |
Integer (ms) | ❌ | Maximum allowed execution time for the command |
<dynamo comment="Get all users from system" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> </dynamo>
✅ You can include multiple
<query>
blocks inside a single<dynamo>
command if you need to execute several DynamoDB queries sequentially.
<dynamo comment="Run multiple queries on DynamoDB" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> <query>SELECT * FROM t_orders</query> </dynamo>
✅ Tips:
- Use
file
to automatically compare the real response with the expected one.- Multiple
<query>
blocks are supported within one<dynamo>
command.- Keep your DynamoDB queries lightweight to ensure low-latency execution.
- Ensure that the
alias
matches the one defined inside yourintegration.xml
.
MongoDB
Type: NoSQL Database
Description:
MongoDB is a document-oriented NoSQL database that stores data in flexible, JSON-like BSON documents.
It is built for scalability and flexibility, making it perfect for applications dealing with evolving and diverse data structures.
Testlum allows executing MongoDB queries directly from your testing scenarios.
The <mongo>
tag is used to send operations to a MongoDB database and optionally validate the response.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the MongoDB query execution |
alias |
String | ✅ | Unique database alias configured in integration.xml
|
query |
String | ✅ | MongoDB query to be executed |
file |
String | ✅ | Expected result file for comparison (in JSON format) |
condition |
Boolean | ❌ | Condition for executing the query |
threshold |
Integer (ms) | ❌ | Max allowed execution time for the query |
<mongo comment="Get all users from system" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> </mongo>
✅ You can include multiple <query>
blocks inside a single <mongo>
command to run several queries sequentially.
<mongo comment="Run multiple queries on MongoDB" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> <query>SELECT * FROM t_orders</query> </mongo>
✅ Tips:
- Use the
file
parameter to automatically compare query results. - MongoDB queries are flexible; you can also construct advanced queries (aggregations, filters, etc.).
-
alias
must match exactly with the MongoDB configuration insideintegration.xml
. - Multiple queries inside one
<mongo>
command help you optimize database interaction during testing.
MySQL
Type: Relational Database Management System (RDBMS)
Description:
MySQL is a popular open-source relational database known for its speed, reliability, and ease of use.
It supports SQL and is commonly used in web applications, especially as part of the LAMP stack (Linux, Apache, MySQL, PHP/Python).
Testlum allows executing MySQL queries directly from your testing scenarios.
The <mysql>
tag sends SQL queries to a MySQL database and optionally validates the result.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the query action |
alias |
String | ✅ | Unique alias from your integration.xml
|
query |
String | ✅ | SQL query string to execute |
file |
String | ✅ | Expected result file for automatic validation |
condition |
Boolean | ❌ | Conditional execution of the query |
threshold |
Integer (ms) | ❌ | Max allowed query execution time |
<mysql comment="Get all users from system" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> </mysql>
✅ You can include multiple <query>
blocks inside a single <mysql>
command to execute several SQL queries sequentially.
<mysql comment="Run multiple queries on MySQL" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> <query>SELECT * FROM t_orders</query> </mysql>
✅ Tips:
- Use the
file
parameter to automatically validate query results.- Be sure your SQL syntax matches MySQL standards (especially for functions and joins).
- Always match the
alias
with your MySQL database configuration inintegration.xml
.- Group related queries inside a single
<mysql>
block for better performance and readability.
Oracle DB
Type: Relational Database Management System (RDBMS)
Description:
Oracle is a powerful, commercial relational database system known for its performance, reliability, and advanced features.
It supports SQL and offers capabilities like partitioning, clustering, and enterprise-level security.
Testlum allows executing Oracle database queries easily within your test scenarios.
The <oracle>
tag sends SQL queries to an Oracle database and optionally validates the result.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the database operation |
alias |
String | ✅ | Unique Oracle connection alias defined in integration.xml
|
query |
String | ✅ | SQL query string to execute |
file |
String | ✅ | JSON file with expected query results for validation |
condition |
Boolean | ❌ | Optional execution condition |
threshold |
Integer (ms) | ❌ | Maximum allowed query execution time |
<oracle comment="Get all users from system" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> </oracle>
✅ You can include multiple <query>
blocks inside a single <oracle>
command if you want to run several SQL statements in sequence.
<oracle comment="Run multiple queries on Oracle" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> <query>SELECT * FROM t_orders</query> </oracle>
✅ Tips:
- Oracle SQL can differ slightly from MySQL/PostgreSQL — especially in syntax for sequences, functions, and joins.
- Always ensure the
alias
matches your Oracle DB configuration inintegration.xml
.- You can group logically related queries inside a single
<oracle>
block to optimize execution and validation.
PostgreSQL
Type: Relational Database Management System (RDBMS)
Description:
PostgreSQL is an open-source, object-relational database system renowned for its extensibility, support for diverse data types, and standards compliance.
It emphasizes SQL flexibility and is highly favored for complex and modern application needs.
Testlum enables you to send PostgreSQL queries directly within your testing scenarios.
The <postgres>
tag is used to execute SQL queries on a PostgreSQL database and optionally validate results.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the query execution |
alias |
String | ✅ | Unique alias configured inside integration.xml
|
query |
String | ✅ | SQL query string to be executed |
file |
String | ✅ | JSON file with expected query results for validation |
condition |
Boolean | ❌ | Condition under which this query should be executed |
threshold |
Integer (ms) | ❌ | Maximum execution time allowed for the query |
<postgres comment="Get all users from system" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> </postgres>
✅ You can include multiple <query>
blocks inside a single <postgres>
command to run several queries sequentially.
<postgres comment="Run multiple queries on PostgreSQL" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> <query>SELECT * FROM t_orders</query> </postgres>
✅ Tips:
- PostgreSQL supports advanced SQL features like CTEs, window functions, and JSON fields — leverage them in your queries!
- Always match the
alias
exactly with your PostgreSQL database setup inintegration.xml
.- Use
file
validation for automatic checks of query results during your testing flows.
Redis
Type: In-Memory Key-Value Store
Description:
Redis (Remote Dictionary Server) is an open-source, in-memory data structure store known for its extremely fast performance.
It supports various data types such as strings, hashes, lists, sets, and sorted sets, and features persistence, replication, pub/sub messaging, and Lua scripting.
Redis is often used as a cache, message broker, or real-time database in modern applications.
Testlum allows executing Redis commands directly inside your test scenarios.
The <redis>
tag sends queries (commands) to a Redis server.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the Redis operation |
alias |
String | ✅ | Unique Redis connection alias configured in integration.xml
|
file |
String | ✅ | File containing the expected query results |
query |
Complex Structure | ✅ | Represents a single Redis command and its arguments |
condition |
Boolean | ❌ | Conditional execution of the command |
threshold |
Integer (ms) | ❌ | Maximum allowed execution time for the command |
Each <query>
can contain:
Element | Required | Description |
---|---|---|
<command> |
✅ | Redis command (e.g., GET , SET , DEL ) |
<arg> |
✅ (at least one) | Arguments for the command (e.g., keys, values) |
✅ **Each <query>
must contain exactly one <command>
and any number of <arg>
elements depending on the command needs.
<redis comment="Check ability to get key-value pair using GET command" alias="MY_REDIS" file="expected_1.json"> <query> <command>GET</command> <arg>name</arg> </query> </redis>
<redis comment="Check ability to execute two queries inside one 'redis' command" alias="MY_REDIS" file="expected_2.json"> <query> <command>SET</command> <arg>name</arg> <arg>John</arg> </query> <query> <command>GET</command> <arg>name</arg> </query> </redis>
✅ You can include multiple
<query>
blocks inside a single<redis>
command to perform complex operations sequentially.
✅ Tips:
- Redis commands are extremely fast — but setting a
threshold
helps catch unexpected slowdowns.- Remember: each
<query>
= one Redis command (but unlimited<arg>
parameters are allowed).- Use the
file
parameter to validate expected Redis server responses automatically.- Match your
alias
exactly with what you configured inintegration.xml
.
Any other database integration
Type: Columnar Database
Description:
This allows you to execute tests against any SQL database without being tied to a particular database implementation. This command is designed to be flexible, enabling you to test a variety of databases by simply adding the appropriate JDBC driver for the database of your choice.
Testlum allows executing sql queries within your testing scenarios.
The <sqlDatabase>
tag sends SQL queries to a any sql database and optionally validates the result.
Parameter | Type | Required | Description |
---|---|---|---|
comment |
String | ✅ | Description of the query execution |
alias |
String | ✅ | Unique database alias configured in integration.xml
|
query |
String | ✅ | SQL query to be executed on any relational database |
file |
String | ✅ | File name (expected_n.json) containing the expected query result for comparison (JSON) |
condition |
Boolean Expression | ❌ | Optional condition for conditional execution |
threshold |
Integer (ms) | ❌ | Maximum execution time allowed for the command |
<sqlDatabase comment="Get all users from system" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> </sqlDatabase>
✅ You can include multiple
<query>
blocks inside a single<sqlDatabase>
command if you need to perform several queries in sequence.
<sqlDatabase comment="Run multiple queries" alias="ALIAS" file="expected_1.json"> <query>SELECT * FROM t_user</query> <query>SELECT * FROM t_orders</query> </sqlDatabase>
✅ Tips:
- Use the
file
parameter to validate query results automatically.- Use
threshold
to ensure query execution time is within acceptable limits.alias
must match the configuration in yourintegration.xml
.- Multiple
<query>
blocks can be executed sequentially within one<sqlDatabase>
command.
✅ Tip:
Database commands can be combined with API, Web, or Mobile scenarios to create full end-to-end test workflows!