Open curiousdannii opened 8 years ago
I like the idea of testing against a known xml file with each edge case we run into. This would be easy to test on because the XML intput and expected json output would be in the repo and all we would have to do is regenerate the output and see if it changed on disk. The hardest part would be putting together a sane XML file with sample posts, but even that is a copy/paste job out of the existing dumps. We just need a sample post for each edge case we make allowances for.
We can do both console and node based testing if we need to. I haven't used any node based test frameworks before but I'm not opposed to it if there is something that will keep us sane. It doesn't have to handle the bin
stuff or even look at the site generation stuff either because make can handle that directly.
https://github.com/sstephenson/bats This looks like a good bash testing framework.
This has been asked about on the appropriate Stack site.
I don't know what unit testing approach would be best to take, especially as we'll want to both do unit testing from within node (ie, require a module and test its exported functions) and without (testing the bin/ scripts directly.)
For the parser and indexer I think it would be good to test a cut-down Posts.xml with a lot of edge cases, and then confirm against a result index file. So I guess we'll need some general console based unit testing framework. Any suggestions?