Description
Test Data Queries are a key part of GenRocket's Self Service Test Data Portal. We organize all the Test Data Query functionality into a part of the GenRocket platform we call "G-Queries" (also referred to as "GQueries" in some articles).
With GenRocket, you can generate any type of synthetic test data needed to solve your test data challenges. However, synthetic test data does not always provide the data you require. Sometimes, real data needs to be queried and blended with synthetic test data to meet specific testing goals. This is where Test Data Queries come in.
Test Data Queries enable the blending of synthetic test data with real data. Within GenRocket, you can query real data from a database, CSV, or Excel file. This data can then be conditioned and blended with synthetic test data and applied to any Scenario, Scenario Chain, or Scenario Chain Set independently or with a Test Data Case.
In This Article
- Overview Video
- When Should Test Data Queries Be Used?
- What Are the Benefits of Queries?
- How to Access G-Queries
- Seven Types of Queries
- Sample SQL Query
- Prerequisite Steps
- How do Test Data Queries Work?
- Additional Information
Overview Video
Please take a few minutes to watch the following video showing the power and flexibility of GenRocket Test Data Queries:
When Should Test Data Queries Be Used?
- Any time real data needs to be blended with synthetically generated test data to meet specific testing goals.
- A Test Data Query can be used to modify any Scenario, Scenario Chain, or Scenario Chain Set or added to any Test Data Case.
What Are the Benefits of Queries?
- Allows users to query data from a database or file and blend it with synthetic data when generating test data.
- Allows users to perform queries using complex joins and to query for Attributes in multiple Domains.
How to Access G-Queries
- Select G-Queries from the Self Serve Menu Options menu.
Seven Types of Queries
GenRocket Test Data Queries gives seven types of query options:
Query Type | Description |
Query Before | Query columns from one or more database tables as a set of data that is buffered into memory. |
Query Each | Query one row of columns from one or more database tables on each row iteration of test data generation. |
CSV List | From a CSV file, pull rows of data having one or more columns into memory as a list of data. |
CSV Index | From a CSV file, pull rows of data having one or more columns into memory and retrieve any row via its row index. |
Mongo Before | Query columns from one or more database collections as a set of data that is buffered into memory. This is the same as Query Before but designed specifically for use with Mongo. |
Mongo Each | Query one row of columns from one or more database collections on each row iteration of test data generation. This is the same as Query Each but designed specifically for use with Mongo. |
Excel List | From a sheet within an Excel file, pull rows of data having one or more columns into memory as a list of data. |
Sample SQL Query
In the query below, six columns of data will be queried within a User table. Each column in the table represents an Attribute within a User Domain. The data being queried is for department '2' only.
select id, first_name, last_name, middle_initial, department_id, role_id from user where department_id = 2;
When test data is generated, the queried data will be combined with data generated by other Attributes within the Domain to provide the following blended output.
Prerequisite Steps
- GenRocket Runtime has been installed either locally or on a server.
- A config.properties file has been created to connect to the database and query data.
- Organization Resources have been configured appropriately.
- A Project/Project Version has been created or is available.
- Domains have been created or imported into the GenRocket web platform (varies depending on the source)
- Parent/Child Relationships have been configured (for multiple Domains).
- The appropriate Receiver has been assigned to the Domain. Varies based on the required output format:
- Directly insert into a Database (e.g., GenericSQLInsertReceiver, MongoDBInsertReceiver).
- Insert data into a Database using a file.
- Generate data in a different format (e.g., DelimitedFileReceiver, PDFFileReceier, JSONFileReceiver).
- A Scenario has been created for the Domain.
How do Test Data Queries Work?
- Add a new G-Query to the Project Version.
- Configure the query parameters to customize the query.
- Define the query. Data can be retrieved from a single table or multiple tables.
- Select the Domain and Attributes that will receive the queried data.
- Copy the command line and download the query to run it with a downloaded Scenario.
Note: Queries can be added to a Test Data Case. The query will be performed when the case is used to generate data. Please note that adding a large number of queries to a G-Case can slow down test data generation.
Additional Information
For more information, please see these additional articles regarding Test Data Queries:
Topic | Description |
Learn more about configuring a database Query. | |
Learn more about configuring a CSV file Query. | |
Learn more about configuring a MongoDB Query. | |
How to Add and Setup an Excel List Query | Learn more about configuring an Excel List Query. |
How to Add Queries to a Test Data Case | Learn how to add a Query to a Test Data Case. |
How to Generate Test Data with Queries and a Scenario | Learn more about generating test data with Queries and a Scenario. |