uptasticsearch
uptasticsearch copied to clipboard
R package unit test coverage is not 100%
Currently, unit tests cover only 59% of the lines of code in this project. Ideally, we would like every line in the project to be covered by tests.
happy to report we have near-100% coverage now as of #66! Still leaving this open...we would love help covering the last few tough-to-hit cases
coverage as of #72
^ note that those get_fields
lines are actually covered...there are two scrolling strategies (one for new, one for legacy), and only one of the two gets covered in any single set of tests (on a single ES version). They're both covered because our CI stuff tests over many versions
so our coverage is above 97%! Those last few lines would be real real hard to cover, but someone is welcome to take this up if they really want
If you want to contribute on this, here's how you can check the test coverage:
- Spin up Elasticsearch locally and seed it with data. This requires that you have
docker
running
./setup_local.sh 6.2
- Install the package and run the R tests
make install_r
make coverage_r
You should see something like this in the terminal
and a file coverage.html
should open in your default web browser. That file shows detailed information on which files have untested code and which lines specifically are untested.
-
Add tests in
R-package/tests/testthat
and repeat step 2 -
When you're done, be sure to clean up your local environment
./cleanup_local.sh
PRs that add any test coverage are welcomed! You do not have to get to 100% in one shot.