ngreifer / cobalt

Covariate Balance Tables and Plots - An R package for assessing covariate balance
https://ngreifer.github.io/cobalt/
73 stars 11 forks source link

add testing framework? #5

Open BarkleyBG opened 6 years ago

BarkleyBG commented 6 years ago

I see that you have a file do_not_include/tests.R. It doesn't seem to me that this is strictly in the unit testing framework. If it's not, I think a huge improvement would be to implement a unit testing framework, like from the testthat package.

An easy way to do this is to type in devtools::use_testthat(), and the directory structure will be added. I'd be happy to help you set up your first couple of tests to get you started. If you're interested, please respond below (but don't close the issue)

BarkleyBG commented 6 years ago

If you do want to start using testthat, I recommend you start a "topic branch" for it. This should be a straightforward, but perhaps important change, so it's best to do this in a sub-branch, and not in master.

See this schematic for a helpful idea: You can take your current commit in the master branch and create a new feature/topic/sub-branch called, say testthat. Then, you can work independently in the two branches, and then when the testthat work is good go go, you can merge it back into master.

This way you can avoid messing up any good code while you're implementing something new!

etiennebacher commented 3 years ago

Hi, I just stumbled upon this issue. An alternative to testthat is tinytest. The advantage is that it doesn't have dependencies. I've never used it, but thought it would be interesting to mention it here.