dev icon indicating copy to clipboard operation
dev copied to clipboard

Write unit tests

Open bambooforest opened this issue 7 years ago • 8 comments

bambooforest avatar Jun 21 '17 14:06 bambooforest

some units tests include:

  • known number of unique language codes
  • range of segment counts (11-161)
  • NAs in various columns, including the feature columns, language codes, etc. (i guess any column that can't contain a null)
  • duplicate feature vectors (note already in aggregation script)
  • missing feature vectors (also already in aggregation script)
  • column type checks (we might want to cast certain columns to numeric, character, etc.)
  • segment ordering conventions and that all segments are valid according to these

bambooforest avatar Jun 26 '17 21:06 bambooforest

http://kbroman.org/pkg_primer/pages/tests.html

for unit tests. it'd be nice to integrate travis as well:

https://travis-ci.org/

bambooforest avatar Jul 09 '17 20:07 bambooforest

@drammock do you have a preferred testing framework for R? i see a few different options, like

https://github.com/yihui/testit https://github.com/hadley/testthat

a quick-and-dirty approach would be to write tests that run on the output of the aggregation script (language code checks, segment convention validation, that all bibtex keys match InventoryIDs, etc.)

a more in-depth approach would be to integrate the tests into a phoible R package. i guess the question for me is whether we move forward with an R package by writing the tests, thus skipping the quick-and-dirty in part (tests of course still need to be written :)

what do you think?

bambooforest avatar Jul 20 '17 09:07 bambooforest

I haven't done proper test-driven development in R before, only ad-hoc testing scripts. I like the simplicity of testit (the README was enough that I already know how to use it, whereas testthat says "go read this whole chapter (and probably, all the chapters that came before it)." Honestly I've been burying my head in the sand about writing tests because I secretly want to switch to python (for which I use nosetests). Might be time for a skype meeting so you can talk me down from triggering another overhaul :grimacing:

drammock avatar Jul 20 '17 16:07 drammock

We could also ideally include continuous integration

bambooforest avatar Feb 25 '20 12:02 bambooforest

Note some tests I've written here should be eventually incorporated into dev:

https://github.com/bambooforest/phoible-scripts/blob/master/tests/tests.md

bambooforest avatar Mar 10 '20 11:03 bambooforest

@bambooforest -- create the list of tests that we need (as per our discussion June 2, 2020)

bambooforest avatar Jun 03 '20 11:06 bambooforest

tests failing here:

  • inventory 2478 is the one failing the phoneme uniqueness test.
  • invalid ISOs: "daf" "duj" "wit" "kxl" "krm" "kxu" NA "drh" "dit" "mwd" "qgu" "bjd" "ggr" "yiy"
  • invalid glottocodes: NA is the only one
  • inventory 695 has one row where the language name is "dida" instead of "Dida" (capitalization)...

bambooforest avatar Jul 15 '20 09:07 bambooforest