This test requires
- a question category X containing 4 or more questions,
- a category Y containing 2 or more questions, and
- during the test you will create a third category called Z.
1. Login as a teacher and add a quiz activity. Make sure "Question order" is "As shown on the edit screen".
2. Go to the "Edit quiz" page. If necessary switch to the "Edit quiz" tab (not Order and paging). Make sure the question bank is visible. If not, click "[Show]".
3. Select Category X in the "Select a category:" menu at the top of the question bank. Click the << icon next to one of the questions to add one question to the quiz (non-randomly).
4. Now use the controls at the bottom of the question bank under the "Add random questions from category" heading to Add 2 random questions to the quiz.
5. Click an "Add a random question..." button in any page of the quiz. Use the "Random question from an existing category" section of the form to add a random question from category Y.
6. Click an "Add a random question..." button again. Use the "Random question using a new category" section to create a new Category Z with parent "Top".
7. The edit screen will tell you that the category is empty. "Create a new question ..." in this category in the question bank.
8. Click the "Show category contents >" link for one of the other random questions, and check that the question bank display switches to that other category.
9. Preview the quiz a few times. Check that
- the non-random question is always the same;
- the random questions for Category X are random, but do not duplicate the non-random question;
- the random question for Category Y is random; and
- the random question from the category Z is always the same. (We are testing that having only just enough questions in the category does not cause an error.)