質問

I have written a series of test_that tests. There is one test_that test which has a side-effect of creating a sqlite3 table. The rest of the tests rely on this sqlite3 table. Is there a way to force this one test to run before any of the other tests do?

役に立ちましたか?

解決

If you are using test_dir or test_package (otherwise you can just put the tests in the same file after the sqlite test), you can put your test that generates the table in its own file and use naming conventions for execution. For example, inside tests/run.R you could have:

test_file("tests/testthat/myspecialfile.R")   
test_dir("tests/testthat/")   # will run every file with a name starting with `test`
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top