TestCase | R Documentation |
A test case for Ottr. Contains configurations and code to be executed for the test.
name
The name of the test case
code
The code to be executed as part of the test case
points
The point value of the test case
hidden
Whether the test case is hidden
success_message
A message to show to students if the test passes
failure_message
A message to show to students if the test fails
new()
Create a test case.
TestCase$new( name, code, points = 1, hidden = FALSE, success_message = NA, failure_message = NA )
name
The name of the test case
code
The code to be executed as part of the test case
points
The point value of the test case
hidden
Whether the test case is hidden
success_message
A message to show to students if the test passes
failure_message
A message to show to students if the test fails
run()
Run the test case against the provided environment.
TestCase$run(env)
env
The environment to run the test case in
to_list()
Convert this test case to a JSON-compatible list with all of its fields.
TestCase$to_list()
The list representation of this test case
clone()
The objects of this class are cloneable with this method.
TestCase$clone(deep = FALSE)
deep
Whether to make a deep clone.
tc = TestCase$new("q1", {
testthat::assert_true(q1.ans)
})
env = new.env()
env$q1.ans = TRUE
tc$run(env)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.