Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When comparing result-sets, identify columns by name (and not only by index) #241

Closed
Seddryck opened this issue Feb 9, 2017 · 4 comments

Comments

@Seddryck
Copy link
Owner

Seddryck commented Feb 9, 2017

Currently, when comparing result-sets, the first column of system-under-test is always compared to the first column of the assertion. This is relatively intuitive but is not always suitable. With the support of NoSQL database returning result-set in JSON, it's a huge limitation. Indeed, seralization doesn't guaratee the ordering of the members and missing members on the first row can screw up all your table.

NBi should support to define that the comparison should be done on the column'name and not on the column index.

@Seddryck
Copy link
Owner Author

Seddryck commented Feb 9, 2017

  • add support for result-set by name (and not only by index)
  • refactor result-set comparison
  • refactor single-row comparison
  • extract method for value comparison to a new (or existing?) class
  • add support in Xml (equalTo, resultSet, column, ...)

@Seddryck
Copy link
Owner Author

Seddryck commented Feb 9, 2017

at the difference of comparison based on index, the comparison based on name will ignore all the columns that are not explicitly listed as keys or values.

To define the keys and values, you can use the equalTo element

<equalTo keys-names="Key" values-names="Value1, Value2">
...
</equalTo>

You can also use the column element

<equalTo>
   <column name="Key" role="key" type="text"/>
   <column name="Value" role="value" type="numeric"/>
</equalTo>

In a result-set you can assign a name to a column by using the new attribute column-name of the cell element. Only values specified in the first row ill be taken into account.

<resultSet>
  <row>
    <cell column-name="Value">2016-12-10</cell>
    <cell column-name="KeyField">10</cell>
  </row>
  <row>
    <cell>2016-02-02</cell>
    <cell>12</cell>
  </row>
</resultSet>

@Seddryck
Copy link
Owner Author

Seddryck commented Feb 9, 2017

@Seddryck
Copy link
Owner Author

@Seddryck Seddryck closed this as completed Sep 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant