source: moodle/trunk/fuentes/grade/tests/behat/grade_calculated_grade_items.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: 10.4 KB
RevLine 
[1331]1@core @core_grades
2Feature: Calculated grade items can be used in the gradebook
3  In order to use calculated grade items in the gradebook
4  As a teacher
5  I need setup calculated grade items in the 'Gradebook setup' page.
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      | student2 | Student   | 2        | student2@example.com | s2       |
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 I log in as "admin"
22    And I am on site homepage
23    And I follow "Course 1"
24    And I navigate to "Grades" node in "Course administration"
25    And I navigate to "Gradebook setup" node in "Grade administration > Setup"
26
27  @javascript
28  Scenario: The max grade for a category item, with a calculation using Natural aggregation, can be changed
29    Given I press "Add category"
30    And I set the following fields to these values:
31      | Category name | Calc cat |
32    And I press "Save changes"
33    And I press "Add grade item"
34    And I set the following fields to these values:
35      | Item name | grade item 1 |
36      | Grade category | Calc cat |
37    And I press "Save changes"
38    And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
39      | grade item 1 | gi1 |
40    And I set the following settings for grade item "Calc cat":
41      | Maximum grade | 50 |
42    And I follow "Grader report"
43    And I turn editing mode on
44    And I give the grade "75.00" to the user "Student 1" for the grade item "grade item 1"
45    And I press "Save changes"
46    And I follow "User report"
47    And I select "Student 1" from the "Select all or one user" singleselect
48    And the following should exist in the "user-grade" table:
49      | Grade item                          | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
50      | grade item 1                        | -                 | 75.00  | 0–100 | 75.00 %    | -                            |
51      | Calc cat totalInclude empty grades. | 100.00 %          | 37.50  | 0–50  | 75.00 %    | -                            |
52      | Course total                        | -                 | 37.50  | 0–50  | 75.00 %    | -                            |
53
54  @javascript
55  Scenario: Changing max grade for a category item with a calculation that has existing grades will display the same points with the new max grade values immediately.
56  Given I press "Add category"
57    And I set the following fields to these values:
58      | Category name | Calc cat |
59    And I press "Save changes"
60    And I press "Add grade item"
61    And I set the following fields to these values:
62      | Item name | grade item 1 |
63      | Grade category | Calc cat |
64    And I press "Save changes"
65    And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
66      | grade item 1 | gi1 |
67    And I set the following settings for grade item "Calc cat":
68      | Maximum grade | 50 |
69    And I follow "Grader report"
70    And I turn editing mode on
71    And I give the grade "75.00" to the user "Student 1" for the grade item "grade item 1"
72    And I press "Save changes"
73    And I follow "User report"
74    And I select "Student 1" from the "Select all or one user" singleselect
75    And the following should exist in the "user-grade" table:
76      | Grade item                          | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
77      | grade item 1                        | -                 | 75.00  | 0–100 | 75.00 %    | -                            |
78      | Calc cat totalInclude empty grades. | 100.00 %          | 37.50  | 0–50  | 75.00 %    | -                            |
79      | Course total                        | -                 | 37.50  | 0–50  | 75.00 %    | -                            |
80    And I navigate to "Gradebook setup" node in "Grade administration > Setup"
81    And I set the following settings for grade item "Calc cat":
82      | Maximum grade | 40 |
83    And I follow "Grader report"
84    And I give the grade "65.00" to the user "Student 2" for the grade item "grade item 1"
85    And I press "Save changes"
86    And I follow "User report"
87    When I select "Student 1" from the "Select all or one user" singleselect
88    Then the following should exist in the "user-grade" table:
89      | Grade item                          | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
90      | grade item 1                        | -                 | 75.00  | 0–100 | 75.00 %    | -                            |
91      | Calc cat totalInclude empty grades. | 100.00 %          | 37.50  | 0–40  | 93.75 %    | -                            |
92      | Course total                        | -                 | 37.50  | 0–40  | 93.75 %    | -                            |
93    And I select "Student 2" from the "Select all or one user" singleselect
94    And the following should exist in the "user-grade" table:
95      | Grade item                          | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
96      | grade item 1                        | -                 | 65.00  | 0–100 | 65.00 %    | -                            |
97      | Calc cat totalInclude empty grades. | 100.00 %          | 32.50  | 0–40  | 81.25 %    | -                            |
98      | Course total                        | -                 | 32.50  | 0–40  | 81.25 %    | -                            |
99    And I navigate to "Course grade settings" node in "Grade administration > Setup"
100    And I set the following fields to these values:
101      | Min and max grades used in calculation | Initial min and max grades |
102    And I press "Save changes"
103    And I follow "User report"
104    And I select "Student 1" from the "Select all or one user" singleselect
105    And the following should exist in the "user-grade" table:
106      | Grade item                          | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
107      | grade item 1                        | -                 | 75.00  | 0–100 | 75.00 %    | -                            |
108      | Calc cat totalInclude empty grades. | 100.00 %          | 37.50  | 0–40  | 93.75 %    | -                            |
109      | Course total                        | -                 | 37.50  | 0–40  | 93.75 %    | -                            |
110    And I select "Student 2" from the "Select all or one user" singleselect
111    And the following should exist in the "user-grade" table:
112      | Grade item                          | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
113      | grade item 1                        | -                 | 65.00  | 0–100 | 65.00 %    | -                            |
114      | Calc cat totalInclude empty grades. | 100.00 %          | 32.50  | 0–40  | 81.25 %    | -                            |
115      | Course total                        | -                 | 32.50  | 0–40  | 81.25 %    | -                            |
116
117  @javascript
118  Scenario: Values in calculated grade items are not always out of one hundred
119    Given I press "Add grade item"
120    And I set the following fields to these values:
121      | Item name | grade item 1 |
122    And I press "Save changes"
123    And I press "Add grade item"
124    And I set the following fields to these values:
125      | Item name | calc item |
126    And I press "Save changes"
127    And I set "=[[gi1]]/2" calculation for grade item "calc item" with idnumbers:
128      | grade item 1 | gi1 |
129    And I set the following settings for grade item "calc item":
130      | Maximum grade | 50 |
131    And I navigate to "Course grade settings" node in "Grade administration > Setup"
132    And I set the following fields to these values:
133      | Min and max grades used in calculation | Initial min and max grades |
134    And I press "Save changes"
135    And I follow "Grader report"
136    And I turn editing mode on
137    And I give the grade "75.00" to the user "Student 1" for the grade item "grade item 1"
138    And I press "Save changes"
139    And I follow "User report"
140    When I select "Student 1" from the "Select all or one user" singleselect
141    Then the following should exist in the "user-grade" table:
142      | Grade item   | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
143      | grade item 1 | 66.67 %           | 75.00  | 0–100 | 75.00 %    | 50.00 %                      |
144      | calc item    | 33.33 %           | 37.50  | 0–50  | 75.00 %    | 25.00 %                      |
145      | Course total | -                 | 112.50 | 0–150 | 75.00 %    | -                            |
146    And I navigate to "Gradebook setup" node in "Grade administration > Setup"
147    And I set the following settings for grade item "calc item":
148      | Maximum grade | 40 |
149    And I follow "Grader report"
150    And I give the grade "65.00" to the user "Student 2" for the grade item "grade item 1"
151    And I press "Save changes"
152    And I follow "User report"
153    And I select "Student 1" from the "Select all or one user" singleselect
154    And the following should exist in the "user-grade" table:
155      | Grade item   | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
156      | grade item 1 | 71.43 %           | 75.00  | 0–100 | 75.00 %    | 53.57 %                      |
157      | calc item    | 28.57 %           | 37.50  | 0–40  | 93.75 %    | 26.79 %                      |
158      | Course total | -                 | 112.50 | 0–140 | 80.36 %    | -                            |
159    And I select "Student 2" from the "Select all or one user" singleselect
160    And the following should exist in the "user-grade" table:
161      | Grade item   | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
162      | grade item 1 | 71.43 %           | 65.00  | 0–100 | 65.00 %    | 46.43 %                      |
163      | calc item    | 28.57 %           | 32.50  | 0–40  | 81.25 %    | 23.21 %                      |
164      | Course total | -                 | 97.50  | 0–140 | 69.64 %    | -                            |
Note: See TracBrowser for help on using the repository browser.