Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I ignore a column in a tSQLt AssertEqualsTable?

Tags:

tsqlt

Is it possible to ignore certain columns that are almost definitely going to be different in a tSQLt AssertEqualsTable? Examples would be primary keys from the two results tables, insert/update date stamps, and so on.

I have been working around this by selecting only the relevant columns into new temp tables and comparing those instead, but this means extra work and extra places to make mistakes. Not a lot, sure, but it adds up over dozens or hundreds of tests.

A built-in or simple way to say 'compare these two tables but ignore columns X and Y' would be very useful. Is there a better solution than the one I'm using?

like image 619
Alex Avatar asked Jul 23 '14 09:07

Alex


1 Answers

All you need to do is populate an #expected table with the columns you are interested in. When AssertEqualsTable does the comparison it will ignore any columns in the #actual table that don't exist in the #expected table.

like image 161
datacentricity Avatar answered Oct 19 '22 15:10

datacentricity