JUnit

Stage for Test Case-based testing via JUnit.

  • Kind: Grading Stage

  • Behavior: Compiles and runs test cases written with JUnit framework.

Config

jUnit:
  srcInput: [PathSpec]      # list of files containing the program source code
  testInput: [PathSpec]     # list of files containing the JUnit test cases
  compileArgs: [String]?    # compilation arguments for the program source code [default: []]
  runArgs: [String]?        # runtime arguments for the JUnit Platform Runner [default: []]
  version: String?          # JUnit library version to use [default: "1.6.1"]
  score: Double?                      # Total Score of this stage
  treatDenormalScore: DenormalPolicy? # Policy to use when resulting score is NaN
  scoreWeighting: ScoreWeighting?     # Weighting policy of this stage
  • See JUnit.md for information regarding PathSpec

  • This stage implements Total-Based Scorable and Weighted Scorable.

    • The scorable policies are mutually exclusive; Enabling both is an error.

    • See Scorable.md for more information on score, treatDenormalScore, and scoreWeighting.

    • See XUnit.md for more information on the predicates available for scoreWeighting.

  • The legacy usage of String-based input and compileDir is now UNSUPPORTED

    • Users should migrate to using the PathSpec-based input key instead

Example

jUnit:
  srcInput: 
    - file: "src/*.java"
  testInput: 
    - file: "test/*.java"
  compileArgs: []
  runArgs: []
  version: "1.6.1"

Report

See XUnit report.

Notes

This stage uses JUnit Platform Runner to compile and run the test suite. As such, this stage supports JUnit 5 test cases as well as a subset of JUnit 4 test cases. You are recommended to check with the documentation to ensure that your test suite is supported by this stage.