Autograding Model
Java library that autogrades projects based on a configurable set of metrics. Currently, you can select from the following metrics:
-
Test statistics (e.g., number of failed tests)
-
Code coverage (e.g., line coverage percentage)
-
PIT mutation coverage (e.g., missed mutations' percentage)
-
Static analysis (e.g., number of warnings)
For each metric you can define the impact on the overall score, and the individual scoring criteria using a JSON configuration:
{
"analysis": {
"maxScore": 100,
"errorImpact": -5,
"highImpact": -2,
"normalImpact": -1,
"lowImpact": -1
},
"tests": {
"maxScore": 100,
"passedImpact": 0,
"failureImpact": -5,
"skippedImpact": -1
},
"coverage": {
"maxScore": 100,
"coveredPercentageImpact": 0,
"missedPercentageImpact": -1
},
"pit": {
"maxScore": 100,
"detectedImpact": 0,
"undetectedImpact": -1,
"detectedPercentageImpact": 0,
"undetectedPercentageImpact": 0
}
}
Creating an aggregated score takes just a few steps:
String configuration = "{\"analysis\": { \"maxScore\": 100, \"errorImpact\": -5}}";
AggregatedScore score = new AggregatedScore(configuration);
score.addAnalysisScores(new JenkinsAnalysisSupplier(run));
score.addTestScores(new JenkinsTestSupplier(run));
score.addCoverageScores(new JenkinsCoverageSupplier(run));
score.addPitScores(new JenkinsPitSupplier(run));
The actual grading results are then available as properties on the AggregatedScore
instance.
For each of the 4 supported grading result types you need to implement a supplier implementation that provides the corresponding details of the project. Please have a look at the Jenkins plugin to see an example implementation of these suppliers.