Advance Query Reports

Note

QMetry Insight module is visible only if the user has the View and Modify rights for QMetry Insight.

Advance Query Reports of QMetry Insight is designed for technical users with SQL knowledge who can write SQL queries and generate custom reports. The Advance Query view gives more power and flexibility to the users by providing them the ability to create custom reports by writing basic to complex SQL statements.

The interface is divided into two main sections. The left panel contains a list of tables and their fields, representing consolidated QMetry data needed for reporting. This data is accessible in just 15 tables which are synced in real-time. For making the query creation easier the names of the tables have a resemblance with QMetry test assets and different modules.

Understanding Screen Layout

The QMetry Insight module consists of the Query Builder. The query builder is used to create custom queries and add filters to generate reports accordingly. This document includes details about how to create Custom Reports using SQL query.

The screen is divided into four parts:

A. View Report Schema DB Tables

B. Query Builder

C. Filter panel

D. Result panel

QSvr_AQR_Advance_Query_Reports.png

Database Schema / Entity Relationship Diagram

The following is the database schema to view the entity-relationship diagram for advanced query reports.

QMetry Insight lists tables and their fields on the left panel. The panel contains the consolidated QMetry data in 15 tables which are synced in real-time. For making the query creation easier, the names of the tables resembles QMetry test assets and different modules.

Note

In Requirements and Issues tables, field names having "Jira" as prefix are renamed with “Ext” prefix.

varchar.png

Fields with this icon indicate the Type - varchar.

bigint.png

Fields with this icon indicate the Type - bigint or int.

text1.png

Fields with this icon indicate the Type - text.

datetime.png

Fields with this icon indicate the Type - datetime.

Expanding the table displays all associated fields in it. Hover over the fields to display the field's Type and Size.

Here is a quick overview of tables available as part of the report schema and the kind of data stored on it:

Table Name

Details

issues

Details of QMetry and external issues.

issuecycle

Details of cycles associated with issues.

issueextudf

Details of custom fields of external tracker mapped with the Issue module. The table is available only if you have opted for the Advanced Reports App.

requirementissue

Details of issues linked with requirements.

requirementextudf

Details of custom fields of external tracker mapped with the Requirement module. The table is available only if you have opted for the Advanced Reports App.

requirementreleasecycle

Details of release and cycle associated with a requirement version.

requirements

Details of QMetry and Jira requirements.

requirementtestcase

Details of Testcases linked to requirements.

testcaseissue

Details of issues directly linked with test cases without execution. The table is provided to enable the creation of reports containing defects linked directly to the test case.

testcasereleasecycle

Details of release and cycle associated with a test case version.

testcases

All the test case details.

testcasetestsuite

Details of test cases linked with test suites.

testexecutionissue

Details of issues found during executions.

testexecutions

Testcase execution details.

teststepexecution

Execution details of a Test case - steps.

teststeps

All the details of test case - steps.

testsuitereleasecycle

Details of release and cycle associated with test suites.

testsuites

All the test suites details.

users

All the details of users.

All ids like createdBy, owner, executed by, etc will be mapped with `users` table to get the username, userAlias, fisrtname, lastname etc.

Testcasefolder

Displays all folders associated with the test case, including the Folder Name, Folder Path, Test Case Folder ID, Test Case ID, and the archived status of each folder (if applicable).

If you have opted for the Advanced Reports App

When you enable Sync fields to Reports in the Integrations tab, custom fields from Requirements and Issues that are mapped to Jira or Azure appears in QMetry Insight tables. Additional tables for User-Defined Fields (UDFs) are also included.

  • External custom fields mapped to the Issue module are included in the issueextudf table.

  • External custom fields mapped to the Requirement module are included in the requirementextudf table.

For example, an external custom field "Release Reference" is mapped to the Requirement module in the Integrations tab under Projects, and the sync feature is enabled, it displays “ext_release_reference" in the requirementextudf table.

Qsvr_AQR_ExternalFields.png

If you have not opted for the Advanced Reports App

The Insight table does not display Custom Fields (of Requirements and Issue modules) mapped with Jira and Azure. Only QMetry Fields data and external tracker System Fields data which are synced are available for generating reports.

