Compare Records
The Compare Records action is used compare record layout files such as semicolon delimited files. This action does not support comparing XML files. Two distinct records can be compared for equality, or multiple records can be summed and compared to the value of a single summary record.
Before the action can be used in a test, however, certain resources must be configured in Rational® Integration Tester as follows:
- Define record layouts in the Schema Library for
each type of record to be compared. You must specify the appropriate
field type for numeric fields, but all other fields can be strings.
All columns in the layout must be defined and have unique names, and
you must specify the delimiter in use under the Options tab.
See Record layouts.Note: Every column in the record must be defined in the record layout. If there are more columns in a record than expected, the action fails. If a row contains fewer columns than expected, however, the values for the "missing" columns defaults to null.
- Create schemas for each type of file and apply the correct record layout to it. In general, you create one file schema per record layout. Under the Settings tab, the schema type must be set to Delimited. Additionally, you can tell Rational® Integration Tester how many rows to skip at the start of the file (for example, for header rows). See Creating file schemas.
- Create file resources in the Logical view of the Architecture School perspective (Testing with the File transport. With each resource, you can optionally define a specific directory. The directory can be overridden in the Compare Records action. You must also apply the appropriate schema (created earlier) in the File Schema field. ). For more information, see
After the required artifacts and resources are configured in Rational® Integration Tester, you can add the Compare Records action to a test and begin to configure it.
A record-based file comparison is made between two files or groups of files. Each source in the comparison (expected and actual) can consist of one or more files that are concatenated together for the purposes of the comparison.
The basic configuration consists of telling Rational® Integration Tester which columns within each source are used to identify a record (the record mappings) and how they are matched up between the two sides of the comparison. Next, configure which columns in matching records are to be compared.
- Config
- Used to select resources and mappings. See Selecting file resources and record mappings.
- Filter
- Used to configure filters. See Configuring file resource filters.
- Assert
- Used to set up comparison options. See Configuring comparison options.
- Logging
- Used to configure logging options. See Specifying the logging options.
For each resource, record mappings are specified to identify which rows to compare. For the sake of performance, the fewest number of mappings possible are to be used to uniquely identify a row, and the contents of a record mapping column must not be null. Once a matching row or set of matching rows is found, the comparison occurs as defined under the Assert tab.
Columns of any type (defined in the record layout) can be compared for equality, and numeric columns can be compared against a tolerance. When you are using a tolerance, columns that do not differ by more than the specified amount (+ or -) is considered to match. For example, a tolerance of '0.1' means that 1.5 is "equal" to 1.4 and 1.6.
If you are comparing summary data, you can specify a sum comparison that adds up values in the target resource (right side) and compare the total to a single row in the source resource (left side).
Finally, you can configure the action to report any record mapping columns that are found in one resource and not the other.
gh.filecompare.maxlinelength
argument
can be applied as a JVM argument in Library Manager to force the comparison
to skip blank lines or lines that are too long, as they can cause
Rational®
Integration Tester to run out of memory. The default value is 10,000.
For example, gh.filecompare.maxlinelength=6000.Results
The test passes if the two files are identical. The test fails if any differences are found.
The number of differences that are found is reported on the console. To see a list of the differences, the action must be included as part of a test suite. The differences are then displayed on the Reports page of the Results Gallery perspective.