Tutorial: Moodle VPL Hello World -- Python

From dftwiki3
Revision as of 14:25, 10 June 2014 by Thiebaut (talk | contribs) (Testing as Admin)
Jump to: navigation, search

--D. Thiebaut (talk) 14:56, 10 June 2014 (EDT)


  • Login as Instructor for course where Python test is to be added
  • Turn editing ON

Add New Activity

  • Add new activity
MoodleVPLAddVPLActivity.png
  • Set the following fields:
    • Name: Hello World Test
    • Short description: Hello World in Python 3
    • Full description: You need to write a Python program that outputs the string "Hello World!" (without the quotes, and with a blank line afterwards) on the console.
    • Submission period: pick today's date for Available from and a date that is in your future for Due date, and click on Enable
    • Submission restrictions/Max number of files: 1, and leave all the other fields with their default values.
    • Grade: Use Point, 100, and pick the category of grades this should fall in (You need to create categories first, i.e. quizzes, homework, exam, etc.)
    • Save and display


VPL Administration


Setup the VPL system to test the students programs


  • Concentrate now on the second down on the left:


MoodleVPLAdministrationMenu.png


  • Test cases: Enter a name for the case, and what the output of the program is expected to be. The exact output should be between double quotes. Note that there is a return at the end of "Hello World!" which should be part of the output.


MoodleVPLTestCasesHelloWorld.png


  • Execution options: Run: Yes, Debug: No, Evaluate: Yes, Evaluate just on submission: No, Automatic Grade: Yes
  • Requested files: hello.py. Just enter this file name, and nothing in the edit window. Click on Save.


Testing as Admin


  • Test activity. Click on Edit and enter this simple program:


#! /usr/bin/python3.4

def main():
    print( "Hello World!" )
    
main()


  • Save
  • Click on Run

MoodleVPLTestRunInConsole.png


  • Close the console
  • Click on Evaluate

MoodleVPLTestEvaluate.png


Verify that you get the message shown below, indicating that the program runs correctly and gets full mark.
+------------------------------+
|  1  test run/ 0 tests failed |
+------------------------------+