source: moodle/trunk/fuentes/grade/tests/behat/grade_natural_exclude_empty.feature @ 1331

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

Updated to moodle 3.0.3

File size: 20.0 KB
Line 
1@core @core_grades
2Feature: Weights in natural aggregation are adjusted if the items are excluded from user report
3  In order to correctly display user report
4  As a teacher
5  I need to be able to exclude hidden grades.
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 "activities" exist:
20      | activity | course | idnumber | name                         | intro | grade |
21      | assign   | C1     | a1       | Test assignment one          | x     | 100   |
22      | assign   | C1     | a2       | Test assignment two          | x     | 50    |
23      | assign   | C1     | a3       | Test assignment three        | x     | 200   |
24      | assign   | C1     | a4       | Test assignment four (extra) | x     | 20    |
25      | assign   | C1     | a5       | Test assignment five (extra) | x     | 10    |
26    And I log in as "teacher1"
27    And I follow "Course 1"
28    And I navigate to "Grades" node in "Course administration"
29    And I set the field "Grade report" to "Gradebook setup"
30    And I set the following settings for grade item "Test assignment four (extra)":
31      | Extra credit | 1 |
32    And I set the following settings for grade item "Test assignment five (extra)":
33      | Extra credit | 1 |
34
35  @javascript
36  Scenario: No weights are overridden and student has all grades present
37    When I navigate to "Grades" node in "Course administration"
38    And I turn editing mode on
39    And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
40    And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
41    And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
42    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
43    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
44    And I press "Save changes"
45    And I set the field "Grade report" to "User report"
46    And I set the field "Select all or one user" to "Student 1"
47    Then the following should exist in the "user-grade" table:
48      | Grade item                   | Calculated weight      | Grade  | Range | Percentage | Contribution to course total |
49      | Test assignment one          | 28.57 %                | 80.00  | 0–100 | 80.00 %    | 22.86 %                      |
50      | Test assignment two          | 14.29 %                | 30.00  | 0–50  | 60.00 %    | 8.57 %                       |
51      | Test assignment three        | 57.14 %                | 150.00 | 0–200 | 75.00 %    | 42.86 %                      |
52      | Test assignment four (extra) | 5.71 %( Extra credit ) | 10.00  | 0–20  | 50.00 %    | 2.86 %                       |
53      | Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00   | 0–10  | 80.00 %    | 2.29 %                       |
54      | Course total                 | -                      | 278.00 | 0–350 | 79.43 %    | -                            |
55    And I log out
56
57  @javascript
58  Scenario: No weights are overridden, student has some grades present
59    When I navigate to "Grades" node in "Course administration"
60    And I turn editing mode on
61    And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
62    And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
63    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
64    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
65    And I press "Save changes"
66    And I set the field "Grade report" to "User report"
67    And I set the field "Select all or one user" to "Student 1"
68    Then the following should exist in the "user-grade" table:
69      | Grade item                   | Calculated weight       | Grade  | Range | Percentage | Contribution to course total |
70      | Test assignment one          | 66.67 %                 | 80.00  | 0–100 | 80.00 %    | 53.33 %                      |
71      | Test assignment two          | 33.33 %                 | 30.00  | 0–50  | 60.00 %    | 20.00 %                      |
72      | Test assignment three        | 0.00 %( Empty )         | -      | 0–200 | -          | 0.00 %                       |
73      | Test assignment four (extra) | 13.33 %( Extra credit ) | 10.00  | 0–20  | 50.00 %    | 6.67 %                       |
74      | Test assignment five (extra) | 6.67 %( Extra credit )  | 8.00   | 0–10  | 80.00 %    | 5.33 %                       |
75      | Course total                 | -                       | 128.00 | 0–150 | 85.33 %    | -                            |
76    And I log out
77
78  @javascript
79  Scenario: No weights are overridden, student has none grades present except for extra credit
80    When I navigate to "Grades" node in "Course administration"
81    And I turn editing mode on
82    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
83    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
84    And I press "Save changes"
85    And I set the field "Grade report" to "User report"
86    And I set the field "Select all or one user" to "Student 1"
87    Then the following should exist in the "user-grade" table:
88      | Grade item                   | Calculated weight      | Grade | Range | Percentage | Contribution to course total |
89      | Test assignment one          | 0.00 %( Empty )        | -     | 0–100 | -          | 0.00 %                       |
90      | Test assignment two          | 0.00 %( Empty )        | -     | 0–50  | -          | 0.00 %                       |
91      | Test assignment three        | 0.00 %( Empty )        | -     | 0–200 | -          | 0.00 %                       |
92      | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 0–20  | 50.00 %    | 0.00 %                       |
93      | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00  | 0–10  | 80.00 %    | 0.00 %                       |
94      | Course total                 | -                      | 0.00  | 0–0   |            | -                            |
95    And I log out
96
97  @javascript
98  Scenario: Make sure there are no errors when all items are marked as extra credit
99    And I set the following settings for grade item "Test assignment one":
100      | Extra credit | 1 |
101    And I set the following settings for grade item "Test assignment two":
102      | Extra credit | 1 |
103    And I set the following settings for grade item "Test assignment three":
104      | Extra credit | 1 |
105    When I navigate to "Grades" node in "Course administration"
106    And I turn editing mode on
107    And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
108    And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
109    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
110    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
111    And I press "Save changes"
112    And I set the field "Grade report" to "User report"
113    And I set the field "Select all or one user" to "Student 1"
114    Then the following should exist in the "user-grade" table:
115      | Grade item                   | Calculated weight      | Grade | Range | Percentage | Contribution to course total |
116      | Test assignment one          | 0.00 %( Extra credit ) | 80.00 | 0–100 | 80.00 %    | 0.00 %                       |
117      | Test assignment two          | 0.00 %( Extra credit ) | 30.00 | 0–50  | 60.00 %    | 0.00 %                       |
118      | Test assignment three        | 0.00 %( Empty )        | -     | 0–200 | -          | 0.00 %                       |
119      | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 0–20  | 50.00 %    | 0.00 %                       |
120      | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00  | 0–10  | 80.00 %    | 0.00 %                       |
121      | Course total                 | -                      | 0.0   | 0–0   |            | -                            |
122    And I log out
123
124  @javascript
125  Scenario: Weights are overridden and student has all grades present
126    When I set the field "Override weight of Test assignment one" to "1"
127    And I set the field "Weight of Test assignment one" to "50"
128    And I press "Save changes"
129    When I navigate to "Grades" node in "Course administration"
130    And I turn editing mode on
131    And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
132    And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
133    And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
134    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
135    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
136    And I press "Save changes"
137    And I set the field "Grade report" to "User report"
138    And I set the field "Select all or one user" to "Student 1"
139    Then the following should exist in the "user-grade" table:
140      | Grade item                   | Calculated weight      | Grade  | Range | Percentage | Contribution to course total |
141      | Test assignment one          | 50.00 %                | 80.00  | 0–100 | 80.00 %    | 40.00 %                      |
142      | Test assignment two          | 10.00 %                | 30.00  | 0–50  | 60.00 %    | 6.00 %                       |
143      | Test assignment three        | 40.00 %                | 150.00 | 0–200 | 75.00 %    | 30.00 %                      |
144      | Test assignment four (extra) | 5.71 %( Extra credit ) | 10.00  | 0–20  | 50.00 %    | 2.86 %                       |
145      | Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00   | 0–10  | 80.00 %    | 2.29 %                       |
146      | Course total                 | -                      | 284.00 | 0–350 | 81.14 %    | -                            |
147    And I log out
148
149  @javascript
150  Scenario: Weights are overridden and student has some grades present
151    When I set the field "Override weight of Test assignment one" to "1"
152    And I set the field "Weight of Test assignment one" to "50"
153    And I press "Save changes"
154    When I navigate to "Grades" node in "Course administration"
155    And I turn editing mode on
156    And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
157    And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
158    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
159    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
160    And I press "Save changes"
161    And I set the field "Grade report" to "User report"
162    And I set the field "Select all or one user" to "Student 1"
163    Then the following should exist in the "user-grade" table:
164      | Grade item                   | Calculated weight       | Grade  | Range | Percentage | Contribution to course total |
165      | Test assignment one          | 83.33 %                 | 80.00  | 0–100 | 80.00 %    | 66.67 %                      |
166      | Test assignment two          | 16.67 %                 | 30.00  | 0–50  | 60.00 %    | 10.00 %                      |
167      | Test assignment three        | 0.00 %( Empty )         | -      | 0–200 | -          | 0.00 %                       |
168      | Test assignment four (extra) | 13.33 %( Extra credit ) | 10.00  | 0–20  | 50.00 %    | 6.67 %                       |
169      | Test assignment five (extra) | 6.67 %( Extra credit )  | 8.00   | 0–10  | 80.00 %    | 5.33 %                       |
170      | Course total                 | -                       | 133.00 | 0–150 | 88.67 %    | -                            |
171    And I log out
172
173  @javascript
174  Scenario: Weights are overridden, student has none grades present except for extra credit
175    When I set the field "Override weight of Test assignment one" to "1"
176    And I set the field "Weight of Test assignment one" to "50"
177    And I press "Save changes"
178    When I navigate to "Grades" node in "Course administration"
179    And I turn editing mode on
180    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
181    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
182    And I press "Save changes"
183    And I set the field "Grade report" to "User report"
184    And I set the field "Select all or one user" to "Student 1"
185    Then the following should exist in the "user-grade" table:
186      | Grade item                   | Calculated weight      | Grade | Range | Percentage | Contribution to course total |
187      | Test assignment one          | 0.00 %( Empty )        | -     | 0–100 | -          | 0.00 %                       |
188      | Test assignment two          | 0.00 %( Empty )        | -     | 0–50  | -          | 0.00 %                       |
189      | Test assignment three        | 0.00 %( Empty )        | -     | 0–200 | -          | 0.00 %                       |
190      | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 0–20  | 50.00 %    | 0.00 %                       |
191      | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00  | 0–10  | 80.00 %    | 0.00 %                       |
192      | Course total                 | -                      | 0.00  | 0–0   |            | -                            |
193    And I log out
194
195  @javascript
196  Scenario: Weights are overridden, including extra credit, and student has all grades present
197    When I set the field "Override weight of Test assignment one" to "1"
198    And I set the field "Weight of Test assignment one" to "50"
199    And I set the field "Override weight of Test assignment four (extra)" to "1"
200    And I set the field "Weight of Test assignment four (extra)" to "10"
201    And I press "Save changes"
202    When I navigate to "Grades" node in "Course administration"
203    And I turn editing mode on
204    And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
205    And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
206    And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
207    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
208    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
209    And I press "Save changes"
210    And I set the field "Grade report" to "User report"
211    And I set the field "Select all or one user" to "Student 1"
212    Then the following should exist in the "user-grade" table:
213      | Grade item                   | Calculated weight       | Grade  | Range | Percentage | Contribution to course total |
214      | Test assignment one          | 50.00 %                 | 80.00  | 0–100 | 80.00 %    | 40.00 %                      |
215      | Test assignment two          | 10.00 %                 | 30.00  | 0–50  | 60.00 %    | 6.00 %                       |
216      | Test assignment three        | 40.00 %                 | 150.00 | 0–200 | 75.00 %    | 30.00 %                      |
217      | Test assignment four (extra) | 10.00 %( Extra credit ) | 10.00  | 0–20  | 50.00 %    | 5.00 %                       |
218      | Test assignment five (extra) | 2.86 %( Extra credit )  | 8.00   | 0–10  | 80.00 %    | 2.29 %                       |
219      | Course total                 | -                       | 291.50 | 0–350 | 83.29 %    | -                            |
220    And I log out
221
222  @javascript
223  Scenario: Weights are overridden, including extra credit, and student has some grades present
224    When I set the field "Override weight of Test assignment one" to "1"
225    And I set the field "Weight of Test assignment one" to "50"
226    And I set the field "Override weight of Test assignment four (extra)" to "1"
227    And I set the field "Weight of Test assignment four (extra)" to "10"
228    And I press "Save changes"
229    When I navigate to "Grades" node in "Course administration"
230    And I turn editing mode on
231    And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
232    And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
233    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
234    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
235    And I press "Save changes"
236    And I set the field "Grade report" to "User report"
237    And I set the field "Select all or one user" to "Student 1"
238    Then the following should exist in the "user-grade" table:
239      | Grade item                   | Calculated weight       | Grade  | Range | Percentage | Contribution to course total |
240      | Test assignment one          | 83.33 %                 | 80.00  | 0–100 | 80.00 %    | 66.67 %                      |
241      | Test assignment two          | 16.67 %                 | 30.00  | 0–50  | 60.00 %    | 10.00 %                      |
242      | Test assignment three        | 0.00 %( Empty )         | -      | 0–200 | -          | 0.00 %                       |
243      | Test assignment four (extra) | 16.67 %( Extra credit ) | 10.00  | 0–20  | 50.00 %    | 8.33 %                       |
244      | Test assignment five (extra) | 6.67 %( Extra credit )  | 8.00   | 0–10  | 80.00 %    | 5.33 %                       |
245      | Course total                 | -                       | 135.50 | 0–150 | 90.33 %    | -                            |
246    And I log out
247
248  @javascript
249  Scenario: Weights are overridden, including extra credit, student has none grades present except for extra credit
250    When I set the field "Override weight of Test assignment one" to "1"
251    And I set the field "Weight of Test assignment one" to "50"
252    And I set the field "Override weight of Test assignment four (extra)" to "1"
253    And I set the field "Weight of Test assignment four (extra)" to "10"
254    And I press "Save changes"
255    When I navigate to "Grades" node in "Course administration"
256    And I turn editing mode on
257    And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
258    And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
259    And I press "Save changes"
260    And I set the field "Grade report" to "User report"
261    And I set the field "Select all or one user" to "Student 1"
262    Then the following should exist in the "user-grade" table:
263      | Grade item                   | Calculated weight      | Grade | Range | Percentage | Contribution to course total |
264      | Test assignment one          | 0.00 %( Empty )        | -     | 0–100 | -          | 0.00 %                       |
265      | Test assignment two          | 0.00 %( Empty )        | -     | 0–50  | -          | 0.00 %                       |
266      | Test assignment three        | 0.00 %( Empty )        | -     | 0–200 | -          | 0.00 %                       |
267      | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 0–20  | 50.00 %    | 0.00 %                       |
268      | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00  | 0–10  | 80.00 %    | 0.00 %                       |
269      | Course total                 | -                      | 0.00  | 0–0   |            | -                            |
270    And I log out
Note: See TracBrowser for help on using the repository browser.