uptasticsearch icon indicating copy to clipboard operation
uptasticsearch copied to clipboard

R package unit test coverage is not 100%

Open jameslamb opened this issue 7 years ago • 4 comments

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.

jameslamb avatar Sep 07 '17 00:09 jameslamb

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

jameslamb avatar Jun 05 '18 23:06 jameslamb

coverage as of #72

image

^ 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

jameslamb avatar Jun 19 '18 07:06 jameslamb

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

jameslamb avatar Jun 19 '18 07:06 jameslamb

If you want to contribute on this, here's how you can check the test coverage:

  1. Spin up Elasticsearch locally and seed it with data. This requires that you have docker running
./setup_local.sh 6.2
  1. Install the package and run the R tests
make install_r
make coverage_r

You should see something like this in the terminal

image

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.

  1. Add tests in R-package/tests/testthat and repeat step 2

  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.

jameslamb avatar Oct 24 '19 03:10 jameslamb