CodeHS allows teachers to create customized autograders to help grade student work. Most CodeHS coding exercises come with their own pre-written autograder to help guide students and teachers through the curriculum. Read more to find out how autograders work!

In this guide:

What is an Autograder?

Unit Test Test Cases

Language Specific Autograder Guides

Webinar on Creating Autograders

Creating an Autograder

Karel Autograders

What is an autograder? How does it work with CodeHS?

An autograder is a test which runs on a student program to determine whether or not it can be submitted. When a student hits the Submit Code button, the autograder will run, and if any of the autograder's tests fail, then the student will be prompted to fix their code before submitting. (If an assignment doesn't have an autograder, the code will simply be submitted as is.)

An autograder with the right error messages can also help the student figure out what is wrong or missing in their code! Students can see if their code passes all the requirements of an autograder by hitting the Check Code Button.

An autograder can check for output, as well as if the student used the correct style and/or control structures in their code.

Unit Test Test Cases - Similar but Different

Test Cases work a little differently than autograders. These are used with Unit Test assignments, where the student is usually asked to write a specific function or small unit of code.

Each Test Case has an input and an expected output. When the student hits Check Code, the Test Case inputs the value into the student code and compares it to the expected output. If the output does not match what is expected, the student will be asked to fix their code before submitting.

Autograders are Language Specific

With CodeHS Create, you can define your own autograders for any custom exercise that you create. These autograders are different for every language. In each case, you’ll be able to test the content of the student’s code as well as the result that their code produces.

Language Specific Guides for Autograders:

Programming Python Autograders

Programming Java Autograders

Programming with JavaScript Autograders

Webinar - More Information on Creating Autograders:

Watch our webinar on creating autograders!

Creating An Autograder

First, you will need to access the Advanced Settings. To do this, navigate to your Create page:

  • Click "..." Edit next to the assignment, and choose Advanced Settings

  • If the assignment is in a Playlist, you can click "..." next to the Playlist name and choose Legacy Edit. The assignments in the Playlist will appear on the left hand side and you can choose the problem you would like to edit.

From here:

  1. Navigate to the Autograders tab. (Note: Only coding assignments of the relevant type will have the Autograder tab)

  2. Click Add Autograder. 

  3. Write your code to create your Autograder.

Each language has its own way of creating and defining autograders with code. When you initialize the Autograder, you will be brought to a code editor with documentation for your chosen language. Read the documentation carefully, and enjoy the ability to ensure that the code you need to grade is of a high quality!

Karel Autograders

For more information, check out Autograders.  

Still have questions? Contact our team at hello@codehs.com to learn more!

Did this answer your question?