Documentation:WeBWorK/How to Import Homework Sets from Set-definition Files

From UBC Wiki
Jump to: navigation, search

It is usually easier to upload all HW sets at once and configure all of the HW sets using pre-written definition files. By doing so, the instructors and TAs will not have to change the "parameters" of the incoming HW set every week, such as the start time and the due date of that set. All the parameters can be set automatically using the definition files beforehand. Moreover, if the instructor wants to reuse last term's questions for the same course, all he/she needs to do is slightly modify the definition files.

An example is provided here to illustrate the procedures. Suppose there are two HWsets: HW01 contains three questions:, and; HW02 contains three questions:, and We now write the definition file for HW01: first create a new text file and copy the following lines of codes into the text file:

setNumber= HW01
openDate = 1/8/17 at 9:00pm
dueDate = 1/17/17 at 9:00pm
answerDate = 1/17/17 at 9:00pm
paperHeaderFile =
screenHeaderFile =
problemList =
HW01/, 1, 2
HW01/, 1, 3
HW01/, 1, 2

Save the file as setHW01.txt. After saving it, change the extension from .txt to .def. Therefore the final file name is setHW01.def. Here is the explanation of the above lines:

setNumber = [Name of the homework set]
openDate = [start date of the homework set]
dueDate = [start date of the homework set]
answerDate = [start date of the homework set]
paperHeaderFile = [just keep this empty]
screenHeaderFile = [just keep this empty]
problemList =
[path to problem 1, score, max attempt]
[path to problem 2, score, max attempt]

Following the same procedure, it is straightforward to write another definition file for HW02, setHW02.def. Please note that the name of the definition file must begin with "set", for example setHW01.def is a valid name, HW01.def is not valid and will not be recognized by the system.

With two HW sets and two definition files, it is suggested to compress them into a tar.gz file. Now follow the procedures below to upload them on WebWork:
1. Log in to your WeBWorK course
2. Navigate to 'File Manager' area
3. Select the webwork archive (.tgz file) you want to upload
4. Normally, you can leave the settings at their defaults
5. Click the 'Upload' button. The archive will be uploaded, unpacked, and the archive file (.tgz) would be deleted on successful unpacking

Once the uploading procedure is complete, the steps to use the two HW sets are below:
1. Navigate to 'Hmwk Sets Editor' area
2. Select the 'Import' tab
3. Choose the set-definition files you'd like to import from
4. If you'd like to, give the two problem sets new names. If you don't enter names, the problem sets will be named after the set-definition files.
5. Make sure that the settings are what you want and click the 'Take Action' button

Now the two problem sets will show up under Homework Sets and the "parameters" of the sets are all set. If you have more than two HW sets, the procedure is pretty much similar to the above.

We acknowledge Dr. Andy Leung for providing the DEMO definition file and the link for the procedures for uploading and using the definition files. Should you have any questions, email the creator at