Autograding scripts for Wellesley's CS111 (Introductory CS) course. The program evaluates student Python code on a suite of test cases, and generates HTML outputs with error hints, as well as json logs. It supports grading for a variety of functions, including those with print statements and some support for graphics.
Currently in active development. The codebase is adapted from the Berkeley AI autograder.
Clone this repo and pull for latest changes before starting work.
-
Create a new directory for the problem set somewhere on your machine. Let's refer to it as
/path/to/ps0x
-
Copy
otterInspect.py
,testCaseReader.py
,casefile_creator.txt
,honorcode.py
andinspector/
to this new directory:
$ cp otterInspect.py /path/to/ps0x $ cp honorcode.py /path/to/ps0x $ cp testCaseReader.py /path/to/ps0x $ cp casefile_creator.txt /path/to/ps0x $ cp -R inspector /path/to/ps0x ```
-
Change to the the problem set directory
$ cd /path/to/ps0x/ ```
-
Delete the sample
inspector/test_cases
andinspector/pickled
contents (but leave the directories).
$ rm -r inspector/test_cases/* inspector/picked/* ```
-
Edit
casefile_creator.txt
with your desired test cases, descriptions, and grade weights. For complex arguments or results, create a pickle file with a.pickle
extension, drop it in thepickled/
directory, and put the filename incasefile_creator.txt
. If you pickle arguments, the entire argument list should be pickled as a tuple.-
Note that for functions with print side-effects, you must create an object of type
ReturnPrint
(defined ininspector/testClasses.py
), pickle it, and set the "print" column incasefile_creator.txt
to True. -
For functions with randomness, set the seed to 0 before you generate your test cases.
-
-
Run
testCaseReader.py
$ python testCaseReader.py
This populates the
inspector/test_cases
directory with files readable by the otterInspect. -
You can now delete
testCaseReader.py
andcasefile_creator.txt
since the students don't need these. -
Edit
inspector/urls.txt
where each line has a task id (like "task1") and the URL to the problem set description of the task. -
Edit the first few lines of the
main
function inotterInspect.py
by specifying the filenames for the student code, project name, and due date. -
Place the solution files for the problem set, and all supporting files in your
/path/to/ps0x
directory. Test that runningpython otterInspect.py
works as expected.
-
Delete all
*.pyc
files and the files generated by your testing runs of otterInspect:
$ rm *.pyc $ rm your_result.html $ rm -r .logs ```
- Scrub the solutions to create skeleton files. Voila! The problem set is ready for release.