This is an advanced guide to creating an autograder for a Python Coding Exercise on the CodeHS platform, detailing how to program an autograder and the what tests are available. It is intended for those with some prior experience working with autograders.
<aside>
❓ Looking for autograders specific to Python with Turtle Graphics? Check out our Turtle Graphics Autograder Guide here:
</aside>
This is what you see when you first add an autograder to a program. It already contains examples of how to write tests:
before_run
and after_run
All parameters of these functions are Strings (other than self
, which is the calling object)
student_code
is the text of the student’s program
solution_code
is the text of the solution program
student_output
is the text of the student’s output given the input (if there is any)
VERY IMPORTANT: this does not contain any text that was printed using input
such as ex = input(”Enter your name”)
solution_output
is the text of the solution program’s output given the input (if there is any)
Test cases will be added to one of two places within a Suite
- in the before_run
function or the after_run
function.