Skip to content

datacamp/testwhat

Repository files navigation

⚠️ This repo had outdated tokens in its travisci config To make new releases for this project it needs to be moved to circleci

testwhat

FOSSA Status

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.

For details, questions and suggestions, contact us.

Installation

library("remotes")
install_github("datacamp/testwhat")

Demo

Experimenting locally:

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.

Tests

testwhat currently depends on the proprietary RBackend and RCompletion packages to run tests. Tests run automatically on every branch that is updated through travis.

devtools::test()

Documentation

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.

License

FOSSA Status