CodeRunner

Question types ::: qtype_coderunner
Maintained by Richard Lobb, TimTim Hunt
A question type that allows question authors to set programming questions in which the student answer is code in some programming language, which is graded by running it. More generally it can handle any question to which the answer is text that can be graded by a computer program written by the question author.

CodeRunner 5.8.0

Moodle 4.3, 4.4, 4.5, 5.0, 5.1
Released: Wednesday, 7 January 2026, 5:15 AM

CodeRunner

Version: 5.8.0 October 31, 2025. Requires MOODLE V4.3 or later + PHP >=8.1. Earlier versions of Moodle must use CodeRunner V4.

CodeRunner is a Moodle question type that allows teachers to run a program in order to grade a student's answer. By far the most common use of CodeRunner is in programming courses where students are asked to write program code to some specification and that code is then graded by running it in a series of tests. CodeRunner questions have also been used in other areas of computer science and engineering to grade questions in which a program must be used to assess correctness.

Authors: Richard Lobb, University of Canterbury, New Zealand. Paul McKeown, University of Canterbury, New Zealand. Tim Hunt, The Open University, UK.

For full documentation, see https://trampgeek.github.io/moodle-qtype_coderunner/

NOTE: A few sample quizzes containing example CodeRunner questions are available at coderunner.org.nz. There's also a forum there, where you can post CodeRunner questions, such as requests for help if things go wrong, or are looking for ideas on how to write some unusual question type.

Changes since V5.7.2+

  • New question browser script moodlehome/question/type/coderunner/questionbrowserindex.php allows easy browsing of all CodeRunner questions in a given course or context, including text or regex search on any of the question fields and instant display of question text, answer and quiz usage.
  • Add a QUIZ variable to the Twig context with fields QUIZ.name and QUIZ.tags. Allows customising the behaviour of CodeRunner questions according to the quiz in which they're running.
  • Extend TwigAll to include penalty regime.
  • Improve resilience of combinator template grader code to bad responses from author's template.
  • Improvements to test suite (issues #266, #267 and #276)
  • Bug fix: when using equality grader, trailing space characters were correctly being removed from all lines but the spec said all whitespace characters were being removed. That wasn't true - characters like tabs and return characters weren't removed
  • Move document to mkdocs format with much improved browsing at https://trampgeek.github.io/moodle-qtype_coderunner/
  • Various code tweaks and polishing.

Version information

Version build number
2025101200
Version release name
5.8.0
Maturity
Stable version
MD5 Sum
42665ed0320ebf31bdcfd05d75da5c1b
Supported software
Moodle 4.3, Moodle 4.4, Moodle 4.5, Moodle 5.0, Moodle 5.1
  • Latest release for Moodle 4.3
  • Latest release for Moodle 4.4
  • Latest release for Moodle 4.5
  • Latest release for Moodle 5.0
  • Latest release for Moodle 5.1

Version control information

Version control system (VCS)
GIT
VCS repository URL
VCS tag
v5.8.0

Default installation instructions for plugins of the type Question types

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder (eg "myquestiontype") in the "question/type" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation