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 or CSV 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


What is a Test Data Query?

  • A Test Data Query queries real data from a defined database, CSV file, or Excel file and then blends it with synthetically generated test data when run with a Scenario, Scenario Chain, or Scenario Chain Set.

When should you use Test Data Queries? 

  • Any time real data needs to be blended with synthetically generated test data to meet specific testing goals. 
  • Test Data Queries can be used on their own to generate test data or added to a Test Data Case.


Video Overview

Please take a few minutes and video the following video showing the power and flexibility of GenRocket Test Data Queries:


Seven Types of Queries

GenRocket Test Data Queries gives seven types of query options:


Query TypeDescription
Query BeforeQuery columns from one or more database tables as a set of data that is buffered into memory.
Query EachQuery one row of columns, from one or more database tables, on each row iteration of test data generation.  
CSV ListFrom a CSV file, pull rows of data having one or more columns into memory as a list of data. 
CSV IndexFrom a CSV file, pull rows of data having one or more columns into memory and retrieve any row via its row index. 
Mongo BeforeQuery 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 EachQuery 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 ListFrom a sheet within an Excel file, pull rows of data having one or more columns into memory as a list of data.




How do Test Data Queries Work?

A query can be performed before synthetic test data is generated or on each iteration of test data generation. The query occurs when the command line is run from a Command or Terminal Window. Database, CSV file, Excel file, and Mongo options are available. 

  1. Set up a Test Data Query with Query Parameters, a Query, and the required Domains/Attributes
  2. Download the Query to your local machine or Add it to a Test Data Case
  3. Download the Scenario, Scenario Chain, or Scenario Chain Set to your local machine
  4. Run the Command Line for the Test Data Query or Case within a Command or Terminal Window



How do I use Test Data Queries?

In just a few steps, you can define a Test Data Query.

  1. Select a Project within the Project Dashboard.
  2. Select the G-Query Menu Option for a given Project Version
  3. Define a new Test Data Query
  4. Set your query parameters
  5. Define your query
  6. Select your Domain and Attributes that will receive the queried data


Note: To query a database, you will need to have a config.properties file to facilitate the database connection. Click here to learn more.


Note: If the Test Data Query will be added to a Test Data Case, you will run the command line for the Test Data Case. All other steps are the same. 


Defining a Test Data Query Example

Story

A QA Tester needs to generate customer test data, but specific customer attributes need real data that need to be blended with other synthetically generated data.  And the real data must be queried from a database.  


Let's follow the steps to create our Test Data Query.


Step 1 - Select the G-Queries Menu Option

Within a given Project Version, from the Project Versions Pane, select the G-Queries menu option from the Self Serve Menu Options drop-down menu.

 

Step 2 - Define a new Test Data Query

  • Click the Add G-Query button.
  • Give your Test Data Query a unique name.
  • Optionally add a description (it's a really good practice to add a description).
  • Select the type of Query you want to define: Query Before, Query Each, CSV List, CSV Index, Mongo Before, or Mongo Each.



Step 3 - Set your query parameters

Much like GenRocket Generators, each of the six Query Types has a set of parameters that are used to customize your query. 



Step 4 - Define your query

In our example, we are defining a query join that will retrieve data from two tables to treat the data as one customer entity.



Step 5 - Select your Domain and Attributes that will receive the queried data

We will add Attributes from a User Domain and an Address Domain and map them to the columns in the query.

Here's a view of adding the User.firstName Attribute and mapping it to the first_name column from the query.



Here's a view after all of the necessary User and Address Domain Attributes have been mapped.



Step 6 - Run the G-Query with a Scenario or Add it to a Test Data Case

A G-Query can be used to modify a Scenario, Scenario Chain, or Scenario Chain Set when generating test data.



Additionally, users are able to add one or more G-Queries to a Test Data Case (G-Case) to query real data during test data generation. To learn more, click here




Note: Please note that adding a large number of queries to a G-Case can slow down test data generation. 


The Completed Story

In just a few minutes, we are able to define a query to join and pull data from two tables to generate real customer data that can be blended with other synthetically generated data.  And best of all, this Test Data Query can be used to modify any Scenario, Scenario Chain, Scenario Chain Set, or added to any Test Data Case. 



Additional Information

For more information, please see these additional articles regarding Test Data Queries:


Topic

Description

How to access and view Test Data Queries for a Project

Learn more about accessing G-Queries.

How to add a Test Data Query to a Project Version

Learn more about adding a G-Query to a Project Version.

Databases: How to configure a Test Data Query

Learn more about configuring a database G-Query. 

CSV Files: How to configure a Test Data Query

Learn more about configuring a CSV file G-Query.

MongoDB: How to configure a Test Data Query

Learn more about configuring a MongoDB G-Query.

How to change a Test Data Query's Name, Description, and Type

Learn more about making changes to a G-Query.

How to create a copy of a Test Data Query

Learn more about copying G-Queries.

How to lock and unlock Test Data Queries

Learn more about locking and unlocking G-Queries.

How to delete a Test Data Query from a Project Version

Learn more about removing G-Queries from Project Versions.
How to generate test data with G-Queries and a Scenario
Learn more about generating test data with G-Queries and a Scenario.


Use Case Examples

Topic

Description

Test Data Queries Example: Customer RewardsSee a step-by-step example of using G-Queries.