Run database query, add validations, and extract values | BrowserStack Docs

Run database query, add validations, and extract values

Learn how to connect to database and run SQL queries in Low Code Automation to validate data and extract dynamic values.

This feature lets you connect and query your databases directly in Low Code Automation. There is no extra backend setup needed outside the Low Code Automation platform. You can effortlessly run SQL queries within your automated tests, validate backend data in real-time, and extract dynamic test data. This eliminates the need for extra handling and streamlines your testing process.

Supported databases

Low Code Automation currently allows connections to the following databases:

Prerequisites for internal databases

You can connect Low Code Automation to internally accessible databases that are not publicly accessible. An internal database is any database that is only accessible within your organization’s internal network or through a VPN.

This section explains how you can run tests with an internal database, both locally and in the cloud.

Local execution

Cloud execution

After you complete the prerequisites, go to Low Code Automation and follow these steps to connect your database.

Configure a new database connection

To execute a database query while recording a test, you need to first set up a connection between Low Code Automation and your existing database.

  1. On the recorder, click the ︙ icon and click Run database query.

  2. In the Connect database section, select the database type.

  3. Alternatively, click + Add new connection.

  4. In the New database connection window, provide the following details:

  1. Click Test & connect. This verifies the connection details you’ve entered. If the connection is successful, your database will be linked to Low Code Automation and ready for use in your tests. To run the query, refer to the Run a database query section.

  2. Another way to configure a database connection is through the Database section. In the left pane, expand Data configuration and click Database. Then, click +Create new connection and follow the same steps as previously described.

Run a database query

Once the connection between Low Code Automation and your database server is successfully established, you can run queries during test recording.

  1. In the recorder, click the ︙ icon and select Run database query.

  2. Under the Connect database section, click Connect next to the database you wish to connect to.

  3. Enter the query you want to execute and click Run Query.

The results are fetched and appear in a table format.

  1. You can then add validations or extract values from these results as needed. Additionally, you have the option to import variables if required by clicking the + Import variable option.

Users should be able to select an existing database connection and execute SQL queries on that database. There are no built-in restrictions to block write operations in SQL queries. Please ensure the connection is configured with a user that has the required access controls.

Manage database connections

To view and manage your database connections in Low Code Automation:

  1. Navigate to Data configuration > Database. It displays all the database servers connected to your Low Code Automation account. The list shows the database name, the tests linked to each connection, and information on when and by whom it was last updated.

  2. Click the ︙ icon next to the database connection to perform one of the following actions:

Points to remember

Troubleshooting