In Scala, a custom test reporter can be used in a TestSpec. Usage: at the top of the TestSpec, create a comment such as:

//test: MyTestSuite (MyTestReporter)

This will execute the MyTestSuite and use MyTestReporter to report about the results. (This is an extension of the old behavior where //test: MyTestSuite could indicate the test suite.) Now, to create a test reporter, make a class that extends the WeblabSuiteReporter class from Labback. For example:

class MyTestReporter extends WeblabSuiteReporter {
  override def apply(ev: Event): Unit = {
    totalPoints = 100
    deductedPoints = 80
    failureDetails = List("You get only 2/10 score.")

The field totalPoints is the total number of points reported, and deductedPoints is the number of points deducted (so in this example the student gets only 20/100). The failureDetails field is a list of strings that are reported back to the student, each string on a new line.

Submitted by D. Pelsmaeker on 18 February 2019 at 16:11

On 18 February 2019 at 16:11 D. Pelsmaeker tagged 47.30

On 18 February 2019 at 16:12 D. Pelsmaeker closed this issue.

Log in to post comments