Class Graja
Graja - Grader for java programs.

Graja website: http://graja.hs-hannover.de
Example assignment
We illustrate an example assignment. The assignment text is as follows.
Write a class
Fraction
in the anonymous package with the following methods
- Constructor with numerator and denominator as parameters
- Getters
getNumerator
andgetDenominator
- A method
getValue
returning the value as double value.Your class should reject illegal parameter values.
For this assigment we define several grading aspects that are grouped into categories. Every aspect gets graded by a (source-)module
Category | Aspect | Source | Result | Achieved | Max. |
---|---|---|---|---|---|
Syntactical correctness | Should successfully compile | Compile | 5.00 | 5.00 | |
5.00 | 5.00 | ||||
Functional correctness | Should have constructor and simple getters | JUnit | 5.00 | 5.00 | |
Should return value as double | JUnit | 5.00 | 5.00 | ||
10.00 | 10.00 | ||||
Maintainability | Attributes in class Fraction should be private | JUnit | 5.00 | 5.00 | |
Variable naming conventions | PMD | 2.00 | 2.00 | ||
Method naming conventions | PMD | 2.00 | 2.00 | ||
Class naming conventions | PMD | 2.00 | 2.00 | ||
Fields (attributes) should be at the start of the class | PMD | 2.00 | 2.00 | ||
Comments needed in front of methods and classes | PMD | 2.00 | 2.00 | ||
Readability | Non-automated activity | delayed | 0.00 | 5.00 | |
15.00 | 20.00 | ||||
Security | Non-private attributes in class Fraction are a security hole | JUnit | 10.00 | 10.00 | |
10.00 | 10.00 | ||||
Reliability | Should reject illegal denominator | JUnit | wrong | 0.00 | 5.00 |
0.00 | 5.00 | ||||
Total scores | 40.00 | 50.00 |
This assignment can be found in the SampleGrajaAssignments project as the assignment dom.fraction . It serves the purpose of demonstrating usage of many categories crossing several modules.
Overview
A request consists of assignments. An Assignment
is graded in certain categories
(functional correctness, maintainability, ...). Each category is subdivided into one or more grading aspects
.
Graja grades a category by calling one or several
modules
. Modules in Graja each consist of a runner and an evaluator. Currently there
are four modules in Graja: Compile, JUnit, PMD and Human grading.
In the Graja core, modules are somewhat orthogonal to grading aspects. In the above example assignment
the modules are represented as the "Source" column. As we can see, in this example the JUnit module contributes
to four categories and many aspects. The JUnit module is run only once via a JunitModuleRunner
.
A module runner
gets module specific configuration data as a ModuleConfiguration
object. The module configuration does not contain scores or aspect titles. It only has technical
configuration data like grader class names and test method names. A module runner produces a
ModuleRunnerResult
. All modules at least
produce some comments as part of the module runner result. Specific information can be contained in a result
depending on the module. E. g. JUnit produces information about the success or failure of
every single test method that has been run by the JUnit module. The module runner result
in the next step serves as input to the ModuleEvaluator
.
A module evaluator takes the module runner result and creates a single result object
for every grading aspect. All aspect results are collected in an AssignmentResult
object.
The central processing unit is the class Core
A UML model is shown in the following pictures:

Request domain model

An assignment is part of a Request
.
ModuleRunner and ModuleEvaluator
ModuleRunner and ModuleEvaluator are parts of a Module. A ModuleRunner creates a ModuleRunnerResult, which in turn is input for a ModuleEvaluator. In the following image we illustrate the subclasses for the JUnit module:

Result domain model

An assignment result is part of a
Result
object.
-
Constructor Summary
ConstructorsConstructorDescriptionGraja()
This is currently a dummy class just to hold developer documentation. -
Method Summary
-
Constructor Details
-
Graja
public Graja()This is currently a dummy class just to hold developer documentation.
-