# Automatic testing of your R package

1. In your R package directory, run
usethis::use_testthat()

1. Open an R file of your package in the script editor.
2. Run
usethis::use_test()


to create a corresponding test file in the tests/testthat directory.

3. In this file, add one or more entries of the form
test_that(
'an informative completion of the sentence: test that, ...',
{
expect_*()
}
)


where expect_*() is a function that makes a binary assertion about whether or not the actual result (the first argument) does what you expect (the second argument).

3. Regularly test your package via
devtools::test()


and add tests whenever you discover a bug.