Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_quiz @core @core_badges @core_completion @javascript
2
Feature: Award badges based on activity completion
3
  In order to ensure a student has learned the material before being marked complete
4
  As a teacher
5
  I need to configure an activity to grant a badge only when the student achieves a passing grade upon completion.
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | student1 | Student   | 1        | student1@example.com |
11
      | student2 | Student   | 2        | student2@example.com |
12
      | teacher1 | Teacher   | 1        | teacher1@example.com |
13
    And the following "courses" exist:
14
      | fullname | shortname | category | enablecompletion |
15
      | Course 1 | C1        | 0        | 1                |
16
    And the following "course enrolments" exist:
17
      | user     | course | role           |
18
      | teacher1 | C1     | editingteacher |
19
      | student1 | C1     | student        |
20
      | student2 | C1     | student        |
21
    And the following "question categories" exist:
22
      | contextlevel | reference | name           |
23
      | Course       | C1        | Test questions |
24
    And the following "questions" exist:
25
      | questioncategory | qtype     | name           | questiontext              |
26
      | Test questions   | truefalse | First question | Answer the first question |
27
    And the following "activities" exist:
28
      | activity   | name             | course | idnumber | attempts | gradepass | completion | completionpassgrade | completionusegrade |
29
      | quiz       | Test quiz name 1 | C1     | quiz1    | 2        | 5.00      | 2          | 1                   | 1                  |
30
      | quiz       | Test quiz name 2 | C1     | quiz2    | 2        | 5.00      | 2          | 0                   | 1                  |
31
    And quiz "Test quiz name 1" contains the following questions:
32
      | question       | page |
33
      | First question | 1    |
34
    And quiz "Test quiz name 2" contains the following questions:
35
      | question       | page |
36
      | First question | 1    |
37
    And the following "core_badges > Badge" exists:
38
      | name        | Course Badge 1               |
39
      | status      | 0                            |
40
      | type        | 2                            |
41
      | course      | C1                           |
42
      | description | Course badge 1 description   |
43
      | image       | badges/tests/behat/badge.png |
44
    And the following "core_badges > Badge" exists:
45
      | name        | Course Badge 2               |
46
      | status      | 0                            |
47
      | type        | 2                            |
48
      | course      | C1                           |
49
      | description | Course badge 2 description   |
50
      | image       | badges/tests/behat/badge.png |
51
    And I am on the "Course 1" course page logged in as teacher1
52
 
53
  Scenario: Student does not earn a badge using activity completion when does not get passing grade
54
    Given I navigate to "Badges" in current page administration
55
    And I follow "Course Badge 1"
56
    And I select "Criteria" from the "jump" singleselect
57
    And I set the field "type" to "Activity completion"
58
    And I set the field "Quiz - Test quiz name 1" to "1"
59
    And I press "Save"
60
    And I press "Enable access"
1441 ariadna 61
    And I click on "Enable" "button" in the "Confirm" "dialogue"
1 efrain 62
    And I should see "Recipients (0)"
63
    # Pass grade for student1. Activity is considered complete because student1 got a passing grade.
64
    And user "student1" has attempted "Test quiz name 1" with responses:
65
      | slot | response |
66
      | 1    | True     |
67
    # Fail grade for student2. Activity is considered incomplete because student2 got a failing grade.
68
    And user "student2" has attempted "Test quiz name 1" with responses:
69
      | slot | response |
70
      | 1    | False    |
1441 ariadna 71
    And I navigate to "Badges" in current page administration
1 efrain 72
    And I follow "Course Badge 1"
73
    Then I should see "Recipients (1)"
74
    And I select "Recipients (1)" from the "jump" singleselect
75
    And I should see "Student 1"
76
    And I should not see "Student 2"
77
 
78
  Scenario: Students with any grades in an activity will receive a badge if the completion condition is set to receive any grade
79
    Given I navigate to "Badges" in current page administration
80
    And I follow "Course Badge 2"
81
    And I select "Criteria" from the "jump" singleselect
82
    And I set the field "type" to "Activity completion"
83
    And I set the field "Quiz - Test quiz name 2" to "1"
84
    And I press "Save"
85
    And I press "Enable access"
1441 ariadna 86
    And I click on "Enable" "button" in the "Confirm" "dialogue"
1 efrain 87
    # Pass grade for student1.
88
    And user "student1" has attempted "Test quiz name 2" with responses:
89
      | slot | response |
90
      | 1    | True     |
91
    # Fail grade for student2. Activity is considered complete even if student2 got a failing grade.
92
    And user "student2" has attempted "Test quiz name 2" with responses:
93
      | slot | response |
94
      | 1    | False    |
1441 ariadna 95
    And I navigate to "Badges" in current page administration
1 efrain 96
    And I follow "Course Badge 2"
97
    Then I should see "Recipients (2)"
98
    And I select "Recipients (2)" from the "jump" singleselect
99
    And I should see "Student 1"
100
    And I should see "Student 2"
101
 
102
  Scenario: Previously graded pass/fail students should earn a badge after enabling a badge
103
    # Pass grade for student1.
104
    Given user "student1" has attempted "Test quiz name 1" with responses:
105
      | slot | response |
106
      | 1    | True     |
107
    # Fail grade for student2.
108
    And user "student2" has attempted "Test quiz name 1" with responses:
109
      | slot | response |
110
      | 1    | False    |
111
    And I navigate to "Badges" in current page administration
112
    And I follow "Course Badge 1"
113
    And I select "Criteria" from the "jump" singleselect
114
    And I set the field "type" to "Activity completion"
115
    And I set the field "Quiz - Test quiz name 1" to "1"
116
    And I press "Save"
117
    # Enable badge access once students have completed the activity.
118
    When I press "Enable access"
1441 ariadna 119
    And I click on "Enable" "button" in the "Confirm" "dialogue"
1 efrain 120
    # Only student1 should earn the badge because student2 did not pass the quiz.
121
    Then I should see "Recipients (1)"
122
    And I select "Recipients (1)" from the "jump" singleselect
123
    And I should see "Student 1"
124
    And I should not see "Student 2"