Control Custom Fields Synced to Advanced Query Reports

System Admins can control which Jira or Azure custom fields are synchronized with QMetry Insight Advanced Query Reports. With this, admins can manage which external custom fields are available for reporting and prevents unnecessary data synchronization.

Limiting synced fields improves reporting performance, data reliability, and control over reporting data.

Configure Custom Fields for Reporting

Admins can select which Jira or Azure custom fields should be available in Advanced Query Reports.

Note

Fields must also be enabled in the project configuration to be available for reporting.

Sync_Fields_to_Report_New_Screen.png

To configure custom fields for reporting, perform these steps:

  1. Go to Integration.

  2. Select the Jira or Azure integration.

  3. Locate Sync fields to Reports.

  4. Select the Configure icon.

  5. Select the custom fields you want to make available for reporting.

  6. Click Save.

Only the selected fields becomes available in Advanced Query Reports. Additional fields can be enabled later by updating the configuration.

Query Builder

Query Builder allows you to write SQL statements like SELECT statements. While writing a query the query builder auto-suggest field names when the user inserts the table name and enters a dot (.), the field names of that tables are auto-suggest.

QSvr_AQR_Query Builder.png

In case of a syntax error in a query, the query builder provides an ability to identify the error through the SQL Syntax Validator.

Note

  • SELECT * clause is not allowed. You must specify column names in the select statement.

  • UPDATE and DELETE queries are not allowed.

  • You can apply Group By to custom fields as well as system fields of type text, which includes lookup, multi-lookup, etc. Custom fields include QMetry custom fields and external tracker fields that are synced to QMetry Insights.

  • SQL queries support WITH clause, empowering users to build custom reports using Common Table Expressions (CTEs).

QSvr_AQR_CreateDataTable.png
  • Gadgets, apart from tables, are generated on 500 records.

  • While creating queries, during execution the query returns just the first 500 records. However, all data is available in the reports export.

  • By default, the latest test execution status for uncovered test cases is shown as "null." To display a status other than "null" for such uncovered test cases, use the COALESCE function in the query with the following syntax:

COALESCE (<fieldname>,'<statusvalue>')

Where, fieldname=testcases.latestExecutionStatus and status = the value that you want to print instead of "null"

For example,

COALESCE (testcases.latestExecutionStatus,'UnCovered')

The following query shows the usage of the COALESCE function in the query.

QSvr_AQR_COALESCE.png

Custom Fields (of Requirements and Issue modules) mapped with Jira and Azure will not be displayed in QMetry Insight tables. Only QMetry Fields data and Jira System Fields data which are synced will be available for generating reports.

The test asset key will become clickable on the report if the column name contains the keyword (i.e. Entity Key), in any of the formats like - "entity key" or "entityKey" or "entity-key" or "entity_key" in it.

QPro_AQR_AssetKeys.png

Adding Filters

Users can filter reports based on projects and folders. The system-pre-defined folder browse option allows users to filter custom reports based on folder structure, supporting both parent and subfolder selection. This feature is available for Requirements, Test Cases, and Test Suites, and functions only when you select a single project.

The Test Case Folder Path column supports multiple folders, allowing users to view all associated folder paths for a test case in reports.

  • You can view all folder paths linked to each test case.

  • You can also filter test cases using folder IDs or folder paths.

  • To fetch data from a specific folder, use an equal (=) operator. For example:

    SELECT requirements.entityKey, requirements.folderPath FROM requirements
    WHERE requirements.projectID = @filter.Project
    AND requirements.rqFolderID = @filter.RequirementFolder
  • To retrieve data from subfolders, use the IN operator. For example:

    SELECT requirements.entityKey, requirements.folderPath 
    FROM requirements
    WHERE requirements.projectID = `@filter.Project` 
    AND requirements.rqFolderID IN (`@filter.RequirementFolder`)

Scenario 1: Single Project Selection:

When you select a single project in the project filter, the folder filtering option remains available, allowing further refinement of the report based on the folder structure.

QSvr_AQR_SingleProject.png

Scenario 2: Multi-project Selection

When the user selects multiple projects, the folder filtering option becomes disabled, preventing further filtering based on folder structure.

QSvr_AQR_MultipleProj.png

