CodeHS runs student programs through a series of Test Cases to ensure that their code is functionally and stylistically sound, and accomplishes the goals of a given exercise.
How It Works:
When a student hits the ‘Submit Code’ button, the Test Cases are run, and if any fail, the student is prevented from submitting their code for grading.
Students and teachers can see these Test Cases when they visit the "Test Cases" tab in the top right corner of any exercise page, or when they click "Submit + Continue" upon completing an exercise.
**Important Note: Test Cases are not designed to catch all errors/issues all of the time. We think about Test Cases like Spell Check. Spell Check ensures that the basic spelling and sentence mechanics are correct, but simply because something passes Spell Check doesn't mean that the entire essay is logically sound.
In the same way, Test Cases are meant to be a first line of checks to point students in the right direction, but often teachers will want to grade student programs themselves to ensure they are functionally and stylistically correct.
Creating Your Own Test Cases:
With CodeHS Create, you can define your own Test Cases for an assignment you create for your students. These Test Cases 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, whether that is a graphics canvas, a string or a webpage.