testwhat v4.2.2

Easily write submission correctness tests for R exercises

This package makes it easy for teachers to test students' code submissions for R exercises, e.g., for interactive R courses on \url{www.DataCamp.com}.

Readme

banner

Build Status codecov.io

The testwhat package provides rich functionality to write Submission Correctness Tests for interactive R exercises on the DataCamp platform. The package is inspired by Hadley Wickham's testthat package, the standard for unit testing in R. For a detailed guide on how to use testwhat, head over to the wiki. To learn more about course creation for DataCamp, visit our Teach Documentation.

Installation

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

Testing this package

Because testwhat depends on proprietary R packages, you can only run the tests on a system that has these packages installed. If you have the private codecov token, you can also upload the coverage results:

# Run the tests locally
devtools::test()

# Run only a part of the tests
devtools::test(filter = "test-object")

# Upload code coverage report to codecov.io
covr::codecov(token = "private_token")

For more details, questions and suggestions, you can contact content-engineering@datacamp.com.

Functions in testwhat

Name Description
is_equal Check equality of two objects
ex Get the main state
get_solution_code Get solution environment (backwards comp)
is_false Check if object is false
is_gte Check >= relation
is_true Check if object is true
get_student_code Get solution environment (backwards comp)
get_solution_env Get solution environment (backwards compatbility)
DC_reporter DataCamp reporter: 'log' test results
check_that Expectation wrapper
reexports Objects exported from other packages
s3definitions S3 definitions
test_code Test the student's code as text
success_msg Define the success message
test_an_object Check if the student defined an object, independent of the name
test_call_result Check the result of a function call/operation
test_call Test whether a student correctly called a function/operator
set_language Specify the language for the automated feedback
test_chunk_options Test whether the student defined the correct chunk options (R Markdown exercises)
override Override the solution code and pd in a state
test_error Check whether the student's submission threw an error.
test_mc Test a multiple choice exercise
test_exercise Run all tests for an exercise
test_library_function Test whether the library function was called correctly
test_expression_result Check the result, output or errors thrown by an expression
test_object Test R object existence and value
test_ggplot Test ggplot call
test_fun_def Check whether the student defined a function correctly
test_control Test if student coded a control statement correctly
test_correct Test things. If it fails, test additional things.
test_rmd_group Test a single R Markdown file group (R Markdown exercises)
test_pipe Test whether a student used the pipe operator sufficiently (ggvis and dplyr exercises)
test_output Check whether the student printed something to the console
test_or Test if one of many test sets pass.
test_predefined_objects Test predefined R objects
test_text Test inline text and formatting (Markdown)
test_props Test whether the student used the correct properties (ggvis exercises)
test_rmd_file Test R Markdown file
test_wd Test whether a file exists
test_yaml_header Test yaml header (Markdown)
testwhat Easily write submission correctness tests for DataCamp
No Results!

Details

Type Package
Date 2014-07-31
URL www.DataCamp.com
License MIT + file LICENSE
LazyData true
RoxygenNote 5.0.1

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/testwhat)](http://www.rdocumentation.org/packages/testwhat)