Create a coding assignment from a Git repository, with hidden tests
A good programming exercise is usually a small project: starter code, a few helper files, a package file, and a folder of tests. If you already keep yours in Git, there is no need to copy it into the browser file by file. Load the repository into a task, say which files are tests students must not see, and hand it out.
This works with the Git server that comes with the platform, for staff and students of a college. Any coding task can be loaded this way, including one a student will clone and push to, which has a page of its own.
Load a task from a repository
In the task’s editor press Load from Git, choose a repository you can read and a branch, or type a tag or a commit, and press Preview. The preview lists every file that would be loaded, which file the program runs from, and every file that would be left out and why: not text, too large, or a name that cannot be used. Nothing changes until you press Load.
Loading copies the files once, folders and package file included. After that the task is like any other: edit it in the browser as usual, and the repository is not changed. The same limits apply as for any project, 50 files of up to 64 KB each.
- Open the task in its editor. Press Load from Git among the tools above the code.
- Choose the repository and the branch. Only repositories you can read are listed. A tag or a commit works as well.
- List the hidden and protected paths. One a line: a folder like tests/, a name like test_*.py, or a path.
- Preview, then Load. Check what will be loaded and what will be left out before anything changes.
- Hand it out. Each student gets their own copy, without the hidden files.
Hidden test files, and files students cannot change
In the same dialog, list the paths students should never see, such as tests/ or test_*.py, and the paths they may see but not change the answer with. Hidden files are never handed out, and never put in a student’s repository.
Whenever a student’s work is tested or marked, your hidden and protected files are put back from the task first, so editing a test in their own copy changes nothing that counts. For Python, Java, Go and JavaScript on Node, hidden test files are run by the language’s own test runner, pytest, JUnit, go test or Node’s, beside the task’s Tests tab.
The lists are not only for tasks from Git: a task you typed in the browser can have hidden and protected paths too.
Updating the task from a later commit
The task remembers which commit it came from. Update from Git loads a later one and replaces what was edited in the browser since. Students who already have the task keep their own copies, so a fix to the starter code reaches whoever is handed it next.
Questions people ask
- Can I load a task from GitHub?
- From the platform’s own Git server. To use a project that is on GitHub, push it to a repository on our Git server first, which is one git remote add and one git push.
- Do students see my repository?
- No. They get their own copy of the task, without the hidden files. If you let them clone the task, each gets a new repository made from their own copy, never yours.
- Can a student change the tests they are marked with?
- No. Hidden test files are never given to them, and whenever their work is tested or marked your hidden and protected files are put back from the task.