NBi tries to be smart when comparing two result sets. This analysis, performed by NBi, will help you to identify the differences (if any) between your result sets. Here under, you’ll also learn how to specify tolerances for some columns.

Column’s roles

For each column you can specify a role. Currently, three roles are existing (Key, Value and Ignore).

Key

The key columns are useful to find corresponding rows between two result sets. Note that the key columns in a result set must be unique (especially in the result set defined in your constraint). If it’s not possible for you to specify a unique key in your expected result set, NBi will not help you too much finding the difference with another result set.
Based on key columns, NBi will identify how many (and which) rows are expected but not found on the actual (system-under-test) result set –Missing Rows– and how many (and which) rows are not expected but found on the actual (system-under-test) result set –Unexpected rows–.
To illustrate this, if you’re expecting to find two buyers A and B having respectively bought for 100$ and 25$ then you should specify that the column "Supplier" (index equal to 0) is the key. If your actual result set is A (100$) and C (55$), NBi will tell you that you’ve an unexpected row (c) and a missing row (B).

Value

The value column let NBi tells you that two rows matching keys have a difference but limited only the some values. So the row is available in both result sets but is not identical.
To illustrate this, if you’re expecting to find two buyers A and B having respectively bought for 100$ and 25$ then you should specify that the Supplier is the key and the amount is the value. If your result set is A (100$) and B (55$), NBi will tell you that you’ve no unexpected row, no missing or unexpected row and two matching rows. Then NBi will also add that the second row has non-matching values (55$ <> 25$).
You can also apply a tolerance to value columns.

Ignore

The column is simply ignored during the comparison. It means this column doesn’t influence the result of the comparison.
This type can be useful with MDX queries returning a default measure if you don’t care about this value. Some queries also have a Timestamp column attached as last column and this kind of column is not relevant when comparing two result sets.

Column’s types

This only applies to columns with a role set to values. Type for column with a role set to key are always considered as Text (see bellow).

Text

The exact content of the cell is used during comparison. It means that values “10.0”, “010” and “10” are considered as different when using this type. Pay attention that the comparison is case-sensitive.

Numeric

To avoid comparison of textual content, you can use the “Numeric” type. The content of the cell is first converted to a numeric (decimal) value using the international format (a dot to separate the decimal part). It means that values “10.0”, “010” and “10” are considered as equal when using this type. To specify that your column is a numeric column, just add the attribute 'type' with the value 'numeric'.

DateTime

The DateTime type has the same role than the “Numeric” type. The content of the cell is first converted to a DateTime value using the international format (yyyy-mm-dd hh:mm:ss). To specify that your column is a dateTime column, just add the attribute 'type' with the value 'dateTime'.

Boolean

The boolean type has the same role than the “Numeric” type. The content of the cell is first converted to a boolean value. NBi understands "0" or "false" and "1" or "true" as boolean values. To specify that your column is a boolean column, just add the attribute 'type' with the value 'boolean'

Xml syntax

NBi’s xml syntax is to define columns tags in your equal constraint:

<assert>
	<equalTo>
		<column ... />
		<column ... />
		<resultSet ... />
	</equalTo>
</assert>

For each column you must specify the index of this column. Note that the first column has an index of 0 (and not 1). The index is a zero-based Index.

<column  index="4" ... />

Once the index is set, you must specify the role, the type and optionaly the tolerance or rounding of the column.

<column  index="0" role="key"/>
<column  index="1" role="ignore" />
<column  index="2" role="value" type="numeric" tolerance="0.001" />
<column  index="3" role="value" type="numeric" rounding-style="floor" rounding-step="1000" />

Last edited Feb 14, 2015 at 9:46 AM by Seddryck, version 7

Comments

No comments yet.