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

Best Paid Autograders for University Programming Courses (2026)

A side-by-side comparison of the best paid autograders for university programming courses in 2026 — CodeGrade, Gradescope, Codio, and Vocareum — covering pricing, features, and LMS integration.

Best Autograders for University Programming Courses You Can Start Using for Free (2026)

A practical comparison of six free autograders for university programming courses in 2026 — including CodeGrade, GitHub Classroom, Gradescope, Autograder.io, Otter Grader, and nbgrader.

How to Grade Code Quality, Not Just Correctness

Learn how to automate code quality checks in CodeGrade using Flake8, Checkstyle, Semgrep, and clang-tidy — no manual review or custom YAML required.

Sign up to our newsletter