I don’t know who started this pattern, as I’ve seen it in a few places. It could have been Sebastian Meine or Dennis Lloyd. Maybe it was Dave Green, who did the Pluralsight course on tSQLt. Not sure, but I like it.
If I’m looking to set up a test against a table called Customers in my database, in the Assemble section of the test, I’ll create this table:
create table Customers.Expected ( CustomerID int , CustomerName varchar(200) ... , Status int )
This would match the exact structure of the Customers table, or at least have the structure I’m testing. If I’m only testing a part of the table, I might not use all the fields.
However this lets me easily determine what this table is. It’s my expected result set.