NOTE: To create zyLabs, your zyBook must have zyLabs enabled. If you'd like to enable (or are unsure if zyLabs is already enabled), contact your Account Executive.
NOTE: This article is primarily for zyLabs for C, C++, Java, and Python. zyLabs for Web Programming may have some differences. zyLabs for MATLAB uses a tool provided by Mathworks and may have larger differences.
To create a new zyLab, expand the chapter where you want the new zyLab and scroll to the bottom of the section list. (Note: Expanding a chapter can be done in the table of contents on the zyBook homepage or in the content's sidebar.)
Click "Add a zyLab". You'll be asked to create a new zyLab from scratch or to copy an existing zyLab.
This tutorial will create a new zyLab.
Clicking "Create zyLab" takes you to the zyLab editor page for the new zyLab.
You will first be asked to provide a title and a set of instructions for your students. You can use Markdown to format your instructions. Markdown resources are made available to you if you are not familiar with Markdown. Markdown can be used to make text bold, create bulleted lists, add links, and more.
On the options card, you can select items to customize your zyLab, such as:
- Select whether students work in our in-book development environment, or in their own IDE and then upload their files.
- Select various compilation flags.
- Enforce a submission limit or submission rate.
- Provide a password to prevent students from viewing the zyLab until you've given the password.
- Hide the lab. Students will see a message that the lab is hidden. Instructors commonly unhide labs at a given time, like at the week's start. (You'll also want to keep the lab hidden while you develop the lab.)
On the Student files card, you can provide a template for students to get started. You can select our "Use default template" button to generate boilerplate code for the language your zyLab is set to. You can also expand upon this template to include function stubs or any other code you might want the student to have available to them when they begin the zyLab.
You can also create a solution. We highly recommend creating a solution so you can test the zyLab before sharing it with your students. Note that students will not see your solution unless you select that option on the Options card above.
You can click "Add another" file to provide additional files for your students. These files can also be provided with templates and solutions. If needed, you can set an additional file to "Read only" so that students can access functions in the other files without modifying them.
On this card, you can upload additional files that students can use for File I/O. (Note: Students can access these files from their programs, but they cannot actually view the files.)
Test benches are the true heart and power of zyLabs. You can create two kinds of tests: "Compare output" tests and "Unit" tests. If you are new to zyLabs, we recommend starting with the "Compare output" tests.
Start by providing inputs to pass to the student's program. Ex: If the student's program should read two numbers and output the sum, your "input" would be two values to be read. Then, type the output for that input.
If you are confident of your solution and have extensive formatted output, you may wish to use the "Generate output from solution" button to generate the output automatically from your solution. We recommend typing the test case output manually when possible to ensure your solution works correctly.
Unit tests allow you to call a student's code to make sure the function is behaving as expected. Ex: If, for the assignment, students must write a function called "addTwoNumbers(num1, num2)" that returns the sum of the two numbers, you can call their function with appropriate arguments in a Unit test. Then, you can compare the returned value to the value you expect using if/else statements. A unit test should return true or false, where true means the student passed the test and false means the student did not pass.
As you write your test cases, we recommend clicking the "Run tests" button found in the lower right-hand corner of the screen. This will help verify that your test cases are able to pass the solution you provided. If the tests fail, you might need to make tweaks to either the test cases or the solution itself.
If you want to give some test cases more weight than others, you can assign a point value to your test cases. You can see in my example above that I left the compare output test at 1 point, but I changed the unit test to be worth 5 points.
Once you have written your instructions, test cases, and optional solution files, you can click "Save and exit" in the lower left hand corner. Your new zyLab will appear at the bottom of the chapter where you initially clicked "Add a zyLab". You can use "Configure" mode to move the zyLab as needed.
Hiding a lab / Toggling a lab's visibility
Instructors commonly hide a lab's contents from students, releasing a lab on a particular date for students to start working. Hiding is also done while a lab is being developed. Hiding/unhiding can be done when in the lab's Edit mode:
For convenience, hiding/unhiding can also be done at the top of the lab, without entering the lab's Edit mode. Just click on the toggle switch next to "Visible to students" to toggle between visible and not visible:
"Deleting" a lab is done by entering a zyBook's configure mode, selecting the lab, and moving it to "Unused". The lab can be "recovered" by entering Configure mode again, selecting the lab in Unused, and moving it to a regular chapter. It is not expected that instructors will move items to Unused and then back to regular chapters on a regular basis; Unused is like a trash can. Because the size of this trash can is quite limited, we do not currently provide a means for instructors to permanently remove an item from Unused; in this way, any deleted item can in the future be restored if necessary.