Abbreviations, used in manual:
QG - Quality Gates
DV - Data Validation
JS - Java Script
CC - Calculated Column
Rules are used in DV Tests.
If same Rule should be used in more than one Test, so add Rule to the Library (possible only for the Rules of JS type).
In QG module in the left side menu open My Projects section -> choose a specific Project, "Library -> Rules":
Operations, available in the Rule's grid:
Bulk Operations - allow to mark a few Rules at a time and to Delete or Copy them together.
Deploy/Deploy All - allows to Deploy selected Rules/all the Rules in the page from one environment to another.
A Rule(s) can also be Edited/Copied/Deleted by clicking relevant icons in each row.
Adding a new JS rule:
In order to Crete a new JS rule from the grid, click "Add Rule" button. A Rule can be also created internally (from a specific Test) and to be used in one specific Test only or saved in Library:
Name - you can insert a name manually or to choose "Auto generate name".
Import From Library - allows to choose an existing Rule from the list of Rules available in current Project. By choosing one of them, the details of the chosen Rule will be imported to this current Rule and it will be possible to use it in the new Rule.
Description - short Rule description.
Severity - define Rule's severity (default value is "Normal").
Tags - choose relevant Tag(s) if needed.
Rule Formula - should contain Rule body.
i sign - shows shortcuts.
</> sign - closes the "examples" and allows to write JS code.
Each column's name should be surrounded with square brackets. For example: [<column>]
In order to use variable in Rule's Formula, type @ sign and list of available Variables will be shown:
In order to be able to use Calculated Columns (previously created), type # sign and list of available Calculated Columns will be shown, for example:
Calculated Columns - list of previously created for this Rule calculations. Please see lower detailed explanation.
Folder sign - functions of different types (such as Date & Time, Logical, ... ) can be used.
Table sign - shows the list of Data Set's columns.
{:} sign - shows variables.
Calculated Columns:
A Calculated Column (A) that will be used in the formula (B) can be created and will be included in the results alongside the existing columns. The Calculated Column is created and will be available in the formula section under columns. In the formula, you’ll be able to define the condition based on the calculations you performed in the first step:
Steps to Create a Calculated Column:
-
Creating the Calculated Column - click "Calculated Columns" ->"Add New" to create a new Calculated Column:
- The following form will open:
-
- Name - assign a name to the Calculated Column.
- Type - choose available type from the list, that will be returned from this Calculated Column (String, Boolean, Number, etc.)
-
Formula area
</>- create the formula for the Calculated Column in the provided area. Predefined functions can be used for operations such as Date & Time, Logical, Math, or Text. -
Existing Data Set Columns - you can incorporate columns from the Data Set into the formula by clicking the Table icon
. Additionally, the following options are available by clicking the respective icons:
-
Functions - The system includes predefined JavaScript functions that can be used in Rule formulas.
To use a function:
- Click on the arrow next to the function to insert it into your formula.
- You only need to input the required values.
-
A brief description of each function appears when you select it, helping you understand its purpose and usage.
Predefined JavaScript functions can be used for operations such as Date & Time, Logical, Math, or Text:
-
Logical Functions: Includes
AND,OR,IF, which help in defining logical conditions. -
Math Functions: Includes
ABS,ROUND,MAXand others for numerical operations. -
Date & Time Functions: Includes
DATEFORMAT,ISDATEand other functions for handling date and time calculations. -
Text Functions: Includes
CONCAT,UPPER,LENand others for manipulating text data.
-
Logical Functions: Includes
- Columns: Use columns available in your Data Set.
- Variables: Use variables available within the project.
- Operands: Apply various operators in your formula, such as =, !=, >, and more.
-
- Validate: Once you’ve written the formula, click the Validate button to ensure the formula is correct.
-
Save: After validation, click the Save button to save the Calculated Column. It will now appear in the columns list with a # sign to differentiate it from the standard Data Set columns.
Note: Only JavaScript functions are available in this system;
While some functions may share names with SQL functions, they are executed as JavaScript within this environment.
Example:
Calculated Column (A)
(B)
It is possible to create a New column (with specific formula/calculation) in order to make calculations simpler.
Click "Calculated Columns" -> "Add New":
Calculated Column form will open:
Existing Data Set's columns can be used in formula (click the table sign) or same as variables (the {;} sign) for the new CC.
Please make sure that your formula is set properly by clicking "Validate" button:
CC can be saved by clicking "Save" button.
It will appear in the columns list with "#" to differentiate it from the Data Set's columns:
This way CCs can be used in Rule's formula.
Threshold - allows to define a specific threshold for the Rule.
For more details use Thresholds By Test Types manual.
Comments
0 comments
Please sign in to leave a comment.