karissawhiting / oncokbR

Annotate mutation, copy number alteration and structural variant data in R using oncoKB Annotation API
http://www.karissawhiting.com/oncokbR/
Other
5 stars 9 forks source link

Add unit tests and check functionality & docs of functions #14

Open karissawhiting opened 1 year ago

karissawhiting commented 1 year ago

Here are some steps to help you get started contributing to this

  1. If you've never written unit tests, here is a great resource to skim in order to get an introduction to testing https://r-pkgs.org/tests.html
  2. Fork, clone and branch the repository (see github trainings)
  3. Once you've done the above to get your own copy, check that you can install the package and run checks ("Build" tab in RStudio). Try checking the package test coverage with withr::with_envvar(new = c("NOT_CRAN" = "true"), covr::report()). This will show you the test coverage of each file and the package overall. One of our goals is to increase this coverage percentage.
  4. Read the documentation for the argument you are testing (it might also need updating).
  5. Start writing tests with correctly specified args passed and also incorrect args passed. Check the following, as well as any common user behavior you can think of:
    • When you specify the argument correctly (according to the documentation) does it return what you would expect ?
    • When you don’t specify the argument at all, does it return what you expect?
    • When you incorrectly specify the arg, does it give you a useful warning or message?
  6. Please add tests to the tests R files (in test folder). For tests you can use internal package (cbioportalR::blca_mutations, etca), a small sample of real data, or create your own fake data.
  7. Additionally, if the function is working as expected but the function documentation is not clear, please edit the documentation (R folder in package). If any functions don’t work as expected, please make or suggest a change to the documentation or the function itself. If you can fix it yourself, please submit a PR with a change. For example, if you think the error/warning messages are unclear, please add warnings to the function. If you can’t fix it yourself, no problem, but please file an issue for your suggestion so we can make sure to address it!