To add a test while you create a course, go to the "Dashboard" tab on the course's page and click on the "Add content" (1) button next to the lesson you want to contain the test. Then, from the drop-down list, pick the "Add test" (2) option.
Note: To add a test to an existing course, you have to sign in to your system either as an administrator or as an instructor, depending on which account was used to create the course. Only one account can maintain course ownership, along with the permission to add/edit tests in that course.
After signing in as the course's owner, go to the "Add test" page and start by typing a title (3) for the new test unit in the "Name*" field (this step is required). Then, you can add a description for your test (4) and click on the "Show advanced settings" (5) link to further customize your test's function.
Note: For detailed information on the available "advanced settings", see this article.
Once you are done, click on the "Save and Select questions" (6) button.
The new test is successfully added to your course and you are taken to the test unit's (2) "Questions" (1) tab. From here, you can:
Add questions (3): Select the type of question you want to add to your test (for more on the available question types, see this article.
Show questions from (4): View and select, if suitable, existing questions from other lessons (for more on this, see "How to select questions to a test using specific criteria").
View test (5): Preview your test.