Skip to content

Repository files navigation

jagr logo

Java AutoGrader, Implemented in Kotlin

A tool used to grade Java programs. It is designed to accept graders and submissions created with the jagr-gradle plugin.

Setup

This project's compiled, source and javadoc jars are hosted on sonatype.

Releases are available from mavenCentral() and snapshots from the maven repository maven("https://s01.oss.sonatype.org/content/repositories/snapshots/").

Follow this guide to set up your gradle buildscript.

Usage

Create a basic Criterion:

publicstaticfinalCriterionH1_1 = Criterion.builder()
.shortDescription("Some short description")
.maxPoints(3) // default maxPoints is 1
.minPoints(-1) // default minPoints is 0
.grader(Grader.testAwareBuilder()
.requirePass(JUnitTestRef.ofMethod(() -> Tests.class.getMethod("testPositiveInts")))
.requirePass(JUnitTestRef.ofMethod(() -> Tests.class.getMethod("testNegativeInts")))
.pointsPassedMax() // award maximum points if ALL tests passed
.pointsFailedMin() // award minimum points if ANY test failed
.build())
.build();

Make sure your JUnit test classes are annotated as follows, or they will not run:

@TestForSubmissionpublicclassTest {

A Criterion may be nested as follows:

publicstaticfinalCriterionH1_1 = Criterion.builder()./*hidden*/.build();
publicstaticfinalCriterionH1_2 = Criterion.builder()./*hidden*/.build();
publicstaticfinalCriterionH1 = Criterion.builder()
.shortDescription("I have two child criteria!")
.addChildCriteria(H1_1, H1_2) // maxPoints, minPoints and grading is inferred from child criteria
.build();

Finally, create a Rubric and implement RubricProvider:

publicclassH03_RubricProviderimplementsRubricProvider {
publicstaticfinalCriterionH1_1 = Criterion.builder()./*hidden*/.build();
publicstaticfinalCriterionH1_2 = Criterion.builder()./*hidden*/.build();
publicstaticfinalCriterionH1 = Criterion.builder()./*hidden*/.build();
publicstaticfinalRubricRUBRIC = Rubric.builder()
.title("My example rubric")
.addChildCriteria(H1)
.build();
@OverridepublicRubricgetRubric() {
returnRUBRIC;
}
}

Running Jagr

To run Jagr, download the desired compiled release of Jagr from releases and place it in a (preferably empty) directory of your choice.

Then either run the following command in a terminal of your choice (or write a batch/bash script that you can execute):

java -jar Jagr-VERSION.jar

Alternatively, you may run Jagr in-IDE via the Gradle runShadow task (the standard run task does not work).

The working directory used is build/run.

The following directories should have been created:

./graders // input folder for grader jars (tests and rubric providers)
./libs // for libraries that are required on each submission's classpath
./logs // saved log files
./rubrics // the output folder for graded rubrics
./submissions // input folder for submissions
./submissions-export // output folder for submissions

Place your grader jar(s) (tests and rubric providers) in ./graders and the submission(s) you want to test in ./submissions and rerun Jagr.

About

Java AutoGrader, Implemented in Kotlin

Topics

Resources

Stars

30 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages