Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test structure #68

Open
maelle opened this issue Jul 19, 2022 · 0 comments
Open

Improve test structure #68

maelle opened this issue Jul 19, 2022 · 0 comments

Comments

@maelle
Copy link
Member

maelle commented Jul 19, 2022

For instance in https://github.com/ropensci/popler/blob/master/tests/testthat/test-cov_unpack.R

  • context() is deprecated, what helps finding context is the test file name that should correspond to the script name.
  • the helper function could be defined in a file tests/testthat/helper-
  • defining objects outside of test_that() makes it harder to run each test on its own, so it's better to do it inside test_that() (or in a helper function called from test_that()) even if it leads to a bit of repetition.

I recommend reading https://r-pkgs.org/testing-basics.html and the other chapters of that section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant