Skip to content
Snippets Groups Projects

Implement script unit testing

1 open thread

Description

Adds an endpoint where scripts and unit test values can be submitted to to verify that a criteria script is valid. This helps prevent crashing assignments at a very early stage. The values are stored inside the assignment, so later edits that would invalidate these tests can be detected too.

Also links metric instance types to metric names so they can be type-checked and the system can generate suitable template scripts and unit tests for assignments.

Requires UI updates to be functional.

Resolves #100 (closed)

Additions

  • Metric names now have an expected (super-)type for instances with that name
  • Creating a new metric type-checks the value, generating a warning (not an error) if there is a mismatch
  • An endpoint where scripts can be tested
  • Testing fixtures to pre-fill tests in the UI with as a quick start and suggestions

Changes

  • IntegerMetric and DoubleMetric are subclasses of the new NumberMetric for metric names that do not care about the floatiness of their values
  • Moved metrics endpoints to a separate controller
  • Deprecated metrics.js

Test and Review

To be filled in by the reviewers

  • All of the methods are commented to expectation

  • The methods are tested to satisfaction

  • There are no unnecessary files present in the MR

  • The continuous integration has no problems with the MR

  • The MR is filled in as requested (including labels, milestones, and reviewers)

  • The documentation is up-to-date

  • All nullable parameters are marked as such

Edited by Ewoud Ruighaver

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
58 final var res = new Response();
59 res.put("metrics", this.messageReceiver.getMetrics());
60 return ResponseEntity.ok(res);
61 }
62
63 /**
64 * Returns the metrics as a {@code metrics} property of the global {@code MetricEditor} object.
65 *
66 * @return the metrics as an object property
67 *
68 * @deprecated originally a hack for the old UI to allow this resource to load in a blocking
69 * fashion, no longer necessary
70 */
71 @GetMapping("/api/v1/worker/metrics.js")
72 @Deprecated
73 public ResponseEntity<String> getMetricsJsAction() {
  • Erik Oudsen approved this merge request

    approved this merge request

  • Ewoud Ruighaver added 15 commits

    added 15 commits

    Compare with previous version

  • Ewoud Ruighaver approved this merge request

    approved this merge request

  • Ewoud Ruighaver marked the checklist item The continuous integration has no problems with the MR as completed

    marked the checklist item The continuous integration has no problems with the MR as completed

  • Ewoud Ruighaver marked the checklist item There are no unnecessary files present in the MR as completed

    marked the checklist item There are no unnecessary files present in the MR as completed

  • Erik Oudsen approved this merge request

    approved this merge request

  • Ewoud Ruighaver mentioned in commit 7fdc1a02

    mentioned in commit 7fdc1a02

  • mentioned in issue #72 (closed)

  • unassigned @leverse

  • Please register or sign in to reply
    Loading