Closed etiennebacher closed 9 months ago
@etiennebacher Thank you so much for doing this! cobalt
severely needs a testing framework. I've only just started to use testthat
for some of my other packages. It will take some time for me to look into this and learn how to incorporate your additions.
Hi @ngreifer, small bump on this, just to know if you need some help with the transition to testthat
(I don't want to put pressure, I was just going through the list of my open PRs)
I see that you started using testthat
so this PR loses a bit of its interest (although I still think you could expect_snapshot()
to easily test the numeric outputs).
Hello @ngreifer, the goal of this PR is to convert the tests that are in
do_not_include/tests.R
totestthat
, so that the testing process is more robust and more transparent about the expected outcome (related to #5). Indeed, unless I'm mistaken (which may completely be the case), you don't really test that outputs stay the same indo_not_include/tests.R
.I just converted a few tests so that you can let me know what you think. If you agree with this conversion, then I can go on and move the rest of the tests.
The "problem" is that
bal.tab()
shows quite a lot of information and it would be tedious to hardcode all expected output to check that the results don't change, so I used snapshot testing. If you're not familiar with this, it consists in saving the output ofbal.tab()
to a text file (contained intests/testthat/_snaps
) and this output will serve as a reference for the future checks. This means that if anything changes in the output ofbal.tab()
(including the formatting such as spaces, indents, etc.), you will be notified and you can then review the changes (and potentially accept them). Here are some slides about it if you're interested: https://indrajeetpatil.github.io/intro-to-snapshot-testing/#/title-slideAnyway, let me know first if you want to continue this transition towards
testthat
Thanks for this super useful package ;)