Turn your manual testers into automation experts! Request a DemoStart testRigor Free

How to do database testing using testRigor?

Database testing is crucial because it ensures the integrity and reliability of your application’s data. It verifies the database can store, retrieve, and manipulate data accurately, preventing errors that could crash your app or lead to incorrect results.

testRigor seamlessly supports database testing. Through a JBDC driver, you can connect to specific external databases and execute commands directly from your tests.

Let’s get started and see how to do it.

Step 1: Log in to your testRigor app with your credentials.

Step 2: Set up the test suite for the website testing by providing the information below:

  • Test Suite Name: Provide a relevant and self-explanatory name.
  • Type of testing: Select from the following options: Desktop Web Testing, Mobile Web Testing, Native, and Hybrid Mobile, based on your test requirements.
  • URL to run test on: Provide the application URL you want to test.
  • Testing credentials for your web/mobile app to test functionality which requires user to login: You can provide the app’s user login credentials here and need not write them separately in the test steps then. The login functionality will be taken care of automatically using the keyword login. However, this is an optional field and can be skipped if not relevant.
  • OS and Browser: Choose the OS Browser combination on which you want to run the test cases.
  • Number of test cases to generate using AI: You can simplify your test creation further by opting to generate test cases based on the App Description text. This feature works on generative AI.

Step 3: We need to provide the database details to connect with the database. To do that, click on the Advanced settings.

Step 4: Click the Integrations dropdown, select Databases Integration..

Fill in the below details:

  • Enable Database Checkbox: Click this checkbox to add database integration.
  • Name: Provide a name of the database.
  • DBMS: What type of database are you using? Currently, testRigor supports below:
    • MySQL
    • PostgreSQL
    • SQL Server
    • Snowflake
    • GridGain
    • Mangio DB
  • Connection String: You need to provide your database URL and port.
  • User: Enter the database username.
  • Password: Enter database connection password.

Once you have added all these details, click Add.

Note: If your database is behind a proxy server, then provide the database name and proxy server URL using the provided option and click Add.

Step 5: Once you have added the details, click on Create Test Suite.

On the next screen, you can let AI generate the test case based on the app description you provided while creating the Test Suite. However, for now, select do not generate any test, since we will write the test steps ourselves.

Step 4: To create a new custom test case, click Add Custom Test Case.

Step 5: Provide the test case Description and add the test steps.

Adding Multiple Connections

We can set up multiple database connections to one test suite. This can be done in two ways.

Option 1: While creating the test suite, you can add multiple database connections using Add. All connections will be listed.

Option 2: Once the test suite is created, go to the Settings on the left side of the screen and the navigate to Integrations tab.

Go to the Database option, and you can add multiple connections there.

Managing Multiple Connections

It’s possible to configure more than one connection. In this case, you can indicate the connection to be used by name:
run SQL query "select top 1 UserID, LastName, FirstName from Users;" using connection "connectionName"
run no-SQL query "{\"collection\": \"Users\", \"documents\": [{\"userId\": 3, \"firstName\": \"Jon\", \"lastName\": \"Doe\"}]}" using connection "anotherConnectionName"

Note: If you are not providing any connection name, testRigor will use the first configured database.

Overriding the Connection Setting

You can update the connection settings during runtime. For that, we need to use below variables:

  • connectionName:usernameJDBC
  • connectionName:passwordJDBC
  • connectionName:connStringJDBC
For example:
save value "user" as "connectionName:usernameJDBC".
save value "pass12345" as "connectionName:passwordJDBC”
save value "jdbc:mysql:host:port" as "connectionName:connStringJDBC"
run sql query "select top 1 UserID, LastName, FirstName from Users;" using connection "connectionName"

Test Case: SQL Database Support

You can use SQL commands in the test steps to retrieve, insert, update, and delete rows.

Test Case 1: Select

The following example will get the first row and save each pair of column-name/values into a stored value with the column name as the key:

  • Step 1: Get the first row of values (by default the values get saved to stored value with column name as key).
    run sql query "select top 1 UserID, LastName, FirstName from Users;"
  • Step 2: We can use these stored values in other scenarios.
    enter stored value "FirstName" into "First name"
    check that stored value "LastName" itself contains "Doe"

Test Case 2: Insert

We can insert data into the database using the below statement.
run sql query "insert into Users(UserID, FirstName, LastName) values (3, 'Jon', 'Doe');"

Test Case: No-SQL Database Support

testRigor supports MangoDB, which is a no-SQL database. You can use MongoDB commands in the test steps to retrieve, insert, update, and delete documents.

Test Case 1: Find

The following example will get the first document and save each pair of property-name/value into a stored value with the property name as the key:

  • Step 1: Here, we get the first document value and save it to a stored value with the property name as the key.
    run no-sql query "{\"find\": \"Users\", \"limit\": 1, \"projection\": {\"userId\": 1, \"firstName\": 1, \"lastName\": 1}}"
  • Step 2: We can use the stored values in other scenarios.
    enter stored value "FirstName" into "First name"
    check that stored value "LastName" itself contains "Doe"

Test Case 2: Insert

We can insert data into database using the below statement.
run no-sql query "{\"collection\": \"Users\", \"documents\": [{\"userId\": 3, \"firstName\": \"Jon\", \"lastName\": \"Doe\"}]}"

Execution Results

Once the test is executed, you can view the execution details, such as execution status, time spent in execution, screenshots, error messages, logs, video recordings of the test execution, etc. Logs and error text are available easily in case of any failure in a few clicks.

You can also download the complete execution with steps and screenshots in PDF or Word format through the ‘View Execution‘ option.

testRigor’s Capabilities

Apart from the simplistic test case design and execution, some advanced features help you test your application using simple English commands.

  • Reusable Rules (Subroutines): You can easily create functions for the test steps that you use repeatedly. You can use the Reusable Rules to create such functions and call them in test cases by simply writing their names. See the example of Reusable Rules.
  • Global Variables and Data Sets: You can import data from external files or create your own global variables and data sets in testRigor to use them in data-driven testing.
  • 2FA, QR Code, and Captcha Resolution: testRigor efficiently manages the 2FA, QR Code, and Captcha resolution through its simple English commands.
  • Email, Phone Call, and SMS Testing: Use simple English commands to test the email, phone calls, and SMS. These commands help validate 2FA scenarios, with OTPs and authentication codes being sent via email, phone calls, or via phone text.
  • File Upload/ Download Testing: Execute the test steps involving file download or file upload without the requirement of any third-party software. You can also validate the contents of the files using testRigor’s simple English commands.
  • Database Testing: Execute database queries and validate the results fetched.

testRigor enables you to test web, mobile (hybrid, native), API, and desktop apps with minimum effort and maintenance.

Additional Resources

Join the next wave of functional testing now.
A testRigor specialist will walk you through our platform with a custom demo.
Related Articles

How to Install Client Certificates in testRigor

Client certificates are one of several ways to allow users to authenticate their identity to a server, most often a private ...

How to perform keyboard actions using testRigor?

Smart test automation tools like testRigor account for various ways for testers to interact with the system. You can copy and ...

How to test legacy systems?

Understanding legacy systems Imagine a vintage car that’s been in the family for generations. It’s a ...