So I’m writing an ORM for NodeJS and using Mocha + Chai to test it.
What I want to know is, what tests I should write to it, insertion tests should also have a querying test so I can check if the tool has inserted the correct data?
Also, how should I organize the tests? Any example of how to begin to write those tests? (Not an example of how to write tests, but how to organize and plan the tests for an ORM)
3
I tested the ORM for the Chicago Boss framework about a year ago. Instead of using unit tests I mostly used QuickCheck Properties, in which I created random data and saved it to the database, then read it back and made sure that I got the same thing back.
It turns out that there was a problem (now fixed) in that if you saved a string that had the substring ” ” in it that the double slash would be dropped. I found this by having my tool create hundreds (or maybe thousands) of strings and saving them to the database until it found one that broke.
Right now I am using this framework in Javascript https://github.com/jsverify/jsverify and quite happy with it