CodeGrade AutoTest setup for grading Java doubly linked list assignments.
January 13, 2025

How to automatically grade Java

In 30 seconds...

Explore how to set up autograding for Java assignments, including tests for functionality, code quality, and style, with instant feedback for students.

Autograding can help both students and instructors focus on what truly matters: learning and teaching. In this blog post, we’ll walk you through an example Java assignment—building a doubly linked list—and show you how to configure CodeGrade to automatically grade your students’ submissions.

Overview of the Assignment

In this example assignment, students will develop a doubly linked list in Java, focusing on both functionality and code quality. The core requirements include:

  1. Core List Operations
    • Checking if the list is empty
    • Adding elements to the beginning or the end
    • Swapping nodes
  2. Sorting Functionality
    • Implementing a basic sorting algorithm (e.g., Bubble Sort) to arrange elements in ascending order.
  3. Main Method
    • Accept user input to populate the list
    • Display both the original and sorted versions of the list

This assignment is evaluated via a detailed multi-faceted rubric that checks whether the code:

  • Compiles and runs without errors
  • Produces correct results for given inputs (through I/O tests)
  • Is well-structured and organized
  • Passes unit tests at the component level (using JUnit5)
  • Adheres to established coding standards for readability and maintainability

Why Autograding?

By using CodeGrade’s powerful AutoTest feature, your students receive immediate, actionable feedback on their code. This helps them learn faster through trial and error and alleviates your workload by automating many of the repetitive manual checks.

Step 1: Design Your Rubric

Before adding any tests, create a rubric in CodeGrade. This rubric:

  • Guides students on your exact grading criteria
  • Standardizes and streamlines the grading process
  • Allows you to attach point values to specific tests (e.g., compilation, I/O outputs, code style, etc.)

Step 2: Create Automatic Tests

CodeGrade supports various types of automatic tests. In this tutorial, we will set up:

  1. Compile Tests
  2. Input/Output (I/O) Tests
  3. Code Structure Tests (using Semgrep)
  4. JUnit5 Tests
  5. Code Style Checks (using Checkstyle)

Setting Up the Environment

  1. Go to the Setup tab and add an Install Java block.
  2. Choose the latest version of Java from the drop-down menu.

Once your setup is ready, go to the Tests tab to configure each type of test.

Teaching Java? Do it efficiently.

Continue reading

Exam Heartbeat: Live Monitoring for Proctored Coding Exams

Exam Heartbeat detects when students leave the exam window mid-session. Live monitoring for proctored coding exams, no extra setup.

CodeGrade vs CodeRunner: A Moodle Plugin vs a Full Autograding Platform

GitHub Classroom updates have slowed and GitHub now points instructors to Codio. Here's what has actually changed in 2026, what professors are reporting, and what it means for your fall planning.

What's happening with GitHub Classroom?

GitHub Classroom updates have slowed and GitHub now points instructors to Codio. Here's what has actually changed in 2026, what professors are reporting, and what it means for your fall planning.

Sign up to our newsletter