Computing teachers: how to auto-grade programming assignments
The PEEMS team · Published November 10, 2026 · 5 min read

Automatic grading runs a student's program against a set of test cases and compares the results. This article explains how it works, its benefits, how to write good tests and what still needs the teacher.
Marking programming homework by hand takes effort. In a class of 30, each student submits a program, and the teacher has to run each one, try several inputs, compare results and write feedback. With several classes and many tasks, marking can take longer than planning lessons. Automatic grading exists to take the repetitive part off your plate. This post explains the principle and how to write test cases; for the steps of assigning work and viewing results on PEEMS, read Assigning coding homework with auto-grading: a teacher's workflow.
How does automatic grading work?
The idea is simple: run the student's program on several sample inputs and compare the output with the correct answers. Each such input is a test case, made of:
- Input: the data given to the program (for example, a list of numbers).
- Expected output: the correct result the program must print.
After a student submits, the system runs the program on each test case, compares the actual output with the expected output and reports which tests passed and which did not. The score is often based on the share of tests passed.
After a student submits, they see a score and which tests passed or failed.
A small example
Suppose the task is: "read a list of numbers and print how many are even." A teacher might prepare four tests: a typical list such as 2, 3, 4; a list with no even numbers; a list containing only 0; and an empty list. For the input [0], the expected count is 1. A solution that counts only positive even numbers returns 0 and fails exactly this test. The failing test points straight at the problem, and the student can fix it without waiting for the next lesson. That is the real value of a well-chosen test: it tells the student where to look, not just that something is wrong.
Why do many teachers choose automatic grading?
- It saves time. Running programs and comparing results is done by the machine, leaving you time for feedback that matters more.
- It is fair and consistent. Every submission faces the same tests, whether marked early or late, tired or fresh.
- Students get quick feedback. They submit and see results immediately, fixing errors while their thinking is fresh. For many learners, "try, see which test fails, fix, resubmit" is where most learning happens.
- You get class-wide data. Seeing which question many students missed tells you what to re-teach.
What makes a good test set?
Quality depends heavily on the tests. A good set usually has:
- Typical cases: a few standard examples to check the common situations.
- Edge cases: an empty list, one item, zero, negative numbers, the largest value; places where programs often break.
- Bug-revealing cases: inputs that expose plausible but incorrect solutions; a correct solution should pass them.
- A sensible number: too many are hard to check, too few miss bugs.
A tip: before assigning, submit a correct solution and a few common wrong ones yourself to see whether the tests tell them apart.
What about younger students?
Test-case grading fits best when students write text code such as Python. For younger learners using picture or block coding, feedback usually comes from the level itself: does the character reach the goal? In Pemi CS, levels already show students the result as they run their programs. Test-case grading belongs to Pemi Code, our coding tool with block, Python and web editors, which is coming soon.
Limits to know about
Automatic grading is useful, but not everything:
- It cannot judge style, variable names or readability (unless you add criteria and check by hand).
- It only knows pass or fail. A student may slip on a small step but understand the main idea; that needs a teacher's reading and comments.
- It does not replace encouragement. A short note such as "the way you split the problem was very clear" means more to a student than any number.
- Watch for "coding to the tests". With too few tests, a student can adjust a program to pass them without understanding. Add more tests or ask students to explain.
Whichever tool you use, it helps to tell students in advance what the tests will look at. When learners know that the aim is a program that works for every case, not just the example in the task, they tend to test their own work more carefully before submitting, and the feedback they get afterwards feels fair rather than mysterious.
A sensible approach is to let the machine do the repetitive checking while you read representative submissions, give feedback and guide individuals.
A suggested workflow
- Set the task with a clear description and a few examples.
- Prepare tests (typical, edge, bug-revealing) and try them first.
- Let students submit, fix and (if the task allows it) resubmit within a time window.
- Review class results and choose a few submissions for detailed feedback.
- Re-teach whatever many students found tricky.
The platform steps are covered separately in Assigning coding homework with auto-grading: a teacher's workflow.
Frequently asked questions
What is a test case? A pair of input data and the correct expected result. The system runs the student's program on the input and compares the result with the answer.
Can automatic grading replace a teacher? No. It reduces repetitive work. Feedback on thinking and style, and encouragement, remain the teacher's role.
Can students resubmit? Resubmission and any limit on attempts depend on the task and the configuration supported. Please contact the PEEMS team to confirm what applies to your class. In general, allowing resubmission helps students learn from errors.
Does PEEMS replace teaching at school? No. PEEMS is a supplementary program and a tool to support computing lessons, saving teachers time on repetitive work.
Want to see it in action?
If you would like to see grading and class tracking on the PEEMS platform, please get in touch:
- Email: [email protected]
The PEEMS team



