CodeLab Question Type: Programming Questions Graded with Tests
Students write a program in the code editor of VS Code. It is run on the teacher's tests on a Jobe server or the CodeLab runner, and the grade is the weighted share of the tests it passes.
Live demo: try the CodeLab plugins on codelab.tsp.edu.rs. Look around as a guest (Python runs in the browser), or use the demo accounts teacher and student (password Demo-2026) to run every language, the debugger and SQL. Everything is reset every night.
What's New in v1.15.0
- Parsons 2: Check order button (with optional partial mark for lines in their place) and fill-in gaps (0 to 10 expressions hidden in solution lines, never in distractors).
- Input files for questions: attach up to 5 input files placed in the working folder before each run (Run, Run tests and grading on CodeLab runner 0.10.0, Jobe and Pyodide), shown read-only to students.
- From 1.14.0: test run times and optional time limit per test on the CodeLab runner, and 15 languages.
- Also since 1.10.0: grading on the CodeLab runner without Jobe, class work and analysis in quizzes, optional AI explanations per question, side-by-side failed test comparison and accessibility improvements.
Core features
- Eight languages and SQL: C, C++, Python, Java, C#, JavaScript, Pascal and PHP, and SQL questions on MySQL (MariaDB) with the CodeLab runner, where the code before holds the tables and a test can check them after an INSERT, UPDATE or DELETE.
- Tests: each test has an input, an expected output, a weight, and can be hidden. Students see only how many hidden tests passed. Empty expected outputs are filled in by running the model solution when the question is saved.
- Hidden code before and after the answer: for example the class and Main around a few statements.
- For the student: the code editor with typing help, Run with their own input, and Run the tests for the tests that are not hidden. With CodeLab for TinyMCE 1.13.3 the editor zooms with Ctrl and the mouse wheel and explains keywords, operators and printf formats in tooltips.
- Safe grading: the grade is computed on the server only. Results are cached, so a review or a regrade does not load the server again. When the server cannot check a program at the final submit, the answer waits for the teacher.
- Check with penalties in Interactive and Adaptive mode, and output compared exactly, without trailing spaces, as numbers with a tolerance, by a regular expression, or as lines in any order for SQL rows.
- Options: time and memory limits, and turning off typing help for tests. A question without tests is graded by the teacher.
- Parsons problems: students put the shuffled lines of the solution in order, with distractor lines; Python lines are indented by the student.
- Backup and restore keep all settings and tests.
The CodeLab plugins
- CodeLab for TinyMCE: inserts examples in the TinyMCE editor. The other two plugins use its editor and runner.
- CodeLab filter: turns examples into code editors that readers can edit and run.
- CodeLab question type (this plugin): programming questions graded with tests on Jobe or the CodeLab runner.
Requirements
- Moodle: 4.5 LTS to 5.3 (PHP as required by your Moodle version).
- tiny_codelab: version 1.22.0 or newer, installed first, with a Jobe server or the CodeLab runner in its settings.
- Hosted runner (optional): a paid plan with a monthly quota of runs, provided by the author, Boban Blagojević. Ask for a connection key at boban.blagojevic@tsp.edu.rs. Nothing requires it: a Jobe server or your own CodeLab runner (open source) grade the questions without it.
Privacy
Answers are stored like any quiz answer. Programs and their input are sent to the server set by the administrator (Jobe or the CodeLab runner, own or hosted) to be compiled and run. The plugin implements the Moodle Privacy API.
Developed by Boban Blagojević. Languages: English, Serbian (Latin and Cyrillic) and 12 more: de, fr, es, it, pt, pl, hr, bs, sl, mk, sk, cs.
Source, documentation and issue tracker:
github.com/blagojevicboban/moodle-qtype_codelab
Licensed under the GNU GPL v3 or later.