If the file currently open in the RStudio editor is called my_function.R, this creates the file /tests/testthat/test_my_function.R and fills it with a basic test skeleton.

test_skeleton(fname = NULL, open = TRUE, sep = options("testthis.sep"))



character scalar. Target R script file to open. If empty the file currently open in the editor will be used.


logical scalar. Should the test file be opened after it is created?


character scalar. Separator between test and fname when constructing the test file name. Should either be "_" or "-" for compatibility with testthat.


NULL (invisibly)

Side effects

Creates an R script file in the file system.

See also