Sometimes when using LegiTest and doing a comparison between two data sets you may encounter the following error messages
These errors indicate that the queries are pulling back two different data types. The first error shows up when building the queries within the Comparison Manifest, and the second error shows up after you run a test within Visual Studio. The second is the exception message when the test fails, and both indicate a data type mismatch.
In the above example, the expected data set is using a data type of Decimal, while the actual data set is using a data type of Integer.
In order to fix this error, one of the queries should be modified to change the data type to a compatible type. The CAST function can be used for this on the SQL Server platform. Other data sources may offer different conversion functions.
- Edit either the expected or actual query, in the example above the Expected query will be edited in the Comparison Manifest. You can change whichever query you prefer.
- Use the CAST function to convert the column in question (CustomerKey) to an INT.
- Click “Compare” and the error will no longer appear.
- You will see your comparison instead, as shown below.