This project is read-only.

Do expected data types for query to query comparison break template concept?

Apr 2, 2015 at 10:49 AM
Dear Seddryck, dear fellow nbi-users,

could you help me to find an approach to use query-to-query-tests with a template appropriately?

When using a query-to-query-test template, we are running into the issue that the second+ columns are expected to be numeric values by default. In my mind, the query-to-query-template should cover all query-to-query-tests. Unfortunately, the queries return text in some columns. I know, that there is the possibility to specifically define column-data types, however this is just possible for test-by-test-definition and is not easy to do with a template approach: In one test the third column contains text, in another test the 20th column contains text.

How is it possible to resolve this easily?

To give an example: We use nbi and genbiL to create test suites dynamically from a set of rows. Each row contains connection and query-information to run a test.
One row may contain two queries:

Query 1: SELECT 1 AS ID, 5 AS Number, 'SomeText' AS Text
Query 2: SELECT 1 AS ID, 10 AS Number, '<N/A>' AS Text

The template we use is defined as follows:
<test name="TestExample">
                               <query connectionString="DB_1">
                                               <![CDATA[SELECT 1 AS ID, 5 AS Number, 'SomeText' AS Text]]>              
                               <query connectionString="DB_2">
                                               <![CDATA[SELECT 1 AS ID, 10 AS Number, '<N/A>' AS Text]]>                   
The error we receive is: "NBi.NUnit.Runtime.CustomStackTraceErrorException : The column with an index of 2 is expecting a numeric value but the first row of your result set contains a value 'SomeText' not recognized as a valid numeric value or a valid interval."

How is it possible to use the template for a range of query to query-tests without having to define column data-types for each one? If needed, this would vastly increase overhead and probably keep developers from writing tests while it's just hard to do then. We dont want developers to cope with the xml or break the great concept of generating tests with genbiL.

I'm open to suggestions. At this point we seem to use nbi incorrectly and are in a dead end with this basic test type.

Thanks in advance!
Sep 29, 2015 at 1:13 PM
Just to get the answer to this question documented. The developer added a values-default-type-property to the equalTo-Tag to set all column datatype defaults as text.
    <equalTo values-default-type="text">
        <query connectionString="@$ConnectionNameAssert$">