All Collections
For Instructors
Grading
Auto-Generate Grading Scripts
Auto-Generate Grading Scripts
David avatar
Written by David
Updated over a week ago

Vocareum's platform provides the ability to auto-generate simple scripts to facilitate the automatic grading of student assignments based on output comparison or exit status. Grades are reported through the use of a CSV grading file.

Here are the necessary steps to set this up -

1) In the parts settings of your assignment, under the Grading, turn on the "Generate Scripts" option -

2) Optionally, enter in an initialization script which can help setup the grading environment. This script will run before the grading code. In following example, we will use the initialization script to compile Factorial.cpp into factorial.exe.

3) Select the "Autograde" checkbox to enable automatic running of the grading script, then click the "Autograde" link.

4) The following screen appears when the Autograde link is clicked. Decide on the Grading Approach -

  • Compare Output - run the command with a given set of standard inputs, then compare with the expected output

  • Check Command Exit Status - run the Command. Success, if the exit status is "0"; otherwise Failure.

5) Enter the "Command" to be run based on the given Grading Approach.

6) If using output comparison, fill in the "Standard Input" and "Expected Output" text boxes.

7) Click "Generate", then "Save Part" to commit your Grading setup changes and to generate the scripts.

8) In the above example, the following files are automatically generated:

../resource/scripts/grade.sh

g++ -o factorial.exe Factorial.cpp
echo VOC_NO_REPORT_OUTPUT > $vocareumReportFile factorial.exe < $ASNLIB/input1.txt > output1.txt
diff output1.txt $ASNLIB/output1.txt
status=$?
echo ================================================== >> $vocareumReportFile
if [ "$status" == "0" ]; then
  echo "Test1", 5 >>  $vocareumGradeFile
  echo Test1 passed >> $vocareumReportFile
else
  echo "Test1", 0 >> $vocareumGradeFile
  echo Test1 failed >> $vocareumReportFile
fi
echo ================================================== >> $vocareumReportFilefactorial.exe < $ASNLIB/input2.txt > output2.txt
diff output2.txt $ASNLIB/output2.txt
status=$?
echo ================================================== >> $vocareumReportFile
if [ "$status" == "0" ]; then
  echo "Test2", 5 >>  $vocareumGradeFile
  echo Test2 passed >> $vocareumReportFile
else
  echo "Test2", 0 >> $vocareumGradeFile
  echo Test2 failed >> $vocareumReportFile
fi
echo ================================================== >> $vocareumReportFile

../resource/asnlib/input1.txt

5

../resource/asnlib/output1.txt

120
Did this answer your question?