Database Testing
Last updated
Last updated
Loadmill allows users to execute various queries directly to their DB in order to validate data. This is a very powerful feature as it allows users to check data integrity and accuracy.
To execute a database query:
Go to the relevant test flow within your Test Suite.
Request Method: POST.
Request URL: https://db-relay-service.loadmill.com/api/postgres
Content Type: application/json
Request Body:
See the request example below:
Running this request will return a JSON response with the required data.
To execute MongoDB queries:
Apply the same steps above.
Request URL: https://db-relay-service.loadmill.com/api/mongo
Request Body:
In this example we're searching for a user with the name "John"
The MongoDB service is initially meant for "read-only" purposes (i.e. find). However, using a Docker image privately allows you to use the environment variable ALLOW_ALTERING=true
and by doing so the following options are available:
insertOne
, insertMany
, updateOne
, updateMany
, deleteOne
and deleteMany
.
InsertOne:
updateOne:
deleteOne:
Additional help regarding update operators can be found here.
To execute Redis queries:
Request Method: POST.
Request URL: https://db-relay-service.loadmill.com/api/redis
Request Body:
To execute queries directly to MySQL 5.7:
Request Method: POST.
Request URL: https://db-relay-service.loadmill.com/api/mysql
Request Body:
Request Method: POST.
Request URL: https://db-relay-service.loadmill.com/api/oracle
Request Body:
https://<www.your-domain.com>/api/oracle
Executing queries to your environment DB may require VPN. You can easily overcome this by whitelisting the DB relay service static IPs: [52.42.51.230, 54.190.108.53]
in your firewall.
You can use a Docker image for DB relay service to deploy it in a specific environment.
Find more information here.