Verify R code submissions and auto-generate meaningful feedback messages. Originally developed for R exercises on DataCamp for so-called Submission Correctness Tests, but can also be used independently.
testwhatand articles about what to use when, consult https://datacamp.github.io/testwhat.
For details, questions and suggestions, contact us.
library(testwhat) setup_state(sol_code = "x <- 5", stu_code = "x <- 4") ex() %>% check_object("x") # No error: x is defined in both student and solution code ex() %>% check_object("x") %>% check_equal() # Error: The contents of the variable `x` aren't correct. # Debugging state s <- ex() %>% check_object() s # only prints out state class str(s) # full overview of state s$get("student_code") # access student code in state
To include an SCT in a DataCamp course, visit https://instructor-support.datacamp.com.
testwhat currently depends on the proprietary
RCompletion packages to run tests. Tests run automatically on every branch that is updated through travis.
Whenever a push is done to the
master branch, this repo will automatically build a
pkgdown website (containing reference documentation and vignettes), push it to the
gh-pages branch, which in turn is served by GitHub at https://datacamp.github.io/testwhat.