Refer to the attached link for more details on System Filters Available for Query.

Gadget Charts

On the Result panel, select the report type you want to preview the report.

Here is an explanation on Types of Gadget Charts supported along with examples.

Saving Gadgets

You can write a query and run it to generate the report. You can generate different types of charts and add as a report to dashboard using Add Gadget.

image2020-4-21_20-27-39.png

The system adds the gadget to QMetry Custom Gadget section.

Modify Chart Colors

In QMetry, the Advance SQL Query provides an ability to generate custom reports with the required fields/values; let’s understand how to customize colors on your custom report charts.

Let’s take an example of a Stacked Bar Chart report.

Step 1: Create a Custom Report

Report: Generate a bar chart that displays the Count of the test cases by status over priority.

SQL Query

Count Of Test Cases By Status Over Priority
SELECT
count(1) as "Test Case Count",
COALESCE(testcases.priority, 'No Priority') as "Test Case Priority",
COALESCE(testcases.testCaseStatus, 'No Status') as "Test Case Status"
FROM testcases
WHERE testcases.projectID in (`@filter.project`)
GROUP BY testcases.priority, testcases.testCaseStatus

Query Output

By default, it gives you output in tabular format. You can modify the output format by switching to the available chart types from the table. In our case, we will switch it to the Bar Chart.

You can adjust the Columns based on the requirement to Label, Data and Cross Tab sections.

  • Label always holds a single Test entity field with any value.

  • Multiple Test entity field on Data creates a stacked chart; Data always contain fields with numeric values.

  • Cross Tab field will help to create a Group Stacked chart.

QSvr_AQR_Count_Of_Test_Cases_by_Status_Over_Priority.png

Step 2: Modify Chart Colors

The Chart Settings icon is provided with each type of chart that allows you to customize the appearance of the graph. You can customize the chart colors of your choice based on legends used in the chart along with a feature to enable/disable the legends as required; here’s how you can do it.

  1. Click the cog icon on the graph to open Chart Settings.

  2. You can customize the color of the legends as per your requirement.

  3. You can show or hide the legends on the graph by enabling or disabling the Visible settings.

  4. You can also show or hide the axis labels on the legends by enabling or disabling the Visible settings.

  5. Click Reset All” option under the Colors section to revert the changes (it will reset the colors to system-defined colors).

QSvr_AQR_Modify_Chart_Colors.png

Colors of Execution Status used as legends appear as they set in Execution Status under Customization. You cannot modify the colors from chart settings as the option remains grayed out for execution status (refer to the attached screenshot).

Edit Gadgets

The gadgets created under Advance Query Reports can be edited from the QMetry Custom Gadget.

QSvr_AQR_EditGadgets.png

1. Open the My Gadget tab.

2. Click the Edit icon for the gadget to edit. It navigates you to the Advance Query Reports (SQL query builder view) of the QMetry Insight module.

Exporting Gadget Data

Note

The excel file can contain maximum 1000000 records in one time export. Individual Gadget data can be exported into CSV with the same limit.

You can download the chart image in PNG, JPEG, SVG Vector, and PDF formats.

  • Export All Data: It schedules the Export Report task. You can see the scheduled job in the Scheduled Task section and download the report in CSV. This is a detailed report.

  • Export column Data in XLS: It downloads the details of the Chart Data Table (tabular details) in XLS.

QSvr_AQR_ExportGadget.png

You can also export all the custom dashboard gadgets through the API call. Refer API for Reports for more details.

Best Practices

  • Provide rights to write custom quesries only to those users who have knowledge of writing SQL queries and can access any QMetry data, as there is direct access to all QMetry data in Report Schema DB.

  • The custom SQL queries must always include a project filter specified as: @FILTER.PROJECT. This prevents the recipients of the shared report gadgets from inadvertently viewing data from other projects that they do not have access to.

  • The custom SQL report queries after creation must be run and saved against a Sample Project, so that the report does not load with the data of an un-intended project.

  • The Report DB has tables like testcase, testexecutions, etc. which now only have user IDs instead of the actual information of the users. This information should be queried by writing an SQL Join with user IDs from `users` table now available in the Report DB schema.

Publication date: