DB Testing using Queries
Loadmill provides a service that allows users to execute various queries directly to their DB in order to validate data.

Usage

Postgres

To execute a query:
    1.
    Go to a relevant test flow within a Test Suite.
    2.
    Select "POST" as request Method, put URL - https://db-relay-service.loadmill.com/api/postgres
    3.
    Choose "application/json" as Content-type.
    4.
    Put the request body with the following structure:
1
body: {
2
"connectionString": "postgres://...",
3
"query": "SELECT * FROM USERS"
4
}
Copied!
See a request example below:
By running the request, you will get a response in JSON format and be able to operate the data.

MongoDB

Execute queries directly to MongoDB:
https://db-relay-service.loadmill.com/api/mongo
1
body: {
2
connectionString: 'mongodb://...',
3
collection: 'bios',
4
command: 'find',
5
query: { "awards.award": "Turing Award" }
6
}
Copied!

Redis

Execute queries directly to Redis:
https://db-relay-service.loadmill.com/api/redis
1
body: {
2
{
3
connectionString: "redis://...",
4
command:"get | hget | hgetall",
5
key:"any-key",
6
field: "any-field"
7
}
8
}
Copied!

DB relay service static IPs

Sometimes, executing queries to your env DB may require VPN. You can easily avoid this by whitelisting the DB relay service static IPs: [52.42.51.230, 54.190.108.53] in your firewall.

Docker image

You can also use a docker image for DB relay service to deploy it in a specific environment of yours, find more information here.
Last modified 4d ago