1 |
efrain |
1 |
@mod @mod_quiz
|
|
|
2 |
Feature: Backup and restore of quizzes
|
|
|
3 |
In order to reuse my quizzes
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to back them up and restore them.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category |
|
|
|
10 |
| Course 1 | C1 | 0 |
|
|
|
11 |
And the following "question categories" exist:
|
|
|
12 |
| contextlevel | reference | name |
|
|
|
13 |
| Course | C1 | Test questions |
|
|
|
14 |
And the following config values are set as admin:
|
|
|
15 |
| enableasyncbackup | 0 |
|
|
|
16 |
And I log in as "admin"
|
|
|
17 |
|
|
|
18 |
@javascript
|
|
|
19 |
Scenario: Duplicate a quiz with two questions
|
|
|
20 |
Given the following "activities" exist:
|
|
|
21 |
| activity | name | intro | course | idnumber |
|
|
|
22 |
| quiz | Quiz 1 | For testing backup | C1 | quiz1 |
|
|
|
23 |
And the following "questions" exist:
|
|
|
24 |
| questioncategory | qtype | name | questiontext |
|
|
|
25 |
| Test questions | truefalse | TF1 | First question |
|
|
|
26 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
27 |
And quiz "Quiz 1" contains the following questions:
|
|
|
28 |
| question | page |
|
|
|
29 |
| TF1 | 1 |
|
|
|
30 |
| TF2 | 2 |
|
|
|
31 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
32 |
And I duplicate "Quiz 1" activity editing the new copy with:
|
|
|
33 |
| Name | Quiz 2 |
|
|
|
34 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
35 |
Then I should see "TF1"
|
|
|
36 |
And I should see "TF2"
|
|
|
37 |
|
|
|
38 |
@javascript
|
|
|
39 |
Scenario: Backup and restore a course containing a quiz with user data.
|
|
|
40 |
Given the following "activities" exist:
|
|
|
41 |
| activity | name | intro | course | idnumber |
|
|
|
42 |
| quiz | Quiz 1 | For testing backup | C1 | quiz1 |
|
|
|
43 |
And the following "questions" exist:
|
|
|
44 |
| questioncategory | qtype | name | questiontext |
|
|
|
45 |
| Test questions | truefalse | TF1 | First question |
|
|
|
46 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
47 |
And quiz "Quiz 1" contains the following questions:
|
|
|
48 |
| question | page |
|
|
|
49 |
| TF1 | 1 |
|
|
|
50 |
| TF2 | 2 |
|
|
|
51 |
And the following "users" exist:
|
|
|
52 |
| username |
|
|
|
53 |
| student |
|
|
|
54 |
And the following "course enrolments" exist:
|
|
|
55 |
| user | course | role |
|
|
|
56 |
| student | C1 | student |
|
|
|
57 |
And user "student" has attempted "Quiz 1" with responses:
|
|
|
58 |
| slot | response |
|
|
|
59 |
| 1 | True |
|
|
|
60 |
| 2 | False |
|
|
|
61 |
When I backup "Course 1" course using this options:
|
|
|
62 |
| Confirmation | Filename | test_backup.mbz |
|
|
|
63 |
And I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
64 |
| Schema | Course name | Restored course |
|
|
|
65 |
Then I should see "Restored course"
|
|
|
66 |
And I click on "Quiz 1" "link" in the "region-main" "region"
|
|
|
67 |
And I should see "Attempts: 1"
|
|
|
68 |
|
|
|
69 |
@javascript @_file_upload
|
|
|
70 |
Scenario: Restore a Moodle 2.8 quiz backup
|
|
|
71 |
When I am on the "Course 1" "restore" page
|
|
|
72 |
And I press "Manage course backups"
|
|
|
73 |
And I upload "mod/quiz/tests/fixtures/moodle_28_quiz.mbz" file to "Files" filemanager
|
|
|
74 |
And I press "Save changes"
|
|
|
75 |
And I restore "moodle_28_quiz.mbz" backup into "Course 1" course using this options:
|
|
|
76 |
And I am on the "Restored Moodle 2.8 quiz" "mod_quiz > Edit" page
|
|
|
77 |
Then I should see "TF1"
|
|
|
78 |
And I should see "TF2"
|