Please note that in order to create zyLabs, your zyBook must have zyLabs enabled. If you are not sure if you have zyLabs enabled or you would like to enable them, please refer to your Account Executive.
To create a new zyLab, start by expanding the chapter you would like to add the zyLab to and scroll to the bottom of the section list. (Note: This can be done on the zyBook homepage or in the sidebar in the content)
After clicking "Add a zyLab", you will be asked if you would like to create a new zyLab from scratch or copy an existing zyLab.
For this tutorial, we will be creating a new zyLab.
After clicking the "Create zyLab", button you will be taken to the zyLab editor page for the new zyLab that you are creating.
You will first be asked to provide a title and a set of instructions that your students will need to follow. 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 help bold text, create bulleted lists, add links, and more.
On the options card, you can select several items to fully customize your zyLab. You will be able to:
- Select if you want to allow students to work in our development environment or require them to work in their own IDE and then upload their files.
- Select from a number of compilation flags.
- Enforce a submission limit and submission rate.
- Provide a password which prevents students from being able to view the zyLab until you've given them the password.
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 provide a solution. We highly recommend providing a solution to the zyLab to help you test the zyLab before sharing it with your students. Please note that your students will not be able to 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 the zyLab. We allow you to 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 any inputs you want to pass to the student's program. Ex: If the students' program should read in two numbers then output the sum, your "input" would be the two values you want the student to read.
If you have already provided a solution, click the "Generate output from solution" button. This will run the program that you wrote earlier on the student files card, pass in the inputs provided for this test case and then determine what the outputs should be.
If you have not provided a solution yet, that is ok, you can manually type the expected output. We generally do not recommend this, especially for large amounts of output. Generating output is typically much safer.
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 you 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.