diff --git a/question/type/description/tests/behat/add.feature b/question/type/description/tests/behat/add.feature
new file mode 100644
index 00000000000..6742f7c86e9
--- /dev/null
+++ b/question/type/description/tests/behat/add.feature
@@ -0,0 +1,27 @@
+@qtype @qtype_description
+Feature: Test creating a Description question
+ As a teacher
+ In order to test my students
+ I need to be able to create a Description question
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Create a Description question with Correct answer as False
+ When I add a "Description" question filling the form with:
+ | Question name | description-001 |
+ | Question text | Instructions about the following questions. |
+ | General feedback | Why actually the field 'General feedback' used in this qytype? |
+ Then I should see "description-001"
diff --git a/question/type/description/tests/behat/backup_and_restore.feature b/question/type/description/tests/behat/backup_and_restore.feature
new file mode 100644
index 00000000000..d7c1079a0af
--- /dev/null
+++ b/question/type/description/tests/behat/backup_and_restore.feature
@@ -0,0 +1,37 @@
+@qtype @qtype_description
+Feature: Test duplicating a quiz containing a Description question
+ As a teacher
+ In order re-use my courses containing Description questions
+ I need to be able to backup and restore them
+
+ Background:
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | description | description-001 | info |
+ And the following "activities" exist:
+ | activity | name | course | idnumber |
+ | quiz | Test quiz | C1 | quiz1 |
+ And quiz "Test quiz" contains the following questions:
+ | description-001 | 1 |
+ And I log in as "admin"
+ And I am on site homepage
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Backup and restore a course containing a Description question
+ When I backup "Course 1" course using this options:
+ | Confirmation | Filename | test_backup.mbz |
+ And I restore "test_backup.mbz" backup into a new course using this options:
+ | Schema | Course name | Course 2 |
+ And I navigate to "Question bank" node in "Course administration"
+ And I click on "Edit" "link" in the "description-001" "table_row"
+ Then the following fields match these values:
+ | Question name | description-001 |
+ | Question text | Here is some information about the questions you are about to attempt. |
+ | General feedback | And here is some more text shown only on the review page. |
diff --git a/question/type/description/tests/behat/edit.feature b/question/type/description/tests/behat/edit.feature
new file mode 100644
index 00000000000..2ed8a540adb
--- /dev/null
+++ b/question/type/description/tests/behat/edit.feature
@@ -0,0 +1,37 @@
+@qtype @qtype_description
+Feature: Test editing a Description question
+ As a teacher
+ In order to be able to update my Description question
+ I need to edit them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | description | description-001 | info |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Edit a Description question
+ When I click on "Edit" "link" in the "description-001" "table_row"
+ And I set the following fields to these values:
+ | Question name | |
+ And I press "id_submitbutton"
+ Then I should see "You must supply a value here."
+ When I set the following fields to these values:
+ | Question name | Edited description-001 name |
+ And I press "id_submitbutton"
+ Then I should see "Edited description-001 name"
diff --git a/question/type/description/tests/behat/export.feature b/question/type/description/tests/behat/export.feature
new file mode 100644
index 00000000000..fdad51e3b6b
--- /dev/null
+++ b/question/type/description/tests/behat/export.feature
@@ -0,0 +1,36 @@
+@qtype @qtype_description
+Feature: Test exporting Description questions
+ As a teacher
+ In order to be able to reuse my Description questions
+ I need to export them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | description | description-001 | info |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Export a Description question
+ When I navigate to "Export" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I press "Export questions to file"
+ Then following "click here" should download between "650" and "750" bytes
+ # If the download step is the last in the scenario then we can sometimes run
+ # into the situation where the download page causes a http redirect but behat
+ # has already conducted its reset (generating an error). By putting a logout
+ # step we avoid behat doing the reset until we are off that page.
+ And I log out
diff --git a/question/type/description/tests/behat/import.feature b/question/type/description/tests/behat/import.feature
new file mode 100644
index 00000000000..ee0f1bc4e75
--- /dev/null
+++ b/question/type/description/tests/behat/import.feature
@@ -0,0 +1,30 @@
+@qtype @qtype_description
+Feature: Test importing Description questions
+ As a teacher
+ In order to reuse Description questions
+ I need to import them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript @_file_upload
+ Scenario: import a Description question.
+ When I navigate to "Import" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I upload "question/type/description/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
+ And I press "id_submitbutton"
+ Then I should see "Parsing questions from import file."
+ And I should see "Importing 1 questions from file"
+ And I should see "Instructions about the following questions."
+ And I press "Continue"
+ And I should see "description-001"
diff --git a/question/type/description/tests/behat/preview.feature b/question/type/description/tests/behat/preview.feature
new file mode 100644
index 00000000000..f6f47060807
--- /dev/null
+++ b/question/type/description/tests/behat/preview.feature
@@ -0,0 +1,34 @@
+@qtype @qtype_description
+Feature: Preview a Description question
+ As a teacher
+ In order to check my Description questions will work for students
+ I need to preview them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | description | description-001 | info |
+ Given I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Preview a question and submit a correct response.
+ When I click on "Preview" "link" in the "description-001" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I should see "Here is some information about the questions you are about to attempt."
+ And I switch to the main window
diff --git a/question/type/description/tests/fixtures/testquestion.moodle.xml b/question/type/description/tests/fixtures/testquestion.moodle.xml
new file mode 100644
index 00000000000..b605d828c5e
--- /dev/null
+++ b/question/type/description/tests/fixtures/testquestion.moodle.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+ $course$/Default for C1
+
+
+
+
+
+
+
+ description-001
+
+
+ Instructions about the following questions.
+
+
+ Why actually the field 'General feedback' used in this qytype?
+
+ 0.0000000
+ 0.0000000
+ 0
+
+
+
diff --git a/question/type/essay/tests/behat/add.feature b/question/type/essay/tests/behat/add.feature
new file mode 100644
index 00000000000..152cc063087
--- /dev/null
+++ b/question/type/essay/tests/behat/add.feature
@@ -0,0 +1,37 @@
+@qtype @qtype_essay
+Feature: Test creating an Essay question
+ As a teacher
+ In order to test my students
+ I need to be able to create an Essay question
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Create an Essay question with Response format set to 'HTML editor'
+ When I add a "Essay" question filling the form with:
+ | Question name | essay-001 |
+ | Question text | Write an essay with 500 words. |
+ | General feedback | This is general feedback |
+ | Response format | HTML editor |
+ Then I should see "essay-001"
+
+ @javascript
+ Scenario: Create an Essay question with Response format set to 'HTML editor with the file picker'
+ When I add a "Essay" question filling the form with:
+ | Question name | essay-002 |
+ | Question text | Write an essay with 500 words. |
+ | General feedback | This is general feedback |
+ | Response format | HTML editor |
+ Then I should see "essay-002"
diff --git a/question/type/essay/tests/behat/backup_and_restore.feature b/question/type/essay/tests/behat/backup_and_restore.feature
new file mode 100644
index 00000000000..e3e3c8a293b
--- /dev/null
+++ b/question/type/essay/tests/behat/backup_and_restore.feature
@@ -0,0 +1,62 @@
+@qtype @qtype_essay
+Feature: Test duplicating a quiz containing an Assay question
+ As a teacher
+ In order re-use my courses containing Essay questions
+ I need to be able to backup and restore them
+
+ Background:
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | essay | essay-001 | editor |
+ | Test questions | essay | essay-002 | editorfilepicker |
+ | Test questions | essay | essay-003 | plain |
+ And the following "activities" exist:
+ | activity | name | course | idnumber |
+ | quiz | Test quiz | C1 | quiz1 |
+ And quiz "Test quiz" contains the following questions:
+ | essay-001 | 1 |
+ | essay-002 | 1 |
+ | essay-003 | 1 |
+ And I log in as "admin"
+ And I am on site homepage
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Backup and restore a course containing 3 Essay questions
+ When I backup "Course 1" course using this options:
+ | Confirmation | Filename | test_backup.mbz |
+ And I restore "test_backup.mbz" backup into a new course using this options:
+ | Schema | Course name | Course 2 |
+ And I navigate to "Question bank" node in "Course administration"
+ And I should see "essay-001"
+ And I should see "essay-002"
+ And I should see "essay-003"
+ And I click on "Edit" "link" in the "essay-001" "table_row"
+ Then the following fields match these values:
+ | Question name | essay-001 |
+ | Question text | Please write a story about a frog. |
+ | General feedback | I hope your story had a beginning, a middle and an end. |
+ | Response format | HTML editor |
+ | Require text | Require the student to enter text |
+ And I press "Cancel"
+ And I click on "Edit" "link" in the "essay-002" "table_row"
+ Then the following fields match these values:
+ | Question name | essay-002 |
+ | Question text | Please write a story about a frog. |
+ | General feedback | I hope your story had a beginning, a middle and an end. |
+ | Response format | HTML editor with file picker |
+ | Require text | Require the student to enter text |
+ And I press "Cancel"
+ And I click on "Edit" "link" in the "essay-003" "table_row"
+ Then the following fields match these values:
+ | Question name | essay-003 |
+ | Question text | Please write a story about a frog. |
+ | General feedback | I hope your story had a beginning, a middle and an end. |
+ | Response format | Plain text |
+ | Require text | Require the student to enter text |
diff --git a/question/type/essay/tests/behat/edit.feature b/question/type/essay/tests/behat/edit.feature
new file mode 100644
index 00000000000..9f032147f51
--- /dev/null
+++ b/question/type/essay/tests/behat/edit.feature
@@ -0,0 +1,44 @@
+@qtype @qtype_essay
+Feature: Test editing an Essay question
+ As a teacher
+ In order to be able to update my Essay question
+ I need to edit them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | essay | essay-001 | editor |
+ | Test questions | essay | essay-002 | editorfilepicker |
+ | Test questions | essay | essay-003 | plain |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Edit an Essay question
+ When I click on "Edit" "link" in the "essay-001" "table_row"
+ And I set the following fields to these values:
+ | Question name | |
+ And I press "id_submitbutton"
+ Then I should see "You must supply a value here."
+ When I set the following fields to these values:
+ | Question name | Edited essay-001 name |
+ | Response format | No inline text |
+ And I press "id_submitbutton"
+ Then I should see "When \"no inline text\" is selected, or responses are optional, you must allow at least one attachment."
+ When I set the following fields to these values:
+ | Response format | Plain text |
+ And I press "id_submitbutton"
+ Then I should see "Edited essay-001 name"
diff --git a/question/type/essay/tests/behat/export.feature b/question/type/essay/tests/behat/export.feature
new file mode 100644
index 00000000000..9b5810a656a
--- /dev/null
+++ b/question/type/essay/tests/behat/export.feature
@@ -0,0 +1,38 @@
+@qtype @qtype_essay
+Feature: Test exporting Essay questions
+ As a teacher
+ In order to be able to reuse my Essay questions
+ I need to export them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | essay | essay-001 | editor |
+ | Test questions | essay | essay-002 | editorfilepicker |
+ | Test questions | essay | essay-003 | plain |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Export 3 Essay questions
+ When I navigate to "Export" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I press "Export questions to file"
+ Then following "click here" should download between "2600" and "2700" bytes
+ # If the download step is the last in the scenario then we can sometimes run
+ # into the situation where the download page causes a http redirect but behat
+ # has already conducted its reset (generating an error). By putting a logout
+ # step we avoid behat doing the reset until we are off that page.
+ And I log out
diff --git a/question/type/essay/tests/behat/import.feature b/question/type/essay/tests/behat/import.feature
new file mode 100644
index 00000000000..b7ff3fc3bcc
--- /dev/null
+++ b/question/type/essay/tests/behat/import.feature
@@ -0,0 +1,30 @@
+@qtype @qtype_essay
+Feature: Test importing Essay questions
+ As a teacher
+ In order to reuse Essay questions
+ I need to import them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript @_file_upload
+ Scenario: import Essay question.
+ When I navigate to "Import" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I upload "question/type/essay/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
+ And I press "id_submitbutton"
+ Then I should see "Parsing questions from import file."
+ And I should see "Importing 1 questions from file"
+ And I should see "Write an essay with 500 words."
+ And I press "Continue"
+ And I should see "essay-001"
diff --git a/question/type/essay/tests/behat/preview.feature b/question/type/essay/tests/behat/preview.feature
new file mode 100644
index 00000000000..dd8ef442e77
--- /dev/null
+++ b/question/type/essay/tests/behat/preview.feature
@@ -0,0 +1,55 @@
+@qtype @qtype_essay
+Feature: Preview Essay questions
+ As a teacher
+ In order to check my Essay questions will work for students
+ I need to preview them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | essay | essay-001 | editor |
+ | Test questions | essay | essay-002 | editorfilepicker |
+ | Test questions | essay | essay-003 | plain |
+ Given I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Preview a question and submit a partially correct response.
+ When I click on "Preview" "link" in the "essay-001" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I should see "Please write a story about a frog."
+ And I switch to the main window
+
+ @javascript
+ Scenario: Preview a question and submit a partially correct response.
+ When I click on "Preview" "link" in the "essay-002" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I should see "Please write a story about a frog."
+ And I should see "You can drag and drop files here to add them."
+ And I switch to the main window
+
+ @javascript
+ Scenario: Preview a question and submit a partially correct response.
+ When I click on "Preview" "link" in the "essay-003" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I should see "Please write a story about a frog."
+ And I switch to the main window
diff --git a/question/type/essay/tests/fixtures/testquestion.moodle.xml b/question/type/essay/tests/fixtures/testquestion.moodle.xml
new file mode 100644
index 00000000000..4782ff6ce4b
--- /dev/null
+++ b/question/type/essay/tests/fixtures/testquestion.moodle.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ $course$/Default for C1
+
+
+
+
+
+
+
+ essay-001
+
+
+ Write an essay with 500 words.
+
+
+ This is general feedback
+
+ 1.0000000
+ 0.0000000
+ 0
+ editor
+ 1
+ 15
+ 0
+ 0
+
+
+
+
+
+
+
+
+
diff --git a/question/type/match/tests/behat/add.feature b/question/type/match/tests/behat/add.feature
new file mode 100644
index 00000000000..911348529f6
--- /dev/null
+++ b/question/type/match/tests/behat/add.feature
@@ -0,0 +1,38 @@
+@qtype @qtype_match
+Feature: Test creating a Matching question
+ As a teacher
+ In order to test my students
+ I need to be able to create a Matching question
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Create a Matching question with 3 subquestions
+ When I add a "Matching" question filling the form with:
+ | Question name | match-001 |
+ | Question text | Match the country with the capital city. |
+ | General feedback | England=London, France=Paris and Spain=Madrid. |
+ | id_subquestions_0 | England |
+ | id_subanswers_0 | London |
+ | id_subquestions_1 | France |
+ | id_subanswers_1 | Paris |
+ | id_subquestions_2 | Spain |
+ | id_subanswers_2 | Madrid |
+ | For any correct response | Your answer is correct |
+ | For any partially correct response | Your answer is partially correct |
+ | For any incorrect response | Your answer is incorrect |
+ | Hint 1 | This is your first hint |
+ | Hint 2 | This is your second hint |
+ Then I should see "match-001"
diff --git a/question/type/match/tests/behat/backup_and_restore.feature b/question/type/match/tests/behat/backup_and_restore.feature
new file mode 100644
index 00000000000..3ea996afb4a
--- /dev/null
+++ b/question/type/match/tests/behat/backup_and_restore.feature
@@ -0,0 +1,47 @@
+@qtype @qtype_match
+Feature: Test duplicating a quiz containing a Matching question
+ As a teacher
+ In order re-use my courses containing Matching questions
+ I need to be able to backup and restore them
+
+ Background:
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | match | matching-001 | foursubq |
+ And the following "activities" exist:
+ | activity | name | course | idnumber |
+ | quiz | Test quiz | C1 | quiz1 |
+ And quiz "Test quiz" contains the following questions:
+ | matching-001 | 1 |
+ And I log in as "admin"
+ And I am on site homepage
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Backup and restore a course containing a Matching question
+ When I backup "Course 1" course using this options:
+ | Confirmation | Filename | test_backup.mbz |
+ And I restore "test_backup.mbz" backup into a new course using this options:
+ | Schema | Course name | Course 2 |
+ And I navigate to "Question bank" node in "Course administration"
+ And I click on "Edit" "link" in the "matching-001" "table_row"
+ Then the following fields match these values:
+ | Question name | matching-001 |
+ | Question text | Classify the animals. |
+ | General feedback | General feedback. |
+ | Default mark | 1 |
+ | Shuffle | 1 |
+ | Question 1 | frog |
+ | Question 2 | cat |
+ | Question 3 | newt |
+ | Question 4 | |
+ | id_subanswers_0 | amphibian |
+ | id_subanswers_1 | mammal |
+ | id_subanswers_2 | amphibian |
+ | id_subanswers_3 | insect |
diff --git a/question/type/match/tests/behat/edit.feature b/question/type/match/tests/behat/edit.feature
new file mode 100644
index 00000000000..40663ae205f
--- /dev/null
+++ b/question/type/match/tests/behat/edit.feature
@@ -0,0 +1,50 @@
+@qtype @qtype_match
+Feature: Test editing a Matching question
+ As a teacher
+ In order to be able to update my Matching question
+ I need to edit them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | match | Matching for editing | foursubq |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Edit a Matching question
+ When I click on "Edit" "link" in the "Matching for editing" "table_row"
+ And I set the following fields to these values:
+ | Question name | |
+ And I press "id_submitbutton"
+ Then I should see "You must supply a value here."
+ When I set the following fields to these values:
+ | Question name | Edited Matching name |
+ And I press "id_submitbutton"
+ Then I should see "Edited Matching name"
+ When I click on "Edit" "link" in the "Edited Matching name" "table_row"
+ And I set the following fields to these values:
+ | Shuffle | 0 |
+ | Question 2 | dog |
+ | Question 4 | fly |
+ And I press "id_submitbutton"
+ Then I should see "Edited Matching name"
+ When I click on "Preview" "link" in the "Edited Matching name" "table_row"
+ And I switch to "questionpreview" window
+ Then I should see "frog"
+ And I should see "dog"
+ And I should see "newt"
+ And I should see "fly"
diff --git a/question/type/match/tests/behat/export.feature b/question/type/match/tests/behat/export.feature
new file mode 100644
index 00000000000..6d1420db436
--- /dev/null
+++ b/question/type/match/tests/behat/export.feature
@@ -0,0 +1,36 @@
+@qtype @qtype_match
+Feature: Test exporting Matching questions
+ As a teacher
+ In order to be able to reuse my Matching questions
+ I need to export them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | match | matching-001 | foursubq |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Export a Matching question
+ When I navigate to "Export" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I press "Export questions to file"
+ Then following "click here" should download between "1500" and "1600" bytes
+ # If the download step is the last in the scenario then we can sometimes run
+ # into the situation where the download page causes a http redirect but behat
+ # has already conducted its reset (generating an error). By putting a logout
+ # step we avoid behat doing the reset until we are off that page.
+ And I log out
diff --git a/question/type/match/tests/behat/import.feature b/question/type/match/tests/behat/import.feature
new file mode 100644
index 00000000000..1658d057f4e
--- /dev/null
+++ b/question/type/match/tests/behat/import.feature
@@ -0,0 +1,30 @@
+@qtype @qtype_match
+Feature: Test importing Matching questions
+ As a teacher
+ In order to reuse Matching questions
+ I need to import them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript @_file_upload
+ Scenario: import Matching question.
+ When I navigate to "Import" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I upload "question/type/match/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
+ And I press "id_submitbutton"
+ Then I should see "Parsing questions from import file."
+ And I should see "Importing 1 questions from file"
+ And I should see "1. Classify the animals."
+ And I press "Continue"
+ And I should see "matching-001"
diff --git a/question/type/match/tests/behat/preview.feature b/question/type/match/tests/behat/preview.feature
new file mode 100644
index 00000000000..2d219104fc6
--- /dev/null
+++ b/question/type/match/tests/behat/preview.feature
@@ -0,0 +1,79 @@
+@qtype @qtype_match
+Feature: Preview a Matching question
+ As a teacher
+ In order to check my Matching questions will work for students
+ I need to preview them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | match | matching-001 | foursubq |
+ Given I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Preview a question and submit a correct response.
+ When I click on "Edit" "link" in the "matching-001" "table_row"
+ And I set the following fields to these values:
+ | Shuffle | 0 |
+ And I press "id_submitbutton"
+ When I click on "Preview" "link" in the "matching-001" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub0')]" to "amphibian"
+ And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub1')]" to "mammal"
+ And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub2')]" to "amphibian"
+ And I press "Check"
+ Then I should see "Well done!"
+ And I should see "General feedback."
+ And I switch to the main window
+
+ @javascript
+ Scenario: Preview a question and submit a partially correct response.
+ When I click on "Edit" "link" in the "matching-001" "table_row"
+ And I set the following fields to these values:
+ | Shuffle | 0 |
+ And I press "id_submitbutton"
+ When I click on "Preview" "link" in the "matching-001" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub0')]" to "amphibian"
+ And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub1')]" to "insect"
+ And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub2')]" to "amphibian"
+ And I press "Check"
+ Then I should see "Parts, but only parts, of your response are correct."
+ And I should see "General feedback."
+ And I switch to the main window
+
+ @javascript
+ Scenario: Preview a question and submit an incorrect response.
+ When I click on "Edit" "link" in the "matching-001" "table_row"
+ And I set the following fields to these values:
+ | Shuffle | 0 |
+ And I press "id_submitbutton"
+ When I click on "Preview" "link" in the "matching-001" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub0')]" to "mammal"
+ And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub1')]" to "insect"
+ And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub2')]" to "insect"
+ And I press "Check"
+ Then I should see "That is not right at all."
+ And I should see "General feedback."
+ And I switch to the main window
diff --git a/question/type/match/tests/fixtures/testquestion.moodle.xml b/question/type/match/tests/fixtures/testquestion.moodle.xml
new file mode 100644
index 00000000000..abf3781c680
--- /dev/null
+++ b/question/type/match/tests/fixtures/testquestion.moodle.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+ $course$/Test questions
+
+
+
+
+
+
+
+ matching-001
+
+
+ Classify the animals.
+
+
+ General feedback.
+
+ 1.0000000
+ 0.3333333
+ 0
+ true
+
+ Well done!
+
+
+ Parts, but only parts, of your response are correct.
+
+
+ That is not right at all.
+
+
+
+ frog
+
+ amphibian
+
+
+
+ cat
+
+ mammal
+
+
+
+ newt
+
+ amphibian
+
+
+
+
+
+ insect
+
+
+
+
+
diff --git a/question/type/multichoice/tests/behat/add.feature b/question/type/multichoice/tests/behat/add.feature
new file mode 100644
index 00000000000..a883f28f31e
--- /dev/null
+++ b/question/type/multichoice/tests/behat/add.feature
@@ -0,0 +1,61 @@
+@qtype @qtype_multichoice
+Feature: Test creating a Multiple choice question
+ As a teacher
+ In order to test my students
+ I need to be able to create a Multiple choice question
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Create a Multiple choice question with multiple response
+ When I add a "Multiple choice" question filling the form with:
+ | Question name | Multi-choice-001 |
+ | Question text | Find the capital cities in Europe. |
+ | General feedback | Paris and London |
+ | One or multiple answers? | Multiple answers allowed |
+ | Choice 1 | Tokyo |
+ | Choice 2 | Spain |
+ | Choice 3 | London |
+ | Choice 4 | Barcelona |
+ | Choice 5 | Paris |
+ | id_fraction_0 | None |
+ | id_fraction_1 | None |
+ | id_fraction_2 | 50% |
+ | id_fraction_3 | None |
+ | id_fraction_4 | 50% |
+ | Hint 1 | First hint |
+ | Hint 2 | Second hint |
+ Then I should see "Multi-choice-001"
+
+ @javascript
+ Scenario: Create a Multiple choice question with single response
+ When I add a "Multiple choice" question filling the form with:
+ | Question name | Multi-choice-002 |
+ | Question text | Find the capital city of England. |
+ | General feedback | London is the capital city of England. |
+ | One or multiple answers? | One answer only |
+ | Choice 1 | Manchester |
+ | Choice 2 | Buckingham |
+ | Choice 3 | London |
+ | Choice 4 | Barcelona |
+ | Choice 5 | Paris |
+ | id_fraction_0 | None |
+ | id_fraction_1 | None |
+ | id_fraction_2 | 100% |
+ | id_fraction_3 | None |
+ | id_fraction_4 | None |
+ | Hint 1 | First hint |
+ | Hint 2 | Second hint |
+ Then I should see "Multi-choice-002"
diff --git a/question/type/multichoice/tests/behat/backup_and_restore.feature b/question/type/multichoice/tests/behat/backup_and_restore.feature
new file mode 100644
index 00000000000..a5e4bb66d2b
--- /dev/null
+++ b/question/type/multichoice/tests/behat/backup_and_restore.feature
@@ -0,0 +1,51 @@
+@qtype @qtype_multichoice
+Feature: Test duplicating a quiz containing a Multiple choice question
+ As a teacher
+ In order re-use my courses containing Multiple choice questions
+ I need to be able to backup and restore them
+
+ Background:
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | multichoice | Multi-choice-001 | two_of_four |
+ And the following "activities" exist:
+ | activity | name | course | idnumber |
+ | quiz | Test quiz | C1 | quiz1 |
+ And quiz "Test quiz" contains the following questions:
+ | Multi-choice-001 | 1 |
+ And I log in as "admin"
+ And I am on site homepage
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Backup and restore a course containing a Multiple choice question
+ When I backup "Course 1" course using this options:
+ | Confirmation | Filename | test_backup.mbz |
+ And I restore "test_backup.mbz" backup into a new course using this options:
+ | Schema | Course name | Course 2 |
+ And I navigate to "Question bank" node in "Course administration"
+ And I click on "Edit" "link" in the "Multi-choice-001" "table_row"
+ Then the following fields match these values:
+ | Question name | Multi-choice-001 |
+ | Question text | Which are the odd numbers? |
+ | General feedback | The odd numbers are One and Three. |
+ | Default mark | 1 |
+ | One or multiple answers? | Multiple answers allowed |
+ | Shuffle the choices? | 1 |
+ | Choice 1 | One |
+ | Choice 2 | Two |
+ | Choice 3 | Three |
+ | Choice 4 | Four |
+ | id_fraction_0 | 50% |
+ | id_fraction_1 | None |
+ | id_fraction_2 | 50% |
+ | id_fraction_3 | None |
+ | For any correct response | Well done! |
+ | For any partially correct response | Parts, but only parts, of your response are correct. |
+ | For any incorrect response | That is not right at all. |
diff --git a/question/type/multichoice/tests/behat/edit.feature b/question/type/multichoice/tests/behat/edit.feature
new file mode 100644
index 00000000000..be91edad76a
--- /dev/null
+++ b/question/type/multichoice/tests/behat/edit.feature
@@ -0,0 +1,46 @@
+@qtype @qtype_multichoice
+Feature: Test editing a Multiple choice question
+ As a teacher
+ In order to be able to update my Multiple choice question
+ I need to edit them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | multichoice | Multiple choice for editing | two_of_four |
+ | Test questions | multichoice | Single choice for editing | one_of_four |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Edit a Multiple choice question with multiple response (checkboxes)
+ When I click on "Edit" "link" in the "Multiple choice for editing" "table_row"
+ And I set the following fields to these values:
+ | Question name | |
+ And I press "id_submitbutton"
+ Then I should see "You must supply a value here."
+ When I set the following fields to these values:
+ | Question name | Edited Multiple choice name |
+ And I press "id_submitbutton"
+ Then I should see "Edited Multiple choice name"
+
+ @javascript
+ Scenario: Edit a Multiple choice question with single response (radio buttons)
+ When I click on "Edit" "link" in the "Single choice for editing" "table_row"
+ And I set the following fields to these values:
+ | Question name | Edited Single choice name |
+ And I press "id_submitbutton"
+ Then I should see "Edited Single choice name"
diff --git a/question/type/multichoice/tests/behat/export.feature b/question/type/multichoice/tests/behat/export.feature
new file mode 100644
index 00000000000..731c7ea54c8
--- /dev/null
+++ b/question/type/multichoice/tests/behat/export.feature
@@ -0,0 +1,37 @@
+@qtype @qtype_multichoice
+Feature: Test exporting Multiple choice questions
+ As a teacher
+ In order to be able to reuse my Multiple choice questions
+ I need to export them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | multichoice | Multi-choice-001 | two_of_four |
+ | Test questions | multichoice | Multi-choice-002 | one_of_four |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Export a Multiple choice question
+ When I navigate to "Export" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I press "Export questions to file"
+ Then following "click here" should download between "3750" and "3800" bytes
+ # If the download step is the last in the scenario then we can sometimes run
+ # into the situation where the download page causes a http redirect but behat
+ # has already conducted its reset (generating an error). By putting a logout
+ # step we avoid behat doing the reset until we are off that page.
+ And I log out
diff --git a/question/type/multichoice/tests/behat/import.feature b/question/type/multichoice/tests/behat/import.feature
new file mode 100644
index 00000000000..a241237c138
--- /dev/null
+++ b/question/type/multichoice/tests/behat/import.feature
@@ -0,0 +1,30 @@
+@qtype @qtype_multichoice
+Feature: Test importing Multiple choice questions
+ As a teacher
+ In order to reuse Multiple choice questions
+ I need to import them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript @_file_upload
+ Scenario: import Multiple choice question.
+ When I navigate to "Import" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I upload "question/type/multichoice/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
+ And I press "id_submitbutton"
+ Then I should see "Parsing questions from import file."
+ And I should see "Importing 1 questions from file"
+ And I should see "1. Find the capital cities in Europe."
+ And I press "Continue"
+ And I should see "Multi-choice-001"
diff --git a/question/type/multichoice/tests/behat/preview.feature b/question/type/multichoice/tests/behat/preview.feature
new file mode 100644
index 00000000000..10563c3b05e
--- /dev/null
+++ b/question/type/multichoice/tests/behat/preview.feature
@@ -0,0 +1,72 @@
+@qtype @qtype_multichoice
+Feature: Preview a Multiple choice question
+ As a teacher
+ In order to check my Multiple choice questions will work for students
+ I need to preview them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | multichoice | Multi-choice-001 | two_of_four |
+ | Test questions | multichoice | Multi-choice-002 | one_of_four |
+ Given I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Preview a question and submit a partially correct response.
+ When I click on "Preview" "link" in the "Multi-choice-001" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I click on "One" "checkbox"
+ And I click on "Two" "checkbox"
+ And I press "Check"
+ Then I should see "One is odd"
+ And I should see "Two is even"
+ And I should see "Mark 0.50 out of 1.00"
+ And I should see "Parts, but only parts, of your response are correct."
+ And I switch to the main window
+
+ @javascript
+ Scenario: Preview a question and submit a correct response.
+ When I click on "Preview" "link" in the "Multi-choice-001" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I click on "One" "checkbox"
+ And I click on "Three" "checkbox"
+ And I press "Check"
+ Then I should see "One is odd"
+ And I should see "Three is odd"
+ And I should see "Mark 1.00 out of 1.00"
+ And I should see "Well done!"
+ And I should see "The odd numbers are One and Three."
+ And I should see "The correct answer is: One, Three"
+ And I switch to the main window
+
+ @javascript
+ Scenario: Preview a question and submit a correct response.
+ When I click on "Preview" "link" in the "Multi-choice-002" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I click on "One" "radio"
+ And I press "Check"
+ Then I should see "The oddest number is One."
+ And I should see "Mark 1.00 out of 1.00"
+ And I should see "Well done!"
+ And I should see "The correct answer is: One"
+ And I switch to the main window
\ No newline at end of file
diff --git a/question/type/multichoice/tests/fixtures/testquestion.moodle.xml b/question/type/multichoice/tests/fixtures/testquestion.moodle.xml
new file mode 100644
index 00000000000..7edfdbf0001
--- /dev/null
+++ b/question/type/multichoice/tests/fixtures/testquestion.moodle.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+ $course$/Default for C1
+
+
+
+
+
+
+
+ Multi-choice-001
+
+
+ Find the capital cities in Europe.
+
+
+ Berlin, Paris and London
+
+ 1.0000000
+ 0.3333333
+ 0
+ false
+ true
+ abc
+
+ Your answer is correct.
+
+
+ Your answer is partially correct.
+
+
+ Your answer is incorrect.
+
+
+
+ Tokyo
+
+
+
+
+
+ Spain
+
+
+
+
+
+ London
+
+
+
+
+
+ Barcelona
+
+
+
+
+
+ Paris
+
+
+
+
+
+ First hint
+
+
+ Second hint
+
+
+
+
diff --git a/question/type/shortanswer/tests/behat/add.feature b/question/type/shortanswer/tests/behat/add.feature
new file mode 100644
index 00000000000..a61571dacf4
--- /dev/null
+++ b/question/type/shortanswer/tests/behat/add.feature
@@ -0,0 +1,35 @@
+@qtype @qtype_shortanswer
+Feature: Test creating a Short answer question
+ As a teacher
+ In order to test my students
+ I need to be able to create a Short answer question
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Create a Short answer question
+ When I add a "Short answer" question filling the form with:
+ | Question name | shortanswer-001 |
+ | Question text | What is the national langauge in France? |
+ | General feedback | The national langauge in France is French |
+ | Default mark | 1 |
+ | Case sensitivity | No, case is unimportant |
+ | id_answer_0 | French |
+ | id_fraction_0 | 100% |
+ | id_feedback_0 | Well done. French is correct. |
+ | id_answer_1 | * |
+ | id_fraction_1 | None |
+ | id_feedback_1 | Your answer is incorrect. |
+ Then I should see "shortanswer-001"
diff --git a/question/type/shortanswer/tests/behat/backup_and_restore.feature b/question/type/shortanswer/tests/behat/backup_and_restore.feature
new file mode 100644
index 00000000000..11d7fa7999f
--- /dev/null
+++ b/question/type/shortanswer/tests/behat/backup_and_restore.feature
@@ -0,0 +1,48 @@
+@qtype @qtype_short asnswer
+Feature: Test duplicating a quiz containing a Short answer question
+ As a teacher
+ In order re-use my courses containing Short answer questions
+ I need to be able to backup and restore them
+
+ Background:
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | shortanswer | shortanswer-001 | frogtoad |
+ And the following "activities" exist:
+ | activity | name | course | idnumber |
+ | quiz | Test quiz | C1 | quiz1 |
+ And quiz "Test quiz" contains the following questions:
+ | shortanswer-001 | 1 |
+ And I log in as "admin"
+ And I am on site homepage
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Backup and restore a course containing a Short answer question
+ When I backup "Course 1" course using this options:
+ | Confirmation | Filename | test_backup.mbz |
+ And I restore "test_backup.mbz" backup into a new course using this options:
+ | Schema | Course name | Course 2 |
+ And I navigate to "Question bank" node in "Course administration"
+ And I click on "Edit" "link" in the "shortanswer-001" "table_row"
+ Then the following fields match these values:
+ | Question name | shortanswer-001 |
+ | Question text | Name an amphibian: __________ |
+ | General feedback | Generalfeedback: frog or toad would have been OK. |
+ | Default mark | 1 |
+ | Case sensitivity | No, case is unimportant |
+ | id_answer_0 | frog |
+ | id_fraction_0 | 100% |
+ | id_feedback_0 | Frog is a very good answer. |
+ | id_answer_1 | toad |
+ | id_fraction_1 | 80% |
+ | id_feedback_1 | Toad is an OK good answer. |
+ | id_answer_2 | * |
+ | id_fraction_2 | None |
+ | id_feedback_2 | That is a bad answer. |
diff --git a/question/type/shortanswer/tests/behat/edit.feature b/question/type/shortanswer/tests/behat/edit.feature
new file mode 100644
index 00000000000..6dd528aa11a
--- /dev/null
+++ b/question/type/shortanswer/tests/behat/edit.feature
@@ -0,0 +1,56 @@
+@qtype @qtype_shortanswer
+Feature: Test editing a Short answer question
+ As a teacher
+ In order to be able to update my Short answer question
+ I need to edit them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | shortanswer | shortanswer-001 for editing | frogtoad |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Edit a Short answer question
+ When I click on "Edit" "link" in the "shortanswer-001 for editing" "table_row"
+ And I set the following fields to these values:
+ | Question name | |
+ And I press "id_submitbutton"
+ Then I should see "You must supply a value here."
+ When I set the following fields to these values:
+ | Question name | Edited shortanswer-001 name |
+ And I press "id_submitbutton"
+ Then I should see "Edited shortanswer-001 name"
+ When I click on "Edit" "link" in the "Edited shortanswer-001 name" "table_row"
+ And I set the following fields to these values:
+ | id_answer_1 | newt |
+ | id_fraction_1 | 70% |
+ | id_feedback_1 | Newt is an OK good answer. |
+ And I press "id_submitbutton"
+ Then I should see "Edited shortanswer-001 name"
+ When I click on "Preview" "link" in the "Edited shortanswer-001 name" "table_row"
+ And I switch to "questionpreview" window
+ Then I should see "Name an amphibian:"
+ # Set behaviour options
+ And I set the following fields to these values:
+ | behaviour | immediatefeedback |
+ And I press "Start again with these options"
+ And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "newt"
+ And I press "Check"
+ Then I should see "Newt is an OK good answer."
+ And I should see "Generalfeedback: frog or toad would have been OK."
+ And I should see "The correct answer is: frog"
diff --git a/question/type/shortanswer/tests/behat/export.feature b/question/type/shortanswer/tests/behat/export.feature
new file mode 100644
index 00000000000..1722cfff1d1
--- /dev/null
+++ b/question/type/shortanswer/tests/behat/export.feature
@@ -0,0 +1,36 @@
+@qtype @qtype_shortanswer
+Feature: Test exporting Short answer questions
+ As a teacher
+ In order to be able to reuse my Short answer questions
+ I need to export them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | shortanswer | shortanswer-001 | frogtoad |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Export a Short answer question
+ When I navigate to "Export" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I press "Export questions to file"
+ Then following "click here" should download between "1200" and "1300" bytes
+ # If the download step is the last in the scenario then we can sometimes run
+ # into the situation where the download page causes a http redirect but behat
+ # has already conducted its reset (generating an error). By putting a logout
+ # step we avoid behat doing the reset until we are off that page.
+ And I log out
diff --git a/question/type/shortanswer/tests/behat/import.feature b/question/type/shortanswer/tests/behat/import.feature
new file mode 100644
index 00000000000..c13649a5559
--- /dev/null
+++ b/question/type/shortanswer/tests/behat/import.feature
@@ -0,0 +1,30 @@
+@qtype @qtype_shortanswer
+Feature: Test importing Short answer questions
+ As a teacher
+ In order to reuse Short answer questions
+ I need to import them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript @_file_upload
+ Scenario: import Matching question.
+ When I navigate to "Import" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I upload "question/type/shortanswer/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
+ And I press "id_submitbutton"
+ Then I should see "Parsing questions from import file."
+ And I should see "Importing 1 questions from file"
+ And I should see "1. Name an amphibian: __________"
+ And I press "Continue"
+ And I should see "shortanswer-001"
diff --git a/question/type/shortanswer/tests/behat/preview.feature b/question/type/shortanswer/tests/behat/preview.feature
new file mode 100644
index 00000000000..a9b6ebc4ec1
--- /dev/null
+++ b/question/type/shortanswer/tests/behat/preview.feature
@@ -0,0 +1,71 @@
+@qtype @qtype_shortanswer
+Feature: Preview a Short answer question
+ As a teacher
+ In order to check my Short answer questions will work for students
+ I need to preview them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | shortanswer | shortanswer-001 | frogtoad |
+ Given I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+
+ @javascript
+ Scenario: Preview a Short answer question with correct answer
+ When I click on "Preview" "link" in the "shortanswer-001" "table_row"
+ And I switch to "questionpreview" window
+ Then I should see "Name an amphibian:"
+ # Set behaviour options
+ And I set the following fields to these values:
+ | behaviour | immediatefeedback |
+ And I press "Start again with these options"
+ And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "frog"
+ And I press "Check"
+ Then I should see "Frog is a very good answer."
+ And I should see "Generalfeedback: frog or toad would have been OK."
+ And I should see "The correct answer is: frog"
+
+ @javascript
+ Scenario: Preview a Short answer question with almost correct answer
+ When I click on "Preview" "link" in the "shortanswer-001" "table_row"
+ And I switch to "questionpreview" window
+ Then I should see "Name an amphibian:"
+ # Set behaviour options
+ And I set the following fields to these values:
+ | behaviour | immediatefeedback |
+ And I press "Start again with these options"
+ And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "toad"
+ And I press "Check"
+ Then I should see "Toad is an OK good answer."
+ And I should see "Generalfeedback: frog or toad would have been OK."
+ And I should see "The correct answer is: frog"
+
+ @javascript
+ Scenario: Preview a Short answer question with incorrect answer
+ When I click on "Preview" "link" in the "shortanswer-001" "table_row"
+ And I switch to "questionpreview" window
+ Then I should see "Name an amphibian:"
+ # Set behaviour options
+ And I set the following fields to these values:
+ | behaviour | immediatefeedback |
+ And I press "Start again with these options"
+ And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "cat"
+ And I press "Check"
+ Then I should see "That is a bad answer."
+ And I should see "Generalfeedback: frog or toad would have been OK."
+ And I should see "The correct answer is: frog"
diff --git a/question/type/shortanswer/tests/fixtures/testquestion.moodle.xml b/question/type/shortanswer/tests/fixtures/testquestion.moodle.xml
new file mode 100644
index 00000000000..47790343a3b
--- /dev/null
+++ b/question/type/shortanswer/tests/fixtures/testquestion.moodle.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+ $course$/Test questions
+
+
+
+
+
+
+
+ shortanswer-001
+
+
+ Name an amphibian: __________
+
+
+ Generalfeedback: frog or toad would have been OK.
+
+ 1.0000000
+ 0.0000000
+ 0
+ 0
+
+ frog
+
+ Frog is a very good answer.
+
+
+
+ toad
+
+ Toad is an OK good answer.
+
+
+
+ *
+
+ That is a bad answer.
+
+
+
+
+
diff --git a/question/type/truefalse/tests/behat/add.feature b/question/type/truefalse/tests/behat/add.feature
new file mode 100644
index 00000000000..8e0750b113a
--- /dev/null
+++ b/question/type/truefalse/tests/behat/add.feature
@@ -0,0 +1,43 @@
+@qtype @qtype_truefalse
+Feature: Test creating a True/False question
+ As a teacher
+ In order to test my students
+ I need to be able to create a True/False question
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Create a True/False question with Correct answer as False
+ When I add a "True/False" question filling the form with:
+ | Question name | true-false-001 |
+ | Question text | Manchester is the capital city of England. |
+ | Default mark | 1 |
+ | General feedback | London is the capital city of England. |
+ | Correct answer | False |
+ | Feedback for the response 'True'. | Well done! |
+ | Feedback for the response 'False'. | Read more about England. |
+ Then I should see "true-false-001"
+
+ @javascript
+ Scenario: Create a True/False question with Correct answer as True
+ When I add a "True/False" question filling the form with:
+ | Question name | true-false-002 |
+ | Question text | London is the capital city of England. |
+ | Default mark | 1 |
+ | General feedback | London is the capital city of England. |
+ | Correct answer | True |
+ | Feedback for the response 'True'. | Well done! |
+ | Feedback for the response 'False'. | Read more about England. |
+ Then I should see "true-false-002"
diff --git a/question/type/truefalse/tests/behat/backup_and_restore.feature b/question/type/truefalse/tests/behat/backup_and_restore.feature
new file mode 100644
index 00000000000..4779062332a
--- /dev/null
+++ b/question/type/truefalse/tests/behat/backup_and_restore.feature
@@ -0,0 +1,41 @@
+@qtype @qtype_truefalse
+Feature: Test duplicating a quiz containing a True/False question
+ As a teacher
+ In order re-use my courses containing True/False questions
+ I need to be able to backup and restore them
+
+ Background:
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | truefalse | true-false-001 | true |
+ And the following "activities" exist:
+ | activity | name | course | idnumber |
+ | quiz | Test quiz | C1 | quiz1 |
+ And quiz "Test quiz" contains the following questions:
+ | true-false-001 | 1 |
+ And I log in as "admin"
+ And I am on site homepage
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Backup and restore a course containing a True/False question
+ When I backup "Course 1" course using this options:
+ | Confirmation | Filename | test_backup.mbz |
+ And I restore "test_backup.mbz" backup into a new course using this options:
+ | Schema | Course name | Course 2 |
+ And I navigate to "Question bank" node in "Course administration"
+ And I click on "Edit" "link" in the "true-false-001" "table_row"
+ Then the following fields match these values:
+ | Question name | true-false-001 |
+ | Question text | The answer is true. |
+ | Default mark | 1 |
+ | General feedback | You should have selected true. |
+ | Correct answer | True |
+ | Feedback for the response 'True'. | This is the right answer. |
+ | Feedback for the response 'False'. | This is the wrong answer. |
diff --git a/question/type/truefalse/tests/behat/edit.feature b/question/type/truefalse/tests/behat/edit.feature
new file mode 100644
index 00000000000..71313710ca4
--- /dev/null
+++ b/question/type/truefalse/tests/behat/edit.feature
@@ -0,0 +1,37 @@
+@qtype @qtype_truefalse
+Feature: Test editing a True/False question
+ As a teacher
+ In order to be able to update my True/False question
+ I need to edit them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | truefalse | true-false-001 | true |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Edit a True/False question
+ When I click on "Edit" "link" in the "true-false-001" "table_row"
+ And I set the following fields to these values:
+ | Question name | |
+ And I press "id_submitbutton"
+ Then I should see "You must supply a value here."
+ When I set the following fields to these values:
+ | Question name | Edited true-false-001 name |
+ And I press "id_submitbutton"
+ Then I should see "Edited true-false-001 name"
diff --git a/question/type/truefalse/tests/behat/export.feature b/question/type/truefalse/tests/behat/export.feature
new file mode 100644
index 00000000000..a80ec25ee69
--- /dev/null
+++ b/question/type/truefalse/tests/behat/export.feature
@@ -0,0 +1,36 @@
+@qtype @qtype_truefalse
+Feature: Test exporting True/False questions
+ As a teacher
+ In order to be able to reuse my True/false questions
+ I need to export them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | truefalse | true-false-001 | true |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript
+ Scenario: Export a True/False question
+ When I navigate to "Export" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I press "Export questions to file"
+ Then following "click here" should download between "950" and "1050" bytes
+ # If the download step is the last in the scenario then we can sometimes run
+ # into the situation where the download page causes a http redirect but behat
+ # has already conducted its reset (generating an error). By putting a logout
+ # step we avoid behat doing the reset until we are off that page.
+ And I log out
diff --git a/question/type/truefalse/tests/behat/import.feature b/question/type/truefalse/tests/behat/import.feature
new file mode 100644
index 00000000000..dd6c183d3e5
--- /dev/null
+++ b/question/type/truefalse/tests/behat/import.feature
@@ -0,0 +1,30 @@
+@qtype @qtype_truefalse
+Feature: Test importing True/False questions
+ As a teacher
+ In order to reuse True/False questions
+ I need to import them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "teacher1"
+ And I follow "Course 1"
+
+ @javascript @_file_upload
+ Scenario: import a True/False question.
+ When I navigate to "Import" node in "Course administration > Question bank"
+ And I set the field "id_format_xml" to "1"
+ And I upload "question/type/truefalse/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
+ And I press "id_submitbutton"
+ Then I should see "Parsing questions from import file."
+ And I should see "Importing 1 questions from file"
+ And I should see "The answer is true."
+ And I press "Continue"
+ And I should see "true-false-001"
diff --git a/question/type/truefalse/tests/behat/preview.feature b/question/type/truefalse/tests/behat/preview.feature
new file mode 100644
index 00000000000..32190e35351
--- /dev/null
+++ b/question/type/truefalse/tests/behat/preview.feature
@@ -0,0 +1,50 @@
+@qtype @qtype_truefalse
+Feature: Preview a Trtue/False question
+ As a teacher
+ In order to check my True/False questions will work for students
+ I need to preview them
+
+ Background:
+ Given the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
+ And the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And the following "question categories" exist:
+ | contextlevel | reference | name |
+ | Course | C1 | Test questions |
+ And the following "questions" exist:
+ | questioncategory | qtype | name | template |
+ | Test questions | truefalse | true-false-001 | true |
+ Given I log in as "teacher1"
+ And I follow "Course 1"
+ And I navigate to "Question bank" node in "Course administration"
+
+ @javascript
+ Scenario: Preview a question and submit a correct response.
+ When I click on "Preview" "link" in the "true-false-001" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I click on "True" "radio"
+ And I press "Check"
+ And I should see "This is the right answer."
+ And I should see "The correct answer is 'True'."
+ And I switch to the main window
+
+ @javascript
+ Scenario: Preview a question and submit an incorrect response.
+ When I click on "Preview" "link" in the "true-false-001" "table_row"
+ And I switch to "questionpreview" window
+ And I set the field "How questions behave" to "Immediate feedback"
+ And I press "Start again with these options"
+ And I click on "False" "radio"
+ And I press "Check"
+ And I should see "This is the wrong answer."
+ And I should see "You should have selected true."
+ And I should see "The correct answer is 'True'."
+ And I switch to the main window
diff --git a/question/type/truefalse/tests/fixtures/testquestion.moodle.xml b/question/type/truefalse/tests/fixtures/testquestion.moodle.xml
new file mode 100644
index 00000000000..9404aa43f74
--- /dev/null
+++ b/question/type/truefalse/tests/fixtures/testquestion.moodle.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ $course$/Test questions
+
+
+
+
+
+
+
+ true-false-001
+
+
+ The answer is true.
+
+
+ You should have selected true.
+
+ 1.0000000
+ 1.0000000
+ 0
+
+ true
+
+ This is the right answer.
+
+
+
+ false
+
+ This is the wrong answer.
+
+
+
+
+