TestCaseResult: An R6 representing the results of running a test case

TestCaseResultR Documentation

An R6 representing the results of running a test case

Description

Represents the results of running a test case against a global environment. Contains metadata about the passing/failing of the test case as well as a reference to the test case itself.

Public fields

passed

Whether the test passed

error

An error raised by executing the test, if any

test_case

The TestCase that this result tracks

Methods

Public methods


Method new()

Create a test case result.

Usage
TestCaseResult$new(passed, error, test_case)
Arguments
passed

Whether the test passed

error

An error raised by executing the test, if any

test_case

The TestCase that this result tracks


Method get_score()

Get the score earned for this test case, accounting for whether the test passed or failed.

Usage
TestCaseResult$get_score()
Returns

The score


Method repr()

Convert this result into a human-readable string for display.

Usage
TestCaseResult$repr()
Returns

The string representation of this result


Method to_list()

Convert this result to a JSON-compatible list with all of its fields.

Usage
TestCaseResult$to_list()
Returns

The list representation of this result


Method get_message()

Get the message to be displayed to the student based on whether the test case passed or failed, if any.

Usage
TestCaseResult$get_message()
Returns

The message or NA


Method clone()

The objects of this class are cloneable with this method.

Usage
TestCaseResult$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


ucbds-infra/ottr documentation built on Feb. 24, 2024, 2:31 a.m.