CodeRunner Documentation (V3.1.0)

2.4 Preliminary testing of the CodeRunner question type

Preliminary testing of the CodeRunner question type

Once you have installed the CodeRunner question type, you should be able to run CodeRunner questions using the University of Canterbury's Jobe Server as a sandbox. It is recommended that you do this before proceeding to install and configure your own sandbox.

Using the standard Moodle web interface, either as a Moodle administrator or as a teacher in a course you have set up, go to the Question Bank and try creating a new CodeRunner question. A simple Python3 test question is: "Write a function sqr(n) that returns the square of its parameter n.". The introductory quick-start guide in the incomplete Question Authoring Guide gives step-by-step instructions for creating such a question. Alternatively you can just try to create a question using the on-line help in the question authoring form. Test cases for the question might be:


You could check the 'UseAsExample' checkbox on the first two (which results in the student seeing a simple "For example" table) and perhaps make the last case a hidden test case. (It is recommended that all questions have at least one hidden test case to prevent students synthesising code that works just for the known test cases).

Save your new question, then preview it, entering both correct and incorrect answers.

If you want a few more CodeRunner questions to play with, try importing the files MoodleHome>/question/type/coderunner/samples/simpledemoquestions.xml and/or MoodleHome>/question/type/coderunner/samples/python3demoquestions.xml. These contains most of the questions from the two tutorial quizzes on the demo site. If you wish to run the questions in the file python3demoquestions.xml, you will also need to import the file MoodleHome>/question/type/coderunner/samples/uoc_prototypes.xml or you will receive a "Missing prototype" error.