You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 14, 2024. It is now read-only.
This utility aims to provide a simple, yet secure and highly configurable way to autograde programming assignments.
2
2
3
3
I consider it to be finished. Autograder has been tested on a real university class with hundreds of students and has shown to be error-less (in terms of grades), fast, and protected from cheating.
4
+
5
+
#### Note
6
+
If you wish to use autograder as a professor/student, configuring and running it through [GUI](https://github.com/Ovsyanka83/autograder_gui) is recommended -- it's a lot simpler, just as fast, and just as versatile.
7
+
8
+
The command line utility is intended for advanced use cases (extending autograder, grading on a server, or integrating it as a part of a larger utility/app)
9
+
4
10
#### Table of Contents
5
11
[Features](#Features)
6
12
[Installation](#Platform-Support)
@@ -14,30 +20,32 @@ I consider it to be finished. Autograder has been tested on a real university cl
*Most features are demonstrated in examples/ directory
23
+
*Blazingly fast (can grade hundreads of submissions using dozens of testcases in a few minutes. Seconds if grading python)
18
24
*[Easy to grade](#Usage)
19
25
*[Easy-to-write testcases](#Writing-testcases)
20
26
* Testcase grade can be based on [student's stdout](#Helper-functions)
21
-
* Can grade C, C++, Java, and Python code
22
-
* A file with testcase results will be generated for each student
23
-
* You can customize the total points for the assignment, maximum running time of student's program, file names to be considered for grading, formatters for checking student stdout, and [much more](https://github.com/Ovsyanka83/autograder/blob/master/autograder/default_config.ini).
24
-
*[Anti Cheating capabilities](#Anti-Cheating) that make it nearly impossible for students to break the grader and choose their grades.
25
-
* Grading submissions in multiple programming languages at once, as long as there are testcases written in each language.
26
-
* Most of these features are described in detail in [default_config.ini](https://github.com/Ovsyanka83/autograder/blob/master/autograder/default_config.ini) and demonstrated in examples/ directory.
* Can grade C, C++, Java, and Python code in regular mode
28
+
* Can grade any programming language in stdout-only mode
29
+
* A file with testcase grades and details can be generated for each student
30
+
* You can customize the total points for the assignment, maximum running time of student's program, file names to be considered for grading, formatters for checking student stdout, and [so much more](https://github.com/Ovsyanka83/autograder/blob/master/autograder/default_config.toml).
31
+
*[Anti Cheating capabilities](#Anti-Cheating) that make it nearly impossible for students to cheat
32
+
* Grading submissions in multiple programming languages at once
28
33
* JSON result output supported if autograder needs to be integrated as a part of a larger utility
34
+
* Can check submissions for similarity (plagiarism)
35
+
* Can detect and report memory leaks in C/C++ code
29
36
# Platform Support
30
37
* Linux is fully supported
31
38
* OS X has not been tested
32
39
* Windows is partially supported:
40
+
* Python fully supported
41
+
* Java supported if javac and java alias are available
33
42
* C/C++ have only been tested with `mingw` installed with `chocolatey`
34
-
* Java is only supported if autograder is run with Administrative privileges
35
43
* Stdout-testcases that require compilation are only supported if `make` is installed
36
-
* Stdout-testcases that require shebang lines are not supported
44
+
* Stdout-testcases that require shebang lines are not and cannot be supported
37
45
# Installation
38
46
* Currently Python >= 3.7 is necessary.
39
-
* Run `pip3 install assignment-autograder`
40
-
* If you want to update to a newer version, run `pip3 install --upgrade --no-cache-dir assignment-autograder`
47
+
* Run `pip install assignment-autograder`
48
+
* If you want to update to a newer version, run `pip install -U --no-cache-dir assignment-autograder`
41
49
# Supported Programming Languages
42
50
* Java (only through javac and java alias)
43
51
* C (only through gcc)
@@ -51,29 +59,29 @@ I consider it to be finished. Autograder has been tested on a real university cl
51
59
1) Create tests directory in the same directory as student submissions. Its structure is shown in [examples](https://github.com/Ovsyanka83/autograder/tree/master/examples). (can be automatically created using [--guide](#Quickstart))
52
60
1)__Optional__ files that can be automatically created by [--guide](#Quickstart) CLI option and whose use is demostrated by [examples](https://github.com/Ovsyanka83/autograder/tree/master/examples):
53
61
1) Input (stdin) and expected output (__stdout__) text files in their respective directories for each testcase. If a test does not require input and/or stdout, the respective text file is also not required.
54
-
1) Create [config.ini](https://github.com/Ovsyanka83/autograder/blob/master/autograder/default_config.ini) and change configuration to fit your needs (If you do not include some fields, autograder will use the respective fields from default_config.ini)
62
+
1) Create [config.ini](https://github.com/Ovsyanka83/autograder/blob/master/autograder/default_config.toml) and change configuration to fit your needs (If you do not include some fields, autograder will use the respective fields from default_config.ini)
55
63
1) Create [stdout_formatters.py](https://github.com/Ovsyanka83/autograder/blob/master/autograder/default_stdout_formatters.py) and edit it to fit your needs. They will format student's stdout to allow you to give credit to students even if their stdout is not exactly the same as expected.
56
64
1) Write testcases as described [below](#Writing-testcases) using [examples](https://github.com/Ovsyanka83/autograder/tree/master/examples) as reference.
57
65
1) Run `autograder run path/to/submissions/dir` from command line.
58
66
## Writing testcases
59
67
* Write a main that follows the same structure as one of the examples in your programming language. The main should usually call student's code, check its result, and call one of the helper functions (when working with stdout, you don't check the result, and simply allow autograder to handle grading by calling CHECK_STDOUT())
60
68
* Assume that student's code is available in your namespace. Examples demonstrate exactly how to call students' functions.
61
-
* Assume that helper functions CHECK_STDOUT(), RESULT(int r), PASS(), FAIL() are predefined and use them to return student scores to the grader
69
+
* Assume that helper functions (decribed below) are predefined and use them to return student scores to the grader
62
70
* Each helper function prints the student's score, __validation string__, terminates the execution of the program and returns its respective exit code that signifies to autograder if the testcase ended in a result, cheating attempt, or if stdout checking is necessary.
63
71
* Each testcase is graded out of 100% and each grade is a 64bit double precision floating point number, which means that you can fully control how much partial credit is given in non-stdout checking tests.
64
72
### Helper functions
65
-
* CHECK_STDOUT() indicates that we do not check student's return values for the testcase and that we only care about their output (__stdout__) that will be checked by the autograder automatically using student's stdout and the output files with the same name stem as the testcase. (beware: printing anything within your testcase will break this functionality)
73
+
* CHECK_STDOUT() indicates that we do not check student's return values for the testcase and that we only care about their output (__stdout__) that will be checked by the autograder automatically using student's stdout and the output files with the same name stem as the testcase. (beware: printing anything within your testcase can break this functionality)
66
74
* RESULT(double r) returns student's score r back to the grader (0 - 100)
67
75
* PASS() returns the score of 100% back to the grader and is equivalent to RESULT(100)
68
76
* FAIL() returns the score of 0% back to the grader and is equivalent to RESULT(0)
69
77
## Limitations
70
78
* At the point of writing this readme, stdout checking is a PASS or FAIL process (i.e. no partial credit possible). The reason is that allowing for 'partial similarity' of outputs is too error-prone and could yield too many points for students that did not actually complete the task properly. If you want to increase the chances of students' stdout matching, you should use stdout formatters described [above](#Usage).
71
79
* If you don't prototype student functions you want to test in your C/C++ testcases, you will run into undefined behavior because of how C and C++ handle linking.
72
-
*__Student's main functions ARE NOT meant to be accessed because testcase must be the starting point of the program.__ They are, however, accessible if necessary but undocumented in general case and always accessible in stdout-only grading.
80
+
*__Student's main functions ARE NOT meant to be accessed because testcase must be the starting point of the program.__ They are, however, accessible if necessary in C/C++ as \_\_student_main\_\_.
73
81
## Anti Cheating
74
82
One of the main weaknesses of automatic grading is how prone it is to cheating. Autograder tries to solve this problem with methods described in this section. Currently, (as far as I've read and tested), it is impossible to cheat autograder. However, Java might still have some weird ways of doing this but there are protections against all of the most popular scenarios (decompiling and parsing testcases, using System.exit, trying to read security key from environment variables, using reflection to use private members of the test helper)
75
83
* To restrict the student from exiting the process himself and printing the grade of his/her choice, I validate testcase stdout using a pseudorandom key called __validation string__. Autograder gives the string to the testcase as an environment variable which is erased right after the testcase saves it, and then it is automatically printed on the last line of stdout before the testcase exits. The autograder, then, pops it from stdout and verifies that it is the same string it sent. If it is not, the student will get the respective error message and a 0 on the testcase.
76
-
* To prevent students from simply importing the string from the testcase file, test helper files (described above) all have some way of disallowing imports. For C/C++, it is the static identifier, for Java, it is the private method modifiers and SecurityManager to protect against reflection, for python it is throwing an error if __name__ != "__main__". I assume that similar precautions can be implemented in almost any language added into autograder.
84
+
* To prevent students from simply importing the string from the testcase file, test helper files (described above) all have some way of disallowing imports. For C/C++, it is the static identifier, for Java, it is the private method modifiers and automatic testcase fail if reflection is detected, for python it is throwing an error and deleting the validation string if \_\_name\_\_ != "\_\_main\_\_". I assume that similar precautions can be implemented in almost any language.
77
85
* Simply parsing validating string from the testcase file is impossible because it is passed at runtime.
78
86
* As an additional (and maybe unnecessary) security measure, autograder precompiles testcases without linking for all languages except for java, thus decreasing the possibility that the student will simply parse the testcase file and figure out the correct return values if the security measure above doesn't work.
79
87
@@ -87,5 +95,6 @@ One of the main weaknesses of automatic grading is how prone it is to cheating.
87
95
* This point is optional but if you want full anti-cheating capabilities for your new language, you will need to consider three things:
88
96
89
97
* Does your language support getting and unsetting environment variables? It is required to save validating string in your code without leaking it to students.
90
-
* Does your language support private-to-file functions/classes/methods/variables? It is required to prevent the student from simply importing helper functions and validating string.
91
-
* Does your language support precompilation (conversion to bytecode without linking)? It is not as important as other points but could speed up grading and hide testcase code from students.
98
+
* Does your language support private-to-file functions/classes/methods/variables? It is required to prevent the student from simply importing helper functions and/or the validating string.
99
+
* Does your language support precompilation (conversion to bytecode without linking)? It is not as important as other points but could speed up grading and hide testcase code from students.
100
+
* You can extend many other capabilities of autograder using new testcase types. For example, C testcase type adds memory leak detection on its own for both C and C++ testcases.
0 commit comments