If the currently open file in the RStudio editor is called myfun.R this opens tests/testthat/test_myfun.R in a new tab. This function can also be used to jump back and forth between a script and the associated test file. You can modify this behaviour by putting the comment #* @testfile anotherfile anywhere in myfun.R.

open_testfile()