alerque / stack-verse-mapper

Index Bible verse references in Stack Exchange data dumps.
https://alerque.github.io/stack-verse-mapper
GNU Lesser General Public License v3.0
6 stars 0 forks source link

Testing #17

Open curiousdannii opened 8 years ago

curiousdannii commented 8 years ago

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?

alerque commented 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.

curiousdannii commented 8 years ago

https://github.com/sstephenson/bats This looks like a good bash testing framework.

alerque commented 8 years ago

This has been asked about on the appropriate Stack site.