MDL-47463 core_grades: Behat checks the contribution of scales
[moodle.git] / grade / tests / behat / grade_scales.feature
CommitLineData
ebfcb9eb
MG
1@core @core_grades
2Feature: View gradebook when scales are used
3 In order to use scales to grade activities
4 As an teacher
5 I need to be able to view gradebook with scales
6
7 Background:
8 Given I log in as "admin"
9 And I set the following administration settings values:
10 | grade_report_showranges | 1 |
837b9289 11 | grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
ebfcb9eb
MG
12 And I navigate to "Scales" node in "Site administration > Grades"
13 And I press "Add a new scale"
14 And I set the following fields to these values:
15 | Name | Letterscale |
16 | Scale | F,D,C,B,A |
17 And I press "Save changes"
18 And I log out
19 And the following "courses" exist:
20 | fullname | shortname |
21 | Course 1 | C1 |
22 And the following "users" exist:
23 | username | firstname | lastname | email | idnumber |
24 | teacher1 | Teacher | 1 | teacher1@asd.com | t1 |
25 | student1 | Student | 1 | student1@asd.com | s1 |
26 | student2 | Student | 2 | student2@asd.com | s2 |
27 | student3 | Student | 3 | student3@asd.com | s3 |
28 | student4 | Student | 4 | student4@asd.com | s4 |
29 | student5 | Student | 5 | student5@asd.com | s5 |
30 And the following "course enrolments" exist:
31 | user | course | role |
32 | teacher1 | C1 | editingteacher |
33 | student1 | C1 | student |
34 | student2 | C1 | student |
35 | student3 | C1 | student |
36 | student4 | C1 | student |
37 | student5 | C1 | student |
38 And the following "grade categories" exist:
39 | fullname | course |
40 | Sub category 1 | C1 |
41 And the following "activities" exist:
42 | activity | course | idnumber | name | intro | gradecategory |
43 | assign | C1 | a1 | Test assignment one | Submit something! | Sub category 1 |
44 And I log in as "teacher1"
45 And I follow "Course 1"
46 And I follow "Test assignment one"
47 And I follow "Edit settings"
48 And I expand all fieldsets
49 And I set the field "grade[modgrade_type]" to "Scale"
50 And I set the field "grade[modgrade_scale]" to "Letterscale"
51 And I press "Save and display"
52 And I follow "View/grade all submissions"
53 And I click on "Grade Student 1" "link" in the "Student 1" "table_row"
54 And I set the field "Grade" to "A"
55 And I press "Save and show next"
56 And I set the field "Grade" to "B"
57 And I press "Save and show next"
58 And I set the field "Grade" to "C"
59 And I press "Save and show next"
60 And I set the field "Grade" to "D"
61 And I press "Save and show next"
62 And I set the field "Grade" to "F"
63 And I press "Save changes"
64 And I follow "Course 1"
65 And I follow "Grades"
21dd6842
FM
66 And I navigate to "Course grade settings" node in "Grade administration > Setup"
67 And I set the field "Show weightings" to "Show"
68 And I set the field "Show contribution to course total" to "Show"
69 And I press "Save changes"
70 And I follow "Grader report"
ebfcb9eb
MG
71 And I turn editing mode on
72
73 @javascript
837b9289
MG
74 Scenario: Test displaying scales in gradebook in aggregation method Natural
75 When I turn editing mode off
ebfcb9eb
MG
76 Then the following should exist in the "user-grades" table:
77 | -1- | -4- | -5- | -6- |
78 | Student 1 | A | 5.00 | 5.00 |
79 | Student 2 | B | 4.00 | 4.00 |
80 | Student 3 | C | 3.00 | 3.00 |
81 | Student 4 | D | 2.00 | 2.00 |
82 | Student 5 | F | 1.00 | 1.00 |
83 And the following should exist in the "user-grades" table:
84 | -1- | -2- | -3- | -4- |
85 | Range | F–A | 0.00–5.00 | 0.00–5.00 |
86 | Overall average | C | 3.00 | 3.00 |
87 And I follow "User report"
88 And I set the field "Select all or one user" to "Student 3"
89 And I click on "Select all or one user" "select"
90 And the following should exist in the "user-grade" table:
21dd6842
FM
91 | Grade item | Grade | Range | Percentage | Contribution to course total |
92 | Test assignment one | C | F–A | 50.00 % | 3.00 |
93 | Category total | 3.00 | 0–5 | 60.00 % | - |
94 | Course total | 3.00 | 0–5 | 60.00 % | - |
9f1088d4 95 And I set the field "jump" to "Categories and items"
ebfcb9eb
MG
96 And the following should exist in the "grade_edit_tree_table" table:
97 | Name | Max grade |
98 | Test assignment one | 5.00 |
99 | Category total | 5.00 |
100 | Course total | 5.00 |
101 And I log out
102 And I log in as "student2"
103 And I follow "Course 1"
104 And I follow "Grades"
105 And the following should exist in the "user-grade" table:
21dd6842
FM
106 | Grade item | Grade | Range | Percentage | Contribution to course total |
107 | Test assignment one | B | F–A | 75.00 % | 4.00 |
108 | Category total | 4.00 | 0–5 | 80.00 % | - |
109 | Course total | 4.00 | 0–5 | 80.00 % | - |
ebfcb9eb
MG
110
111 @javascript
112 Scenario Outline: Test displaying scales in gradebook in all other aggregation methods
113 When I follow "Edit Course 1"
114 And I set the field "Aggregation" to "<aggregation>"
115 And I press "Save changes"
116 And I follow "Edit Sub category 1"
117 And I expand all fieldsets
118 And I set the field "Aggregation" to "<aggregation>"
119 And I set the field "Category name" to "Sub category (<aggregation>)"
120 And I set the field "Maximum grade" to "5"
121 And I set the field "Minimum grade" to "1"
122 And I press "Save changes"
123 And I turn editing mode off
124 Then the following should exist in the "user-grades" table:
125 | -1- | -4- | -5- | -6- |
126 | Student 1 | A | 5.00 | <coursetotal1> |
127 | Student 2 | B | 4.00 | <coursetotal2> |
128 | Student 3 | C | 3.00 | <coursetotal3> |
129 | Student 4 | D | 2.00 | <coursetotal4> |
130 | Student 5 | F | 1.00 | <coursetotal5> |
131 And the following should exist in the "user-grades" table:
132 | -1- | -2- | -3- | -4- |
133 | Range | F–A | 1.00–5.00 | 0.00–100.00 |
134 | Overall average | C | 3.00 | <overallavg> |
135 And I follow "User report"
136 And I set the field "Select all or one user" to "Student 3"
137 And I click on "Select all or one user" "select"
138 And the following should exist in the "user-grade" table:
21dd6842
FM
139 | Grade item | Grade | Range | Percentage | Contribution to course total |
140 | Test assignment one | C | F–A | 50.00 % | <contrib3> |
141 | Category total<aggregation>. | 3.00 | 1–5 | 50.00 % | - |
142 | Course total<aggregation>. | <coursetotal3> | 0–100 | <courseperc3> | - |
9f1088d4 143 And I set the field "jump" to "Categories and items"
ebfcb9eb
MG
144 And the following should exist in the "grade_edit_tree_table" table:
145 | Name | Max grade |
146 | Test assignment one | A (5) |
9f1088d4
MG
147 | Category total<aggregation>. | |
148 | Course total<aggregation>. | |
ebfcb9eb
MG
149 And I log out
150 And I log in as "student2"
151 And I follow "Course 1"
152 And I follow "Grades"
153 And the following should exist in the "user-grade" table:
21dd6842
FM
154 | Grade item | Grade | Range | Percentage | Contribution to course total |
155 | Test assignment one | B | F–A | 75.00 % | <contrib2> |
156 | Category total<aggregation>. | 4.00 | 1–5 | 75.00 % | - |
157 | Course total<aggregation>. | <coursetotal2> | 0–100 | <courseperc2> | - |
ebfcb9eb 158
21dd6842
FM
159 Examples:
160 | aggregation | coursetotal1 | coursetotal2 | coursetotal3 | coursetotal4 | coursetotal5 |overallavg | courseperc2 | courseperc3 | contrib2 | contrib3 |
161 | Mean of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 | 50.00 |
162 | Weighted mean of grades | - | - | - | - | - | - | - | - | 0.00 | 0.00 |
163 | Simple weighted mean of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 | 50.00 |
164 | Mean of grades (with extra credits) | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 | 50.00 |
165 | Median of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 | 50.00 |
166 | Lowest grade | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 | 50.00 |
167 | Highest grade | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 | 50.00 |
168 | Mode of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 | 50.00 |