QuerySurge Tutorial
QuerySurge Tutorial
Built by
QuerySurge is the smart Data Testing solution that automates the data validation and ETL testing of Big Data,
Data Warehouses, Business Intelligence Reports and Enterprise Applications with full DevOps functionality for
continuous testing. By analyzing and pinpointing any differences in the data, QuerySurge ensures that the data
extracted from source systems remains intact in the target and complies with transformation requirements.
QuerySurge is an essential asset to every data testing process.
• Your test automation issues. Now you can automate all your data testing, from the kickoff of tests to performing
the validation to automated emailing of the results and updating your test management system. more »
• Your ability to test across platforms, whether you use a Big Data Lake, Data Warehouse, traditional database,
NoSQL document store, BI reports, flat files, JSON files, SOAP or restful web services, xml, mainframe files, or
any other data store. more »
• Your need to integrate for Continuous Delivery. QuerySurge integrates with most Data Integration/ETL solutions,
Build/Configuration solutions, and QA/ Test Management solutions. more »
• Your ability to analyze your data, with our Data Analytics Dashboard & Data Intelligence Reports. more »
• Query Wizards — fast and easy with no SQL coding needed. The smart Wizards provide both novices and
experienced team members with the ability to easily and quickly validate their data with no SQL coding required.
more »
• DevOps and Continuous Testing. Dynamically generate, execute, and update tests and data stores utilizing API
calls. more »
• Proven ROI. Making a business case for QuerySurge is easy. QuerySurge returns 1,287%. more »
Knowledge Base and Community Forums provide a hub for extensive QuerySurge information and the
answers to the most frequently asked questions about QuerySurge. To access the QuerySurge Knowledge
Base, click here >>
• Video Library: The Video & Slide Library provides tutorials, demos and webinars on QuerySurge. To
access the Video Library, click here: [Link]
• Contact Us: The Contact Us page provides a form where you can submit comments, questions, or
suggestions. [Link]
Direct Link to Knowledge Base is provided within Querysurge. Select the help icon located on the bottom
panel.
Note: This tutorial requires the installation of ‘Tutorial + Sample Data’ in the QuerySurge installer. This component can
be selected during the initial QuerySurge installation. If you are using the Trial in the Cloud, the Sample Data is already
installed. If you are using the Trial Download, please select this option during installation.
Installation Requirements
QuerySurge is an enterprise data testing solution that will typically be used to validate large data sets. Since you are
testing either a Big Data store or Data Warehouse with potentially massive quantities of data, QuerySurge needs the
right hardware to perform at speeds that will meet your team's needs.
Therefore, the more CPU, RAM, and hard drive space you have, the better and faster QuerySurge performs.
For a trial setup, QuerySurge can be run on a desktop with modest resources, but that will limit QuerySurge's
performance and ability to scale. For additional information on system requirements, click here: QuerySurge System
Requirements.
Tutorial.................................................................................................................................................................................... 6
The Story ........................................................................................................................................................................ 6
Overview ......................................................................................................................................................................... 8
First and Subsequent Logins to QuerySurge ................................................................................................................. 9
Create QueryPairs using the Query Wizard for Column-Level Comparison .................................................................. 12
Execute a QueryPair that fails ...................................................................................................................................... 27
Create and Execute a Test Suite ................................................................................................................................... 30
Running a Detailed Scenario Report ............................................................................................................................ 36
Create a QueryPair ........................................................................................................................................................ 38
Create a QueryPair using a Reusable Snippet............................................................................................................... 44
Add a Reusable Query Snippet to a QueryPair ............................................................................................................. 49
Create a Test Suite and Schedule an Execution Scenario ............................................................................................ 52
Create QueryPairs using the Query Wizard for Table-Level Comparison...................................................................... 59
Review of Data Health Dashboard ............................................................................................................................... 70
Summary ...................................................................................................................................................................... 73
Deleting the Tutorial Data............................................................................................................................................ 74
Appendix ............................................................................................................................................................................... 75
Documentation................................................................................................................................................................. 75
Data Warehouse Testing .................................................................................................................................................. 75
The QuerySurge Testing Process ..................................................................................................................................... 77
About the QuerySurge Architecture ................................................................................................................................ 79
QueryPair
A pair of SQL queries where one query retrieves data from a source file or database and
another SQL query retrieves data from a target database, data warehouse or data mart.
Agent
Performs the query tasks. Agents execute queries against source and target data stores and return the
results to the QuerySurge database.
Design-Time Run
Allows you to execute a QueryPair test to make sure that it behaves as you expect. This is not intended for
actual test execution purposes.
Query Snippet
Reusable piece of SQL code that can be embedded in one or more queries. The purpose of a Snippet is to
minimize the number of places you need to make changes on the same code in different queries.
Test Suite
A collection of QueryPairs used for execution purposes. This feature allows you to group QueryPairs for
execution that is independent of your ‘Design Library’ organization
Scenarios
A collection of Suites that are scheduled for execution.
Query Wizard
A tool that allows you to generate QueryPairs automatically, requiring no manual SQL coding. The Query
Wizard generates tests that can cover about 80% of all data in a data warehouse automatically. 1
Widgets
Project Widgets give you a real-time view into your project progress at all levels, from QueryPair
development to execution and results.
1
A recent poll conducted by RTTS on targeted LinkedIn groups found that 80% of columns in data warehouse tables have no transformations.
ZCity is a popular electronics corporation that is in the market for a new data warehouse so that corporate business
personnel can assess the activities that are occurring throughout their sales regions. ZCity recently merged with one of
its competitors, XMart, and now has two sales teams. The sales system environment for ZCity and XMART both reside
on a MySQL database.
The business has decided that a data warehouse that runs nightly incremental ETL loads will help them make more
effective business decisions. The analysts created a mapping document that maps out each source field to its
corresponding target field from each source system. This includes any data transformations that the business deems
necessary to be entered into the warehouse. The corporate IT team has completed development of a MySQL data
warehouse (the target database) and an ETL process that includes transformation logic (from the mapping document) to
load the source data from each source into the data warehouse.
The business’ Quality Assurance team has been tasked with verifying the transformation logic and has purchased
QuerySurge to validate 100% of the data being transformed from source to target. The Quality Assurance Manager has
planned for the Quality Assurance team to review the mapping documents and build test cases, from the same logic that
the developers used when creating the ETL code. The QuerySurge term for test cases is “QueryPairs”. The team is
confident that this approach will not only cover testing 100% of the data but will also prove the mapping documents are
comprehensive.
Their idea is that if two separate teams, the Development Team and the Quality Assurance Team, are building queries
and logic from the same mapping documents separately and can attain the same results, then there is a very good
chance there will be no defects in the production environment.
You will perform the following tasks in the tutorial. It is recommended that you use two monitors. It also might be easier
to print the tutorial.
1. ZCITY Source
• MySQL sales database (3 tables)
• 27 QueryPairs
• 1 Test Suite including all ZCITY QueryPairs
• 1 Reusable Query Snippet
2. XMART Source
• MySQL sales database (4 tables)
• 31 QueryPairs
4. Mapping and Model Document (printing and reviewing this document is recommended)
The document is linked within the tool from the setup wizard and can also be downloaded from here: Tutorial
Models and Mapping Document.
• ZCITY mappings and data model
• XMART mapping and file data model
• Data warehouse data model
Upon QuerySurge installation, a project administrative user has been created for you, or an Administrator has already
provided you with your own login credentials.
Note: If you have already logged into QuerySurge, this section will provide a review
4. If your QuerySurge install is local, enter your credentials or use the credentials admin/admin. If you are using a
Cloud trial, use the credentials clouduser/clouduser. Click Login.
task)
o The ‘Create a Connection’ link brings you to the connection wizard
o The ‘Optional Tasks’ section allows you to easily navigate to documentation and videos or to
create additional connections
• Data Analytics Dashboard panel in the middle
o The center panel displays QuerySurge’s Data Analytics Dashboard and Data Widgets, which is a
configurable dashboard that provides a view into project information (more on this later)
7. Collapse the ‘Setup Wizard’ by clicking the button located at the top right corner of the Querysurge window.
A QueryPair is what QuerySurge refers to as a test case – two queries with the following characteristics:
• A SQL query that retrieves data from a source file or database and
• Another SQL query that retrieves data from a target big data store, data warehouse, data mart or database
The Query Wizard is a feature that allows you to generate QueryPairs automatically requiring no SQL coding. It is a fast
and easy way to create QueryPairs for both skilled team members and beginners with less experience who want to
increase testing speed.
Based on a LinkedIn poll of Data Warehouse experts, on average 80% of columns in a typical data warehouse have no
transformations at all. The Query Wizards were developed to generate tests that can cover approximately 80% of all
data in a data warehouse quickly and without writing SQL code. The Wizards are user friendly and provide amazing
results for both beginners and experienced testers.
• Column-Level Comparison: this is great for Big Data stores and Data Warehouses where tables will have some
columns with transformations (20% on average) and some columns with no transformations (80% on average).
The Column-Level Comparison is for the specific columns with no transformation. Columns with transformation
will require SQL coding.
• Table-Level Comparison: this is great for data migrations and database upgrades with no transformation at all.
Many tables can be compared simultaneously and quickly.
• Row Count Comparison: this works with all - Big Data stores, Data Warehouses, Data Migrations and Database
Upgrades. Many tables can be compared simultaneously and quickly.
A folder can be created that contains all the QueryPairs generated. These QueryPairs can also be added to a new Test
Suite so they can be easily run together (more on this later).
Note: This part of the tutorial illustrates the use of the Query Wizard for creating a QueryPair with Column-Level
Comparisons
1. Click the dropdown menu on the “Design Menu” icon in the top toolbar and select “Launch Query Wizard”
• Metadata (or data about our data) pre-populates for the selected databases
• Column-Level Comparison validates data points in the selected columns and allows for the addition
of Filtering (WHERE Clause) and Sorting (ORDER BY)
• Table-Level Comparison validates each data point in the source table to its corresponding data point
in the target table
• Row Count Comparison validates the number of rows in each of the selected tables
Points of interest:
• Schemas available for selection are retrieved from the source and target databases that you
previously selected
• One, many, or all schemas can be selected
8. Select ‘xmart’ on the “Source Schemas” pane and ‘dw’ on the “Target Schemas” pane and click Next
9. Select and drag ‘xmart_customer’ under “Source Tables” and drop it into it’s corresponding “Target Tables”
‘dw.customer_dim’
• As a source table is dropped onto its corresponding target table, its ‘Query Mapping’ appears in the
left-hand column (if desired, you can double click to rename it)
• Mapped tables show a line connecting the source and target table with the selected ‘Query
Mappings’ line highlighted green
• Auto generated SQL appears in the ‘Source Query’ and ‘Target Query’ panes at the bottom of the
Query Wizard window
10. Select and drag ‘CUSTOMER ID’ under “Source Columns” and drop it into its corresponding “Target Columns”
‘SOURCE_ID’.
11. Select and drag “FIRST” under “Source Columns” and drop it onto “FIRST” in its corresponding “Target
Columns”.
12. Select and drag “LAST” under “Source Columns” and drop it onto “LAST” in the corresponding ”Target
Columns”.
13. Select and drag “EMAIL” under “Source Columns” and drop it into “EMAIL” in its corresponding ”Target
Columns”.
Points of interest:
• As a source column is dropped onto its corresponding target column the auto-generated SQL will
change to reflect your selections
• Column relationships show lines connecting the source and target columns with the currently
selected relationships highlighted in green
15. In the lower middle of the screen under “Filtering (WHERE Clause) and Sorting (ORDER BY)” click the “Add New
Criteria” icon
16. Under “Table” in the newly created criteria field click the dropdown menu and select ‘Source’.
17. Under “Column” click the dropdown menu and select ‘CUSTOMER ID’.
18. Under “Operation” click the dropdown menu and select ‘Sort Direction’.
19. Under “Value” click the dropdown menu and select ‘Ascending’.
20. Click the “Add New Criteria” icon.
© 202216Real-Time Technology Solutions, Inc.
22 West 38th Street, 11th Floor • New York, NY 10018
[Link]
21. Under “Table” click the dropdown menu and select ‘Target’.
22. Under “Column” click the dropdown menu and select ‘SOURCE_SYSTEM’
23. Under “Operation” click the dropdown menu and select ‘Equals’.
24. Under “Value” type ‘XMART’.
25. Click the “Add New Criteria” icon .
26. Under “Table” click the dropdown menu and select ‘Target’.
27. Under “Column” click the dropdown menu and select ‘SOURCE_ID’.
28. Under “Operation” click the dropdown menu and select ‘Sort Direction’.
29. Under “Value” click the dropdown menu and select ‘Ascending’.
Points of interest:
• Added criteria appear in the ‘Filtering (WHERE Clause) and Sorting (ORDER BY)’ section
• Auto generated SQL based on added filter criteria appear in the query panes
• Criteria can be removed by clicking the ‘Remove Criteria’ icon
Points of interest:
• The Query Wizard will automatically create the following test assets:
o A new folder in the ‘Design Library’ with the name ‘WIZARD – COLUMN-LEVEL’
o All QueryPair(s) for testing the tables selected
o A new Test Suite in the ‘Scheduling’ module with the generated QueryPair(s)
36. Click the Next button.
• A review screen appears with the details for your Query Wizard execution
• A folder named ‘WIZARD – COLUMN-LEVEL’ was created in the ‘Design Library’ module
• A Test Suite named ‘WIZARD – COLUMN-LEVEL’ was created in the ‘Scheduling’ module
• One QueryPair was created
38. Click the OK button.
The QueryPair created in the previous chapter will be utilized for this section of the tutorial
Points of interest:
• QuerySurge utilizes a folder structure similar to Microsoft Windows Explorer
• Multiple sub-folders can be contained within folders
• The left panel allows for simple navigation
• The tutorial has two main folders, one for each source system, and the folder you created while running
the Query Wizard
• The QueryPair contained within the ‘WIZARD - COLUMN-LEVEL’ folder is displayed on the center panel
• In this case, there is only one QueryPair that was created during the previous chapter
• The QueryPair was created to validate that the source customer data was loaded into the data
warehouse. (See mapping 1.01 – 1.05 of the tutorial mapping document - a link to the document is
located on the ‘Setup Wizard’)
o This QueryPair is validating the direct map (no logical transformation) of the data from the
Source, XMART, to the target data warehouse
• The ‘QueryPair’ tab contains
o ‘Source Query’ and ‘Connection’ – for storing the query with a specific database connection
o ‘Target Query’ and ‘Connection’ – for storing the query with a specific database connection
Points of interest:
• The first time clicking on the ’Design-Time Run’ for a QueryPair will indicate that a run has not been
previously executed
• A specific Agent, if desired, can be selected in the drop-down menu (not required)
• When executing a ‘Design-Time Run’, QuerySurge goes through the following phases:
o Loading – QuerySurge is loading the QueryPair on the Agent for execution
o Running – The Agent is running the target and source queries
o Analyzing – QuerySurge is comparing the results
• The QueryPair passes
• Both source and target queries returned 1250 rows, and all rows matched from source to target
• QuerySurge displays the following information about the last ‘Design-Time Run’
o Source Rows – number of source rows returned
o Target Rows – number of target rows returned
o Row Count Difference – the difference between the number of source and target rows
returned
o Failed Row Count – number of rows with data differences
o Non-Matching Source Rows – number of source rows not found in the target (based on key
column(s))
o Non-Matching Target Rows – number of target rows not found in the source (based on key
column(s))
• ‘Connections’ and ‘Query Performance’ metrics
1. In the “Design Library” tree (left panel), navigate to the folders ‘QueryPairs -> ZCITY -> ORDERS_FACT’
Points of interest:
• The ‘ZCITY – STATUS’ QueryPair was created to validate the source SALE_STATUS column was loaded
into the data warehouse correctly (See tutorial mapping document on the ‘Setup Wizard’).
o This QueryPair is validating that the SALE_STATUS from source ZCITY and target data warehouse are
loaded with the following logic:
▪ Populate target ORDERS_FACT.STATUS using the following logic: if the SALE_STATUS value in the
Sale table is ‘Incomplete’, then change to ‘Pending’. Otherwise, leave as is.
Points of interest:
• The ‘ZCITY – STATUS’ QueryPair fails. (If one or more fields do not match, then QuerySurge fails the
QueryPair)
• Both source and target returned 6,919 rows
• 1,373 rows failed
• If there were any ‘Non-matching Rows’, they would appear with a yellow flag
• Failures are shown with a red background
The Test Suites feature of QuerySurge lets you organize your QueryPairs in Test Suites - collections of QueryPairs for
execution. This feature allows you a different level of organization for execution purposes that is independent of your
‘Design Library’ organization.
Points of interest:
• A Test Suite has been created for you called ‘ZCITY – ALL’
o ‘ZCITY – ALL’ contains all the QueryPairs associate with the ZCITY source
• The ‘WIZARD – COLUMN-LEVEL’ suite was created in a previous section of this tutorial
• Left Panel – displays all the available Test Suites that can be run
• Middle Panel – displays tests associated with a Test Suite (currently no Test Suite is selected)
• Right Panel – displays your ‘QueryPair Library’ tree
6. Click “+” next to ‘QueryPairs’ in ‘QueryPair Library’ panel on the right and double click ‘ZCITY’.
7. Drag and drop the ‘CUSTOMER_DIM’ folder to the ‘ZCITY – CUSTOMER_DIM’ test suite panel in the middle.
Points of interest:
• The ‘ZCITY - CUSTOMER_DIM’ Test Suite now contains all QueryPairs from the ‘CUSTOMER_DIM’
folder
8. Click the Save button in the upper left corner of the middle panel to save your Test Suite.
9. Right click on the “ZCITY – CUSTOMER_DIM” on the Test Suite panel (Left panel) and select “Run Now”.
10. Accept all defaults and click the OK button on the “Run Scenario” dialog.
11. QuerySurge will automatically toggle you over to the “Run Dashboard” and the Test Suite will execute.
• Left Panel – ‘Scenario Queue’ contains all Scenarios, including those previously executed
o The executed Scenario was created for you with a single test suite named ‘ZCITY –
CUSTOMER_DIM’
o Notice QuerySurge appended a date/time stamp to the end of the Scenario name
• Upper Middle Panel – the currently selected Scenario’s Test Suites and their progress
• Upper Right Panel – additional information and metrics
• Lower Middle/Right Panel – graphs of progress
12. Double click the Test Suite ‘ZCITY – CUSTOMER_DIM’ to see detailed data about the Test Suite execution results
displayed in the middle panel.
• Notice the lower panel has a layout similar to the “Design-Time Run” execution results
• Lower panel contains
o Source Tab – displays the source result rows
o Target Tab – displays the target result rows
o Failures Tab – displays data failures (not populated in this example as no rows failed)
o Source Query Tab – displays the source query
o Target Query Tab – displays the target query
o Query Performance – displays metrics
• Right panel contains
o Source Row Count – displays number of source rows
o Target Row Count – displays number of target rows
o Row Count Difference – displays number of extra rows in source or target
o Failed row count – displays number of data failures
o Non-Matching Source Rows – displays number of source rows that do not match target rows
o Non-Matching Target Rows – displays number of target rows that do not match source rows
• You can export results to Excel, CSV file, or an XML document using the ‘Export to’ dropdown menu
located below the source tab on the lower panel
For more information on Execution, please visit Scheduling→ Running a Test Suite in the Knowledge Base
The “Reporting Module” shows the formal reports offered by QuerySurge. Some reports have configurable options
which are found once the report type has been selected and opened. Once executed, reports can be saved as a PDF or
exported to Excel.
Points of interest:
• In the screenshot above the “Scenario Outcome” has an overall status of “FAILED” since one of the
QueryPairs failed
• The “Test Results” displays the number of passed and failed QueryPairs
• Additional information is displayed in the “Overview” section
For more information on Reports, please visit Reporting in the Knowledge Base
select
c.`CUSTOMER ID` as source_id,
substr(c.`SHIPPING ADDRESS`, 1, instr(c.`SHIPPING ADDRESS`, ',')-1) as street
from
XMART_CUSTOMER as c
order by
source_id
select
c.SOURCE_ID as source_id,
[Link] as street
from
CUSTOMER_DIM as c
left outer join
(
select
a.ADDRESS_ID as address_id,
[Link] as street
from
ADDRESS_DIM as a
where
a.SOURCE_SYSTEM = 'XMART'
) a
on
c.SHIPPING_ADDR_ID = a.ADDRESS_ID
where
c.SOURCE_SYSTEM = 'XMART'
order by
c.SOURCE_ID
10. Under “Connection” select “XMART_SOURCE” from the dropdown menu in the “Source” panel.
11. Under “Connection” select “DW_TARGET” from the dropdown menu in the “Target” panel.
12. Click the “Save” icon in both the source and target editor panels.
• The ‘XMART – STREET (SHIPPING)’ QueryPair is implemented to validate that the source
SHIPPING_ADDRESS column was loaded into the data warehouse correctly (see Tutorial Mapping
document from the ‘Setup Wizard’)
▪ This QueryPair is validating that the SHIPPING_ADDRESS column from source
XMART, to the target data warehouse is loaded with the following logic:
• Extract the street name from "XMART_CUSTOMER.SHIPPING ADDRESS"
by retrieving all the text before the first comma
A query Snippet is a reusable piece of SQL code that can be embedded in one or more queries. The purpose of a Snippet
is to make common SQL fragments reusable across multiple Queries. A Snippet does not have to be a syntactically intact
query (for example, it might just be a WHERE clause) but there is no reason why it can’t be a complete query (e.g., a
reusable sub-query). This feature lets you develop libraries of ‘Reusable Query Snippets’ to be reused in multiple
queries. If a Snippet shared by multiple queries needs to change, you can make the change once and all of the queries
using the Snippet are changed automatically.
1. Under “Design Library” in the lefthand panel select “QueryPairs” and then select the ‘ZCITY’ folder and then the
‘ORDERS_FACT’ sub-folder.
2. Click the “Create New QueryPair” button.
3. Type ‘ZCITY – COMMENTS’ in the “QueryPair Name” field.
4. Click the Save button.
5. Type or copy/paste the following under the “Source” editor panel:
select
source_order_id,
cast(group_concat(comments order by source_saleitem_id SEPARATOR ' | ') as
char(100)) as comments
from
(
select
si.SALE_ID as source_order_id,
concat([Link],': ',[Link]) as comments,
si.SALEITEM_ID as source_saleitem_id
from
SALEITEM as si,
SALE as s
where
si.SALE_ID = s.SALE_ID
order by
source_order_id
) main
group by
source_order_id
select
o.SOURCE_ORDER_ID as source_order_id,
[Link] as comments
from
ORDERS_FACT as o
where
o.SOURCE_SYSTEM = 'ZCITY'
order by
source_order_id
7. In the “Source” editor panel select “ZCITY_SOURCE”’ from the “‘Connection” dropdown menu.
8. In the “Target” editor panel select “DW_TARGET” from the “Connection” dropdown menu.
9. Click the “Save” button on both the source and target queries.
Points of interest:
• The “ZCITY – COMMENTS” QueryPair is to validate that the source comments column was loaded into
the data warehouse (see tutorial mapping document from the ‘Setup Wizard’)
▪ This QueryPair is validating that the COMMENT column from source ZCITY, to the target data
warehouse, is loaded with the following logic:
• Populate the COMMENTS column on the target table ORDERS_FACT by concatenating
columns from source ZCITY with the following logic:
11. Click the “Save selected SQL as Reusable Query Snippet” icon.
Points of interest:
12. Type ‘ZCITY ORDERS Filter’ in the “Reusable Query Snippet Name” field.
13. Click the Save button.
14. Click the Save button under the “Target” editor panel.
• Notice that ‘o.SOURCE_SYSTEM = 'ZCITY'’ has been replaced with ‘${ZCITY ORDERS Filter}’, signifying a
reusable query snippet
• Hover your mouse over the Snippet to resolve, or see, the actual query
o You can click the “Query View” tab at the bottom of the pane to resolve the Snippet as well
15. Execute a Design-Time Run by selecting the “Design-Time Run” tab then click the Run button.
16. Click the View Query Results button.
17. Click the “ailures” tab. (expand the comments field to view the entire column)
• Notice that on the target side, the development team is not using the correct delimiter in their ETL
process
o The target data warehouse is using ‘+’ as its delimiter between comments, but according to the
mapping document, ‘|’ was specified
• Notice line 1249 on the source/target. The data looks the same; however, the target has an extra space
after “sidedoor”. Use View Options -> Show Whitespace to highlight this extra space. (“View options” is
located in the upper right of the results dialog window)
For more information on Reusable Snippets, please visit Design Library→ Working with Reusable Snippets in the
Knowledge Base
1. Under “Design Library”, select the ‘ZCITY’ folder and then select the ‘ORDERS_FACT’ sub-folder.
2. Double click the ‘ZCITY - ORDER_DT’ QueryPair.
3. Under the “Target” editor panel highlight the following text: ‘o.SOURCE_SYSTEM = 'ZCITY'’.
Points of interest:
• The left panel utilizes a folder structure similar to Microsoft Windows Explorer (our Snippets are saved in
the root folder, but can be grouped by subfolders manually if desired)
• The top right panel will display the ‘Reusable Query Snippets’ contained within the selected folder once
a folder is selected
• The bottom right panel displays the SQL of the selected Snippet
Points of interest:
• The “ZCITY ORDERS – Filter” snippet replaces the highlighted text with the Reusable Query Snippet
• Now the Snippet is in two locations. If you need to change that part of the query, it can be done in one
place instead of two. (What if the same SQL fragment was in hundreds of QueryPairs? That would save
quite a bit of time.)
QuerySurge Scenarios are collections of Test Suites that are scheduled for execution. Scenarios can be run immediately
after creation, or scheduled for a future date/time, and are viewable in the ‘Run Dashboard’.
• The ‘ALL – CUSTOMER_DIM’ Test Suite now contains all QueryPairs from the ‘CUSTOMER_DIM’ folders
from both ‘XMART’ and ‘ZCITY’ (14 QueryPairs in total)
• Test Suites can contain a combination of QueryPairs from various sources (XMART and ZCITY) and
varying connection types (flat file and database, respectively)
9. Click the Save icon in the upper left corner of the middle panel to save your Test Suite.
10. Click the Create button to create a new test Suite.
11. Enter ‘ALL – ORDERS_FACT’ in the “Test Suite Name” field.
12. Click the Save button.
13. Expand the ‘XMART’ folder in the ”QueryPair Library” panel on the right.
14. Drag and drop the ‘ORDERS_FACT’ folder to the ‘ALL – ORDERS_FACT’ test suite panel in the middle.
15. Expand the ‘ZCITY’ folder in the “QueryPair Library” panel on the right.
16. Drag and drop the ‘ORDERS_FACT’ folder to the “ALL – ORDERS_FACT” test suite panel in the middle.
• The ‘ALL – ORDERS_FACT’ Test Suite now contains all QueryPairs from the ‘ORDERS_FACT’ folders
from both ‘XMART’ and ‘ZCITY’ (17 QueryPairs)
17. Click Save in the upper left corner of the middle panel to save your Test Suite.
20. Enter “SCENARIO – XMART/ZCITY – CUSTOMERS AND ORDERS” into the “Scenario Name” field
selection of a date and time for the run. Then click the “Calendar” icon
27. Click the Refresh at the bottom of the ‘Scenario Queue’ pane (left pane)
28. Click the “SCENARIO – XMART/ZCITY – CUSTOMERS AND ORDERS” Scenario in the “Scenario Queue” pane (this
may take a few seconds to refresh and appear). Observe that the Scenario just created is now executing
Points of interest:
• The ‘ALL – CUSTOMER_DIM’ Test Suite executes immediately while the ‘ALL – ORDERS_FACT’ Test Suite
remains idle since it was set to execute to the nearest time in the future
• Even when the “ALL – CUSTOMER_DIM” Test Suite completes its execution, the “ALL – ORDERS_FACT”
Test Suite will remain idle until its set execution time is reached
• After the time has elapsed, the ‘ALL – ORDERS_FACT’ Test Suite will execute automatically
The Query Wizard is a tool that allows you to generate QueryPairs automatically. This is great for those with limited or
no SQL experience, as well as for experts who are looking for a fast and easy way to create QueryPairs for data
migrations, database upgrades, and other database comparisons that do not have transformations. The Query Wizard
can generate QueryPairs for Row Count Comparison, Table-Level Comparison, and Column-Level Comparison validations.
A folder can be created in the Wizard that contains all of the QueryPairs generated. These QueryPairs can also be added
to a new Test Suite so they can be easily run together.
Note: This part of the tutorial illustrates the use of the Query Wizard for validating a database upgrade. In this case, the
data warehouse was upgraded to a new version ‘Connection DW_UPGRADE’ from an older version ‘Connection
DW_OLD’
1. In the “Design Menu” dropdown menu on the top toolbar, select “Launch Query Wizard”.
2. Click Next under the Query Wizard welcome screen.
3. Select ‘DW_OLD’ from the “Source Connection” drop down menu.
4. Select ‘’DW_UPGRADE’ from the “Target Connection” drop down menu.
Points of interest:
• Metadata (or data about our data) pre-populates for the selected databases
Points of interest:
• Column-Level Comparison validates data points in the selected columns and allows for the addition
of Filtering (WHERE Clause) and Sorting (ORDER BY)
• Table-Level Comparison validates each data point in the source table to its corresponding data point
in the target table
• Row Count Comparison validates the number of rows in each of the selected tables
• Schemas available for selection are retrieved from the source and target databases that you
previously selected
• One, many, or all schemas can be selected
8. Select ‘dw_old’ (the location for the data warehouse data before the upgrade) for the source schema and ‘dw’
(the location for the data warehouse data after the upgrade) for the target schema.
9. Click the Next button.
10. Drag each individual source table and drop it onto its corresponding target table. Scroll down in the ‘Source
Tables’ and ‘Target Tables’ windows if needed.
• As each individual source table is dropped onto its corresponding target table, its Query Mapping
appears in the left-hand column and can be renamed if desired
• Mapped tables show a line connecting the source and target tables with the selected Query
Mapping line highlighted in green
• Auto generated SQL appears in the ‘Source Query’ and ‘Target Query’ panes at the bottom of the
Query Wizard window
• A review screen appears with the details for your Query Wizard execution
• A test folder named ‘WIZARD – DW_UPGRADE TEST’ was created in the ‘Design Library’ module
• A Test Suite named ‘WIZARD – DW_UPGRADE TEST’ was created in the ‘Scheduling’ module
• Seven QueryPairs were created (one for each of the source and target tables mapped)
20. In the “Design Menu” dropdown menu on the top toolbar, select “Library Explorer”.
21. In the “Design Library” tree (left panel), navigate to the folder ‘QuerySurge Design -> QueryPairs -> WIZARD –
DW_UPGRADE TEST’.
Points of interest:
• The name of the folder is the name you entered into the ‘Folder Name’ field in the Query Wizard
• The name of a QueryPair is in the following format:
o Validation Type: source [Link] table - target [Link] table
19. Double click the ‘Data (Table): dw_old.address_dim - dw.address_dim’ QueryPair and notice the SQL for source
and target queries that was automatically generated.
• The QueryPair is selecting all columns from the source connection and target connection
• During execution, all columns will be compared between source and target
20. Execute a ‘Design-Time Run’ by clicking the “Design-Time Run” tab and clicking the “Run” button.
Points of interest:
• The QueryPair compared 5,944 source and target rows, which passed
• Feel free to view the results
Points of interest:
• The name of the Test Suite is the name entered into the ‘Name’ field during the Query Wizard
• All the QueryPair(s) are included in the Test Suite upon generation
23. Right click the ‘WIZARD – DW_UPGRADE TEST’ Test Suite and select the “Run Now” option.
24. If a “Run Scenario” dialog is displayed, click the OK button.
25. The “Run Dashboard” is displayed. Double click the ‘WIZARD – DW_UPGRADE TEST’ row in the middle panel to
review the results.
Points of interest:
31. Click the “Data Intelligence Reporting” icon located on the bottom panel.
32. Select the “Scenario Detail" report from the left panel.
33. Click the “Open Report” button.
34. Select the ‘WIZARD – DW_UPGRADE TEST’. (a date time stamp will be appended to the end of the name in the
‘Select a Scenario’ dropdown list)
Click the Run Report button.
Points of interest:
• Notice the number of individual field verifications that QuerySurge was able to accomplish, just
under a quarter million, in less than 9 seconds on our tutorial instance (completion time will vary
based on your hardware)
For more information on Reports, please visit Reporting in the Knowledge Base
The Data Health Dashboard gives you a real-time view into your project progress at all levels, from QueryPair
development to execution and results. Data Widgets are configurable, so you can see the slice of your project that you
want to see, in the way you want to see it.
Note: If the available widgets panel is not displayed, then click the ‘Add Widget’ Button
Points of interest:
• The “Welcome” tab defaults to one panel containing four Widgets (center panel)
• Click the ‘Add Widget’ button for a list of additional ‘Available Widgets’ (right panel)
• Panels can be configured by dragging and dropping Widgets as desired
3. Click the Maximize button on the “Scenario Outcome / Data Reliability” Widget for a closer view.
• Pass/Fail Verifications of your recent Scenario Runs displayed as a bar graph of Pass/Fail Rate
• Data Reliability per Scenario metric displayed as a blue line
• The vertical axis for the bar graph is on the left, while the vertical axis for the blue line is on the right
4. Click the ‘Scenario Outcome / Data Reliability’ Widget title to make it editable, type ‘Tutorial’ at the beginning of
the existing title and hit enter.
5. Turn off the ‘Total Verifications Passed’ data in the Widget by clicking on the legend at the bottom.
6. Zoom in on the data by clicking on the “SCENARIO” bar in the graph and dragging your mouse across to the left.
(Zoom occurs upon the release of the mouse button)
• Title changes are reflected above the graph and in the title bar
• ‘Total Verifications Passed’ in no longer reflected in the graph, you can add the data back by clicking
on the greyed-out legend
• The graph is zoomed in on the bars that were highlighted in the previous step, and a ‘Reset zoom’
button now appears to revert.
• You can point many of the Widgets at specific data by clicking on the ‘View Settings’ icon
• You can have multiple panels of Widgets by clicking on the ‘Add Panel’ button
For more information on Widgets, please visit Reporting→ Project Widgets in the Knowledge Base
You have just finished the QuerySurge tutorial. This is what you completed:
There are additional examples within the sample data and QueryPairs, many of them which are more complex than the
exercises you completed in this tutorial. Now that you have a solid foundation on using QuerySurge, try them out. You
can access the mapping and data model document from the “Setup Wizard.”
Warning: Deleting the tutorial data will permanently remove data. Please read this section carefully before proceeding!
Documentation
• System Requirements Guide – hardware and software needed to run QuerySurge minimally and
optimally
• Installation Guides
o for Windows (Single Machine)
o for Windows (Multi Machine)
o for Linux (Single Machine)
o for Linux (Multi Machine)
• Configuration Guides for connecting to a broad range of technologies.
Comprehensive testing of a data warehouse at every point throughout the ETL (extract, transform, and load)
process is becoming increasingly important, as more data is being collected and used for strategic decision-
making.
Data warehouse projects are undertaken because of mergers and acquisitions, compliance and regulations, data
consolidation, and the increased reliance on data-driven decision making (using Business Intelligence tools, etc.).
Any way you slice it, the data warehouse/business intelligence (BI) platform is complex and presents many data
quality and testing problems to overcome. Some of the main challenges of data warehouse testing are:
• Data Completeness. Verifying that all data has been loaded from the sources to the target data
warehouse
• Data Transformation. Ensuring that all data has been transformed correctly during the ETL process
• Data Quality. Ensuring that the ETL process correctly rejects, corrects, ignores, substitutes default
values, and reports invalid data
• Regression Testing. Ensuring existing functionality remains intact each time a new release of code is
completed
Design Library
Use the QuerySurge “Design Library” tools to create collections of powerful tests across your data warehouse
architecture.
❑ Create test QueryPairs between any two points (Source, Staging, Data Warehouse, Data Mart) in your
architecture
❑ See query history for all of your queries
❑ Run QueryPair executions as you build queries to ensure they produce the required results
❑ Make your design flexible with Reusable Query Snippets - Snippet libraries of query fragments that you
can use to modularize your queries, helping to speed up the process of bulk QueryPair updates
❑ Run the ‘Query Wizard’, which provides information for (1) row count compares, (2) full table compares,
and (3) column compares without writing any SQL code
Scheduling
Schedule your testing by time and location for maximum productivity. Schedule your tests for the specific
time and day or run tests when an event, like the ETL process, completes.
❑ Mix-and-match test QueryPairs in QuerySurge Test Suites to meet specific project execution goals
❑ Build groups of QuerySurge Test Suites to test specific mappings, ETL logic or Data Warehouse Sources
❑ Build QuerySurge Scenarios for scheduling your execution runs at specific dates and times
❑ Use the execution API for event-based scheduling
Run Dashboard
Visualize and track the real-time progress of your running Scenarios on the QuerySurge ‘Run Dashboard’. A
graphical display helps you to follow the flow of your queries, and you can drill-down to see test details and
data failures.
❑ View query execution progress live via graphical run status displays
❑ Drill-down into data as QuerySurge executes to examine results as they become available during
execution
❑ See real-time statistics for each QueryPair executed and for the Scenario execution as a whole
❑ Alert your team about the status of execution via custom email notifications
❑ Export detailed results in Excel, CSV, or XML formats to share with team members and other project
stakeholders
Get a comprehensive audit and share detailed results with others. Use QuerySurge reports to share both
high-level and detailed views of your testing with team members, managers, and business stakeholders.
❑ Choose from a wide selection of configurable reports within the QuerySurge ‘Reporting Center’
❑ Built-in reports range from high-level summary reports to lower-level, detailed reports that contain a
complete audit trail of test modifications
Administration
The administration module provides access to the control features of your QuerySurge installation. Here, you
have the ability to create and manage user profiles, database connections, Agent configuration, data
archiving and automated email notification options.
❑ Create and manage QuerySurge users and Agents
❑ Manage QuerySurge data storage with the included storage tools
❑ Create and manage connections to source and target data stores
❑ View QuerySurge server information, including configuration settings and your application licensing
details
❑ Create automated email notifications to send results to your team at the end of a test run
Testing and validating the ETL process is the key component to the success of a data warehouse
implementation. Bad data caused by defects in the ETL process can cause data problems in reporting that can
result in poor strategic decision making.
Example: A large fast-food company depends on BI reports to determine how much raw beef to order on a
monthly basis, by sales region and time of year. If these reports are not correct, then the company could order
an incorrect amount, which could cost the company millions of dollars in either lost revenue or wasted product.
Developers utilize ETL tools to accomplish the extracting, transformation and loading of data from sources into
target systems.
QuerySurge Agents
QuerySurge Agents are the components of the architecture that execute queries against source and target data sources,
returning the results to the QuerySurge database. The Agents execute SQL queries, validating each piece of data
throughout the ETL process. This exposes all data mismatch failures, row count differences, and column type mismatch
failures, affording you the ability to test to 100% of your data quickly.
Although the Agents issue queries to both the source and target databases, they do not reside on the physical source or
target database boxes. QuerySurge Agents can be deployed on the same box as the QuerySurge Application Server and
QuerySurge Database Server in a single box install or on any “satellite” boxes in the environment (often, these are test
lab boxes or available desktop boxes). The QuerySurge Agent, when it receives a bundle of queries, can run multiple
queries simultaneously (in parallel).
One of the features QuerySurge gives you is the ability to raise your ‘testing throughput’. The idea is to be able to fire off
QueryPairs in bulk against your sources and targets so that you can execute at the highest level your environment can
support. The QuerySurge Agent lets you do this, because you can deploy multiple Agents in your environment – on
‘satellite’ boxes surrounding your QuerySurge server (note that each Agent can run multiple query threads as well).
QuerySurge allows you to install up to 10 Agents.
How many Agents are appropriate for your environment? The answer is – you find out by experimentation. Once you
have built an initial test library, start with 2 or 3 Agents, and see how your sources and targets behave. Add additional
Agents in a subsequent cycle, again monitoring the source and target behavior. As you continue to add Agents, the loads
on sources and targets will grow with query volume – and source/target response times will start to grow as well. Once
RTTS was founded in 1996, and has cultivated partnerships with the world's leading
test tool vendors, including IBM, Microsoft, and HP. We are headquartered in New
York City and our satellite locations are in Philadelphia, Atlanta, and Phoenix. Many
of our consulting and education services are also offered through the cloud, so that
no matter where you are, RTTS will ensure application functionality, performance, scalability, and security for your organization.
About QuerySurgeTM
QuerySurge is the only automated software tool built specifically for ETL testing. It can verify as much as 100% of all data from
source systems, through the ETL process, to the target data warehouse and data marts.
QuerySurge has increased test coverage and reduced test cycle time for numerous
Fortune 500 organizations, helping them to mitigate risk and meet business
requirements. For more information, please visit RTTS’ team of test experts developed
QuerySurge ([Link]) to address the unique testing needs in the data
warehousing and data migration area. It has been implemented on projects ranging
from large data warehousing and ETL processes to data migrations, database upgrades,
integration testing, data load testing and system patch testing.