Month: May 2014

Comparing two datasets with NBi when expected values are not precisely defined

When you’re looking for insights to validate your BI solution with your stakeholders, it’s often impossible to have precise figures for some facts. If it was possible, your BI solution would probably not be needed. Your stakeholders should be able to give you estimations of these figures but not precise values. Usually you’ll end-up with something as “Last year, we’ve sold at least 10.000 units and the marketing department claims that we’re multiplying by ten our sell figures each year since three years”. You can translate this on a table by:

---------------------
| Year | Sold units |
---------------------
| 2010 | 10         |
| 2011 | 100        |
| 2012 | 1000       |
| 2013 | 10000      |
---------------------

Reminder: that these values are not exact. It means, that nobody has a precise idea of these figures so we’re not expecting that the values returned by your BI solution are precisely these figures.

NBi introduces at least three ways to represents this lack of precision in your automated test:

  • absolute tolerance
  • percentage of tolerance
  • ranges of values

The main difference between the first two methods and the third is that the first methods introduce a unique tolerance. This tolerance is valid for each row in the dataset. It means that I cannot apply a tolerance of 10% (or 10 units) for the first row and a tolerance of 20% for the second row. This option to be able to refine your tolerance row by row is introduced by the notion of ranges.

We can refine our expected dataset like this:

----------------------
| Year | Sold units  |
----------------------
| 2010 | [5;15]      |
| 2011 | ]80;100]    |
| 2012 | [900;1200[  |
| 2013 | (>=10000)   |
----------------------

As you can guess in the table above, NBi supports range with open or closed bounds and also infinite. NBi supports a large syntax to describe ranges, this let you the opportunity to be really expressive in your test.

The NBi’s syntax to define the result-set described above is:

<equalTo>
  <resultSet>
    <row>
      <cell>2010</cell>
      <cell>[5;15]</cell>
    </row>
    <row>
      <cell>2011</cell>
      <cell>]80;100]</cell>
    </row>
    <row>
      <cell>2012</cell>
      <cell>[900;1200[</cell>
    </row>
    <row>
      <cell>2013</cell>
      <cell>(>=10000)</cell>
    </row>
  </resultSet>
</equalTo>