source: moodle/trunk/fuentes/grade/tests/behat/grade_natural_normalisation.feature

Last change on this file was 1331, checked in by jrpelegrina, 3 years ago

Updated to moodle 3.0.3

File size: 14.0 KB
Line 
1@core @core_grades
2Feature: We can use natural aggregation and weights will be normalised to a total of one hundred
3  In order to override weights
4  As a teacher
5  I need to add assessments to the gradebook.
6
7  Background:
8    Given the following "courses" exist:
9      | fullname | shortname | category | groupmode |
10      | Course 1 | C1 | 0 | 1 |
11    And the following "users" exist:
12      | username | firstname | lastname | email | idnumber |
13      | teacher1 | Teacher | 1 | teacher1@example.com | t1 |
14      | student1 | Student | 1 | student1@example.com | s1 |
15    And the following "course enrolments" exist:
16      | user | course | role |
17      | teacher1 | C1 | editingteacher |
18      | student1 | C1 | student |
19    And the following "grade categories" exist:
20      | fullname | course |
21      | Sub category 1 | C1 |
22    And the following "activities" exist:
23      | activity | course | idnumber | name | intro | grade |
24      | assign | C1 | a1 | Test assignment one | Submit something! | 300 |
25      | assign | C1 | a2 | Test assignment two | Submit something! | 100 |
26      | assign | C1 | a3 | Test assignment three | Submit something! | 150 |
27      | assign | C1 | a4 | Test assignment four | Submit nothing! | 150 |
28    And the following "activities" exist:
29      | activity | course | idnumber | name | intro | gradecategory | grade |
30      | assign | C1 | a5 | Test assignment five | Submit something! | Sub category 1 | 20 |
31      | assign | C1 | a6 | Test assignment six | Submit something! | Sub category 1 | 10 |
32      | assign | C1 | a7 | Test assignment seven | Submit nothing! | Sub category 1 | 15 |
33    And I log in as "teacher1"
34    And I follow "Course 1"
35    And I navigate to "Grades" node in "Course administration"
36    And I set the field "Grade report" to "Gradebook setup"
37
38  @javascript
39  Scenario: Setting all weights in a category to exactly one hundred in total.
40
41    And the field "Weight of Test assignment five" matches value "44.444"
42    And the field "Weight of Test assignment six" matches value "22.222"
43    And the field "Weight of Test assignment seven" matches value "33.333"
44    When I set the field "Override weight of Test assignment five" to "1"
45    And I set the field "Override weight of Test assignment six" to "1"
46    And I set the field "Override weight of Test assignment seven" to "1"
47    And I set the field "Weight of Test assignment five" to "30"
48    And I set the field "Weight of Test assignment six" to "50"
49    And I set the field "Weight of Test assignment seven" to "20"
50    And I press "Save changes"
51
52    Then I should not see "Your weights have been adjusted to total 100."
53    And the field "Weight of Test assignment five" matches value "30.0"
54    And the field "Weight of Test assignment six" matches value "50.0"
55    And the field "Weight of Test assignment seven" matches value "20.0"
56
57  @javascript
58  Scenario: Setting all weights in a category to less than one hundred is normalised.
59
60    When I set the field "Override weight of Test assignment five" to "1"
61    And I set the field "Override weight of Test assignment six" to "1"
62    And I set the field "Override weight of Test assignment seven" to "1"
63    And I set the field "Weight of Test assignment five" to "1"
64    And I set the field "Weight of Test assignment six" to "1"
65    And I set the field "Weight of Test assignment seven" to "2"
66    And I press "Save changes"
67
68    Then I should see "Your weights have been adjusted to total 100."
69    And the field "Weight of Test assignment five" matches value "25.0"
70    And the field "Weight of Test assignment six" matches value "25.0"
71    And the field "Weight of Test assignment seven" matches value "50.0"
72
73  @javascript
74  Scenario: Set one of the grade item weights to a figure over one hundred.
75
76    When I set the field "Override weight of Test assignment five" to "1"
77    And I set the field "Weight of Test assignment five" to "120"
78    And I press "Save changes"
79
80    Then I should see "Your weights have been adjusted to total 100."
81    And the field "Weight of Test assignment five" matches value "100.0"
82    And the field "Weight of Test assignment six" matches value "0.0"
83    And the field "Weight of Test assignment seven" matches value "0.0"
84
85  @javascript
86  Scenario: Setting several but not all grade item weights to over one hundred each.
87
88    When I set the field "Override weight of Test assignment five" to "1"
89    And I set the field "Override weight of Test assignment six" to "1"
90    And I set the field "Weight of Test assignment five" to "150"
91    And I set the field "Weight of Test assignment six" to "150"
92    And I press "Save changes"
93
94    Then I should see "Your weights have been adjusted to total 100."
95    And the field "Weight of Test assignment five" matches value "50.000"
96    And the field "Weight of Test assignment six" matches value "50.000"
97    And the field "Weight of Test assignment seven" matches value "0.0"
98
99  @javascript
100  Scenario: Grade items weights are not normalised when all grade item weights are overridden (sum exactly 100). Extra credit is set respectful to number of items.
101
102    When I set the following settings for grade item "Test assignment seven":
103      | Extra credit | 1 |
104    And the field "Weight of Test assignment five" matches value "66.667"
105    And the field "Weight of Test assignment six" matches value "33.333"
106    And the field "Weight of Test assignment seven" matches value "50.0"
107    And I set the field "Override weight of Test assignment five" to "1"
108    And I set the field "Override weight of Test assignment six" to "1"
109    And I set the field "Weight of Test assignment five" to "60"
110    And I set the field "Weight of Test assignment six" to "40"
111    And I press "Save changes"
112
113    Then I should not see "Your weights have been adjusted to total 100."
114    And the field "Weight of Test assignment five" matches value "60.000"
115    And the field "Weight of Test assignment six" matches value "40.000"
116    And the field "Weight of Test assignment seven" matches value "50.0"
117    And I reset weights for grade category "Sub category 1"
118    And the field "Weight of Test assignment five" matches value "66.667"
119    And the field "Weight of Test assignment six" matches value "33.333"
120    And the field "Weight of Test assignment seven" matches value "50.0"
121
122  @javascript
123  Scenario: Grade items weights are normalised when all grade item weights are overridden (sum over 100). Extra credit is set respectful to number of items.
124
125    When I set the following settings for grade item "Test assignment seven":
126      | Extra credit | 1 |
127    And I set the field "Override weight of Test assignment five" to "1"
128    And I set the field "Override weight of Test assignment six" to "1"
129    And I set the field "Weight of Test assignment five" to "60"
130    And I set the field "Weight of Test assignment six" to "50"
131    And I press "Save changes"
132
133    Then I should see "Your weights have been adjusted to total 100."
134    And the field "Weight of Test assignment five" matches value "54.545"
135    And the field "Weight of Test assignment six" matches value "45.455"
136    And the field "Weight of Test assignment seven" matches value "50.0"
137    And I reset weights for grade category "Sub category 1"
138    And the field "Weight of Test assignment five" matches value "66.667"
139    And the field "Weight of Test assignment six" matches value "33.333"
140    And the field "Weight of Test assignment seven" matches value "50.0"
141
142  @javascript
143  Scenario: Grade items weights are normalised when all grade item weights are overridden (sum under 100). Extra credit is set respectful to number of items.
144
145    When I set the following settings for grade item "Test assignment seven":
146      | Extra credit | 1 |
147    And I set the field "Override weight of Test assignment five" to "1"
148    And I set the field "Override weight of Test assignment six" to "1"
149    And I set the field "Weight of Test assignment five" to "40"
150    And I set the field "Weight of Test assignment six" to "30"
151    And I press "Save changes"
152
153    Then I should see "Your weights have been adjusted to total 100."
154    And the field "Weight of Test assignment five" matches value "57.143"
155    And the field "Weight of Test assignment six" matches value "42.857"
156    And the field "Weight of Test assignment seven" matches value "50.0"
157    And I reset weights for grade category "Sub category 1"
158    And the field "Weight of Test assignment five" matches value "66.667"
159    And the field "Weight of Test assignment six" matches value "33.333"
160    And the field "Weight of Test assignment seven" matches value "50.0"
161
162  @javascript
163  Scenario: Grade items weights are normalised when not all grade item weights are overridden. Extra credit is set respectful to number of items.
164
165    When I set the following settings for grade item "Test assignment seven":
166      | Extra credit | 1 |
167    And I set the field "Override weight of Test assignment five" to "1"
168    And I set the field "Weight of Test assignment five" to "40"
169    And I press "Save changes"
170
171    Then I should see "Your weights have been adjusted to total 100."
172    And the field "Weight of Test assignment five" matches value "40.00"
173    And the field "Weight of Test assignment six" matches value "60.000"
174    And the field "Weight of Test assignment seven" matches value "50.0"
175    And I reset weights for grade category "Sub category 1"
176    And the field "Weight of Test assignment five" matches value "66.667"
177    And the field "Weight of Test assignment six" matches value "33.333"
178    And the field "Weight of Test assignment seven" matches value "50.0"
179
180  @javascript
181  Scenario: The extra credit grade item weight is overridden to a figure over one hundred and then
182  the grade item is set to normal.
183
184    When I set the following settings for grade item "Test assignment seven":
185      | Extra credit | 1 |
186    And I set the field "Override weight of Test assignment seven" to "1"
187    And I set the field "Weight of Test assignment seven" to "105"
188    And I press "Save changes"
189    Then I should not see "Your weights have been adjusted to total 100."
190    And the field "Weight of Test assignment five" matches value "66.667"
191    And the field "Weight of Test assignment six" matches value "33.333"
192    And the field "Weight of Test assignment seven" matches value "105.0"
193    When I set the following settings for grade item "Test assignment seven":
194      | Extra credit | 0 |
195    And I should see "Your weights have been adjusted to total 100."
196
197    And the field "Weight of Test assignment five" matches value "0.0"
198    And the field "Weight of Test assignment six" matches value "0.0"
199    And the field "Weight of Test assignment seven" matches value "100.0"
200
201  @javascript
202  Scenario: The extra credit grade item weight is overridden to a figure over one hundred and then
203  the grade category is reset.
204
205    When I set the following settings for grade item "Test assignment seven":
206      | Extra credit | 1 |
207    And I set the field "Override weight of Test assignment seven" to "1"
208    And I set the field "Weight of Test assignment seven" to "105"
209    And I press "Save changes"
210
211    And I reset weights for grade category "Sub category 1"
212    And the field "Weight of Test assignment five" matches value "66.667"
213    And the field "Weight of Test assignment six" matches value "33.333"
214    And the field "Weight of Test assignment seven" matches value "50.0"
215
216  @javascript
217  Scenario: Two out of three grade items weights are overridden and one is not.
218  The overridden grade item weights total over one hundred.
219
220    Given I set the field "Override weight of Test assignment six" to "1"
221    And I set the field "Override weight of Test assignment seven" to "1"
222    And I set the field "Weight of Test assignment six" to "55"
223    And I set the field "Weight of Test assignment seven" to "65"
224    And I press "Save changes"
225    And I should see "Your weights have been adjusted to total 100."
226
227    Then the field "Weight of Test assignment five" matches value "0.0"
228    And the field "Weight of Test assignment six" matches value "45.833"
229    And the field "Weight of Test assignment seven" matches value "54.167"
230
231  @javascript
232  Scenario: With one grade item set as extra credit, when I reset the weights for a category they return to the natural weights.
233
234  When I set the following settings for grade item "Test assignment five":
235    | Extra credit | 1 |
236  And I set the field "Override weight of Test assignment six" to "1"
237  And I set the field "Override weight of Test assignment seven" to "1"
238  And I set the field "Weight of Test assignment six" to "55"
239  And I set the field "Weight of Test assignment seven" to "40"
240  And I press "Save changes"
241  And I reset weights for grade category "Sub category 1"
242  Then the field "Weight of Test assignment five" matches value "80.0"
243  And the field "Weight of Test assignment six" matches value "40.0"
244  And the field "Weight of Test assignment seven" matches value "60.0"
245
246  @javascript
247  Scenario: Overriding a grade item with a negative value results in the value being changed to zero.
248
249  When I set the field "Override weight of Test assignment five" to "1"
250  And I set the field "Weight of Test assignment five" to "-15"
251  And I press "Save changes"
252  Then the field "Weight of Test assignment five" matches value "0.0"
253  And the field "Weight of Test assignment six" matches value "40.0"
254  And the field "Weight of Test assignment seven" matches value "60.0"
255  And I set the field "Override weight of Test assignment six" to "1"
256  And I set the field "Weight of Test assignment six" to "-25"
257  And I press "Save changes"
258  And the field "Weight of Test assignment six" matches value "0.0"
259  And the field "Weight of Test assignment seven" matches value "100.0"
260  And I reset weights for grade category "Sub category 1"
261  And I set the field "Override weight of Test assignment five" to "1"
262  And I set the field "Override weight of Test assignment six" to "1"
263  And I set the field "Weight of Test assignment five" to "-10"
264  And I set the field "Weight of Test assignment six" to "120"
265  And I press "Save changes"
266  And the field "Weight of Test assignment five" matches value "0.0"
267  And the field "Weight of Test assignment six" matches value "100.0"
268  And the field "Weight of Test assignment seven" matches value "0.0"
Note: See TracBrowser for help on using the repository browser.