aboutsummaryrefslogtreecommitdiff
path: root/tests/behat
diff options
context:
space:
mode:
Diffstat (limited to 'tests/behat')
-rw-r--r--tests/behat/add.feature36
-rw-r--r--tests/behat/import.feature30
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/behat/add.feature b/tests/behat/add.feature
new file mode 100644
index 0000000..4b7319f
--- /dev/null
+++ b/tests/behat/add.feature
@@ -0,0 +1,36 @@
+@qtype @qtype_algebra
+Feature: Test creating an Algebra question
+ As a teacher
+ In order to test my students
+ I need to be able to create an Algebra 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 am on "Course 1" course homepage
+ And I navigate to "Question bank" node in "Course administration"
+
+ Scenario: Create an Algebra question
+ When I add a "Algebra" question filling the form with:
+ | Question name | algebra-001 |
+ | Question text | What is the derivative of f(x) = x^2 ? |
+ | General feedback | The correct answer is 2*x |
+ | Default mark | 1 |
+ | id_variable_0 | x |
+ | id_varmin_0 | -5 |
+ | id_varmax_0 | 5 |
+ | id_answer_0 | 2*x |
+ | id_fraction_0 | 100% |
+ | id_feedback_0 | Well done. 2*x is correct. |
+ | id_answer_1 | * |
+ | id_fraction_1 | None |
+ | id_feedback_1 | Your answer is incorrect. |
+ Then I should see "algebra-001"
diff --git a/tests/behat/import.feature b/tests/behat/import.feature
new file mode 100644
index 0000000..8e43aff
--- /dev/null
+++ b/tests/behat/import.feature
@@ -0,0 +1,30 @@
+@qtype @qtype_algebra
+Feature: Test importing Algebra questions
+ As a teacher
+ In order to reuse Algebra 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 am on "Course 1" course homepage
+
+ @javascript @_file_upload
+ Scenario: import Algebra 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/algebra/tests/fixtures/qtype_sample_algebra.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. What is the derivative of the function \(f(x) = x^2\) ?"
+ And I press "Continue"
+ And I should see "Derive"