Assignment submissions : JUnit Exercise Corrector

assignsubmission_mojec
Maintained by Picture of Gero Lückemeyer Gero Lückemeyer
This plugin allows students to submit their Java exercises, let them be tested against a set of JUnit tests (that have been priorly provided by the teacher) and receive immediate feedback on the test results.
2 sites
14 downloads
1 fans

Moodle JUnit Exercise Corrector (MoJEC) Plugin

A Moodle plugin to assist teachers correcting JUnit exercises.

This plugin allows students to submit their Java exercises, let them be tested against a set of JUnit tests (that have been priorly provided by the teacher) and receive immediate feedback on the test results.

For this to work, the plugin communicates with an external webservice providing essentially the following services on the given paths:

  • POST /v1/unittest: Expects the assignment id and a zip file containing the unit test files as http post parameters.
  • POST /v1/tasks: Expects the assignment id and a zip file containing the java files that should be tested as http post parameters. Extracts the zip file, compiles the java files and runs the tests (provided via /v1/unittest). Returns the results in form of JSON.
  • DELETE /v1/unittest?assignmentId={id}: Triggers the deletion of the test files.

See here for an implementation of the webservice: MoJEC Backend

Installation/Configuration

Usage (Teacher)

  • Create an Assignment
  • In the Assignment settings: Scroll to the section Submission types and check the type JUnit Exercise Corrector
  • Once JUnit Exercise Corrector is checked, upload a single ZIP file containing your JUnit tests in the corresponding JUnit test file upload environment.
  • View aggregated test results in the grading table column JUnit Exercise Corrector
  • View detailed results of a particular submission by clicking the magnifyer icon in the respective cell of the JUnit Exercise Corrector column of the grading table
  • Download all MoJEC submissions by selecting the Grading Action Download all submissions

Usage (Student)

  • Navigate to the assignment
  • Press Add Submission respectively Edit Submission
  • Upload a single ZIP file containing the Java files to be tested and click Save changes
  • View your test results in the JUnit Exercise Corrector row of the submission status table.


Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5

Contributors

Picture of Gero Lückemeyer
Gero Lückemeyer (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Plugins bot
    Fri, 20 Jan 2017, 10:10 PM
    Approval issue created: CONTRIB-6699
  • Picture of Doug Loomer
    Mon, 5 Jun 2017, 3:10 AM
    This seems like a really interesting and helpful plugin, and I would very much like to install it on my Moodle site, but I haven't a clue how to set up the mojec-backend. I have visited the two mojec related links you provided, and I know they have everything I need, but I don't understand what to do with them. Am I supposed to pull the git file to some location on my server. It is a linux server, so I should be able to install it. Can you provide some instructions about how to install the mojec-backend please?
  • Picture of Doug Loomer
    Wed, 7 Jun 2017, 4:12 PM
    So, I now have a docker service for mojec running (I found this video helpful in understanding the basics of docker ) and I am attempting to create an assignment. However, when I upload my zip file of junit tests and try to save the assignment I get an unexpected error occurred message. I assume it doesn't like my junit test file. Would you be able to post any exemplars of the type of junit test this expects?
  • Picture of Doug Loomer
    Wed, 7 Jun 2017, 4:18 PM
    So I did some background learning about docker and now have a mojec back-end docker service running, and have the url for it pointed to in my junit assignment plugin. However, I can't get an assignment to work. When I upload my junit test zip file in the assignment setup I get an unexpected error message. I suspect the assignment is not liking something about the format of my junit zip file. Do you have any exemplars of junit zip files that you could post?
  • Picture of Marcel Bochtler
    Wed, 12 Jul 2017, 3:39 PM
    Hello Doug,
    you can find example unit tests and example files-to-test at: https://github.com/HFTSoftwareProject/MoJEC/tree/master/exampleData

    I just tested it with those files and the docker container from: https://hub.docker.com/r/hftstuttgart/mojec-backend/
    I pulled this docker container with:
    docker pull hftstuttgart/mojec-backend
    and start it with:
    docker run -p 8080:8080 -d --name mojec-backend hftstuttgart/mojec-backend:latest

    Then it should be available on port 8080.

    You should also be aware of this issue: https://github.com/HFTSoftwareProject/MoJEC-Backend/issues/6
    Which means you are not allowed to organize the unit tests within a package structure. You need to use the "default" package. The files-to-test can be put into packages.
    But this shouldn't cause a problem when uploading the test files but when running the tests i.e. when uploading tasks.
  • My Hero
    Sun, 19 Nov 2017, 11:55 PM
    Any chance this works on 3.2-3.4?
  • Picture of José María Guerrero Romero
    Sat, 12 May 2018, 5:34 AM
    It works on Moodle 3.4
Please login to post comments