How to properly compare recordsets

credit: forums.2k.com
I am currently testing financial functions that return recordset. Here I would like to note the logical error that I made while I was writing rspec ruby test script. Because of the error, I had false positives. Test reported no errors, but function did not work properly!

My test strategy was rather simple. I have expected recordset and actual recordset returned by financial function.  They had same number of records. Then I wrote something like this:



Problem with this check is that reports false positive (no errors), for case when actual has zero records.

So, you should compare recordsets in this way:

Labels: ,