DB Validation Rulesets
Backend Testing allows to validate database entries for the specified tables in the backend ABAP system. During full end-to-end testing within SAP Landscape of an application interface, the final document that Int4 Suite created in the SAP backend will be checked against the reference document stored during test cases creation. From the technical point of view, the validation is performed by comparing the selected database tables and table fields of both documents: the reference and the new one created during the test case execution. We make a business document’s database model representation and choose the tables, relations, and fields we want to be compared to achieve this.
Database Validation Rulesets can be reused by multiple automation objects.
Basic Information
You can access the Database Validation Rulesets by opening the Database Validation Rulesets tile.
In the Database Validation Rulesets you can create or preview existing validation rulesets.
To create the validation rulesets, click Create button and then provide Ruleset ID and Description.
Parameter name | Description | Example |
Ruleset ID | ID of the DB Validation Ruleset that will be used by other Automation Objects | DB_RULE_SALES_ORDER |
---|---|---|
Description | Description of the DB Validation Ruleset | Sales Order DB Validation Rulesets |
Steps
Parameter name | Description | Example |
Table Name | Name of a database table validated in the step | VBAK |
Select up to rows | Optional field that will allow limiting the number of fetched records from each table. It is like 'UP TO n ROWS' in the SELECT statement. | 1 |
Buffer Records | If checked, then expected results are stored in a buffer after the first execution of a test case and used later on to compare with the actual results. If unchecked, then the expected results are removed from the buffer (if stored previously). |
|
To add the main table name click on the Create button and provide the name of the table that has to be validated.
In case you want to add a child table which entries are determined based on the keys from the main table select the row with a main table name click Create substep button.
Example
When records for reference and the newly created document will be fetched from the VBAK table (Sales Order Header) by variables, the entries from table VBPA (Partners) will be fetched based on the key field (VBELN) of the selected VBAK entry.
Then entries from VBAP will be fetched again based on the key field of the selected VBAK entry (VBELN field).
Finally, the entries from VBEP (schedule lines) will be fetched based on keys of records fetched for the VBAP table (VBELN and POSNR).
See the next chapter Selection Criteria to see how this selection works in detail.
During S/4 HANA migration projects there might be a requirement to compare data which is no longer available in the same tables of the target system e.g. due to data model simplifications.
For example status fields of Sales document which was stored in tables VBUK and VBUP in S/4 HANA is moved to VBAK/VBAP, LIKP/LIPS.
Most of the time there is a compatibility view which allows to query the old tables also in S/4 HANA system.
In case the compatibility view has different name you can maintain the mapping in the Configuration Tile > Landscape configuration > Table replacement configuration.
In the example above VBUK data can be compared by maintaining compatibility view V_VBUK_CDS.
Selection Criteria
Selection criteria are used to fetch relevant records from tables specified in the Steps step. For each table, it must be specified how the rows should be selected based on values stored in variables or fetched from records from preceding steps. Technically the configuration is used to prepare WHERE conditions for database queries. The queries that will be generated will be used to fetch references and newly created documents.
Parameter name | Description | Example |
Field name | Name of database field from database table defined for the step or one of the joined tables. | BSTNK |
Sel Opt | SQL Comparison Operator based on the list: = Equals | Equals |
Reference Type | Type of value used for comparison.
| Variable |
Reference Value | Reference value depending on Reference Type.
| PO |
operator | (optional) SQL Logical operator used in case of multiple criteria are defined for the table. Available options:
which means if the criteria should be considered together or separately |
|
optional |
|
|
To add a selection criteria select the table for which you want to add them in the Steps section and in the Selection Criteria section click the Add button.
Example 1
Fetch headers of reference and newly created sales order based on variable PO from the Automation Object where DB Rulesets will be used
The variable PO in the automation Object is configured to fetch from reference XML or EDI file the field that contained the purchase order number.
Then the variable was regenerated with a new value from the IFTT number range and substituted into the new XML.
Example 2
Fetch all order items for the Sales Order that is chosen in Example 1 based on the VBELN (Sales Order Number) field.
If the conditions are built on the queries that use JOIN, then the field name must be specified with table name like for example VBKD~BSTKD
Comparison Details
The comparison of reference and the new document is based on table and field level.
Finally, when the definition contains tables and the logic of how rows from the tables will be fetched, it is time to specify fields from each table that is compared.
Parameter name | Description | Example |
Field | Field of the document for which we want to define an assertion rule. | VBTYP |
Rule | Assertion rule. Possible values: |
|
| The database fields are ignored while performing assertions. They are displayed in the results, but they are not marked with any color. |
|
| Suppose the values within the compared database fields differ. In that case, the fields are marked with yellow color on the results screen, indicating "warning". If there are no values within compared database fields, the fields are marked red, meaning "error". |
|
| Suppose the values within the compared database fields differ. In that case, the fields are marked with red color on the results screen, indicating "error". If there are no values within compared database fields, the fields are marked red, meaning "warning". |
|
| If the values within the compared database fields differ, the fields are always marked with yellow color indicating "warning". |
|
| always error when values are different | E |
| In case compared DB values are different IFTT compares them with specified variable. If reference/current value pair from DB comparison matches variable values result is marked as "warning". Variable name used for checking the values has to be specified in the Processing Parameter column |
|
| In case compared DB values are different IFTT compares them with specified values in the Mapping Object. If reference/current value pair from DB comparison matches mapping values result is marked as "warning". Mapping Object name used for checking the values has to be specified in the Processing Parameter column. Mapping object and values are configured in /INT4/IFTT_IMG → Landscape configuration → Define Mapping Objects |
|
| Checks current value against pattern specified in the Parameter column. Patterns can be specified as regular expressions. | 00{REF} - expected same value as in reference with two leading zeros
{REF}_[0-9]{4} - expected same value as in reference with prefix '_' (underscore) followed by 4 digits |
| Checks reference value against pattern specified in the Parameter column. Patterns can be specified as regular expressions. | 0000{ACT} - expected same value as in current with four leading zeros
[A-Z]{3}_{ACT} - expected same value as in current with three letters followed by '_' (underscore) as a prefix |
Mask Output | hide the field entry in test results |
|
Description | optional description |
|
Parameter | Placeholder for additional parameter values required by some of the rule types |
|
To add a Comparison Details in the edit mode select the table from the Steps section and then click the Add button.
Example
Example fields to be compared in the VBAK table
Joins
Join tables are used to configure SQL join conditions to filter the selected data for the current step table configuration. You can still validate the table entries of the join table. However, it must be declared in a parent step, or a proper predefined database view should be used in the current step instead of the database table. The joined table might also be used for selection criteria as well as for additional fields to compare.
Parameter | Description |
Table Name | Name of the table that will be used for join |
---|---|
Join Conditions: Source Field | Field from the main table in the Steps section that will be used for a join |
Join Conditions: Target Field | Field from the target table in the defined in the Table Name that will be used for a join |
Sorting Criteria
Sorting Criteria is an optional configuration for the comparison of the tables. Suppose you want to make sure that reference and new records are compared in a specific sequence. In that case, you can select fields and sorting direction here. If the configuration is not maintained, no action will be performed.
Parameter name | Description | Example |
Field | Field Name used for sorting | ERDAT |
---|---|---|
Direction | Sorting Direction, options Ascending and Descending are available | Descending |
Matching Criteria
Matching Criteria is an optional configuration for tables that contain multiple items (like sales order items). When reference and new records are compared, they will be first matched by the field specified here.
If no matching criteria are defined, items are compared based on an index ( first position from an original document with the first position from a new document, etc. ). It can lead to false-negative results if the new document's positions are posted in a different order.
Parameter name | Description | Example |
Field Name | Name of the field used for | POSEX |
---|
Example Sales Order Item matching based on the line item number (POSEX)
Deletion of Duplicates
Deletion of Duplicates is an optional configuration for the DB Ruleset Details.
Suppose you want to make sure that unique records (based on fields' value) are compared. In that case, you can select fields for value comparison here. Records will be compared one by one, and only the first record with the same value will be kept for further processing. You can define the order of the records in the Sorting Criteria configuration. If the configuration is not maintained, no action will be performed.
Parameter name | Description | Example |
Field Name | Field Name based on which duplicates will be deleted | BSTKD_M |
---|
© 2017 - 2022 Int4 AG All rights reserved