'testing external excel output with R testthat package
I'm trying to test a function of mine with the testthat package. The function is supposed to create an excel file, and I want to test if that excel file exists and contains the things it's supposed to contain. I tried running the function to create a simple mockup excel file and then reading in the output again, but that seems to not do anything, I'm guessing because of the localized testing environment. I also feel like writing code outside of the tests is not a good idea since it gave me a warning message about it. Is there a way to test an external output with testthat that I don't know about? I'm new to unit testing and this package so any help would be appreciated.
Solution 1:[1]
I actually solved this myself by accident: code run in test_that DOES produce output, just in the test folder. I could read it from there and then test.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rjwg |
