MDL-47492 core_grades: Behat test for using scales and mingrade in gradebook
[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 |
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,Sum of grades |
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"
66 And I turn editing mode on
67
68 @javascript
69 Scenario: Test displaying scales in gradebook in aggregation method Sum of grades
70 When I follow "Edit Course 1"
71 And I set the field "Aggregation" to "Sum of grades"
72 And I press "Save changes"
73 And I follow "Edit Sub category 1"
74 And I set the field "Aggregation" to "Sum of grades"
75 And I press "Save changes"
76 And I turn editing mode off
77 Then the following should exist in the "user-grades" table:
78 | -1- | -4- | -5- | -6- |
79 | Student 1 | A | 5.00 | 5.00 |
80 | Student 2 | B | 4.00 | 4.00 |
81 | Student 3 | C | 3.00 | 3.00 |
82 | Student 4 | D | 2.00 | 2.00 |
83 | Student 5 | F | 1.00 | 1.00 |
84 And the following should exist in the "user-grades" table:
85 | -1- | -2- | -3- | -4- |
86 | Range | F–A | 0.00–5.00 | 0.00–5.00 |
87 | Overall average | C | 3.00 | 3.00 |
88 And I follow "User report"
89 And I set the field "Select all or one user" to "Student 3"
90 And I click on "Select all or one user" "select"
91 And the following should exist in the "user-grade" table:
92 | Grade item | Grade | Range | Percentage |
93 | Test assignment one | C | F–A | 50.00 % |
94 | Category total | 3.00 | 0–5 | 60.00 % |
95 | Course total | 3.00 | 0–5 | 60.00 % |
96 And I set the field "jump" to "Simple view"
97 And the following should exist in the "grade_edit_tree_table" table:
98 | Name | Max grade |
99 | Test assignment one | 5.00 |
100 | Category total | 5.00 |
101 | Course total | 5.00 |
102 And I log out
103 And I log in as "student2"
104 And I follow "Course 1"
105 And I follow "Grades"
106 And the following should exist in the "user-grade" table:
107 | Grade item | Grade | Range | Percentage |
108 | Test assignment one | B | F–A | 75.00 % |
109 | Category total | 4.00 | 0–5 | 80.00 % |
110 | Course total | 4.00 | 0–5 | 80.00 % |
111
112 @javascript
113 Scenario Outline: Test displaying scales in gradebook in all other aggregation methods
114 When I follow "Edit Course 1"
115 And I set the field "Aggregation" to "<aggregation>"
116 And I press "Save changes"
117 And I follow "Edit Sub category 1"
118 And I expand all fieldsets
119 And I set the field "Aggregation" to "<aggregation>"
120 And I set the field "Category name" to "Sub category (<aggregation>)"
121 And I set the field "Maximum grade" to "5"
122 And I set the field "Minimum grade" to "1"
123 And I press "Save changes"
124 And I turn editing mode off
125 Then the following should exist in the "user-grades" table:
126 | -1- | -4- | -5- | -6- |
127 | Student 1 | A | 5.00 | <coursetotal1> |
128 | Student 2 | B | 4.00 | <coursetotal2> |
129 | Student 3 | C | 3.00 | <coursetotal3> |
130 | Student 4 | D | 2.00 | <coursetotal4> |
131 | Student 5 | F | 1.00 | <coursetotal5> |
132 And the following should exist in the "user-grades" table:
133 | -1- | -2- | -3- | -4- |
134 | Range | F–A | 1.00–5.00 | 0.00–100.00 |
135 | Overall average | C | 3.00 | <overallavg> |
136 And I follow "User report"
137 And I set the field "Select all or one user" to "Student 3"
138 And I click on "Select all or one user" "select"
139 And the following should exist in the "user-grade" table:
140 | Grade item | Grade | Range | Percentage |
141 | Test assignment one | C | F–A | 50.00 % |
142 | Category total | 3.00 | 1–5 | 50.00 % |
143 | Course total | <coursetotal3> | 0–100 | <courseperc3> |
144 And I set the field "jump" to "Simple view"
145 And the following should exist in the "grade_edit_tree_table" table:
146 | Name | Max grade |
147 | Test assignment one | A (5) |
148 | Category total | |
149 | Course total | |
150 And I log out
151 And I log in as "student2"
152 And I follow "Course 1"
153 And I follow "Grades"
154 And the following should exist in the "user-grade" table:
155 | Grade item | Grade | Range | Percentage |
156 | Test assignment one | B | F–A | 75.00 % |
157 | Category total | 4.00 | 1–5 | 75.00 % |
158 | Course total | <coursetotal2> | 0–100 | <courseperc2> |
159
160 Examples:
161 | aggregation | coursetotal1 | coursetotal2 | coursetotal3 | coursetotal4 | coursetotal5 |overallavg | courseperc2 | courseperc3 |
162 | Mean of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % |
163 | Weighted mean of grades | - | - | - | - | - | - | - | - |
164 | Simple weighted mean of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % |
165 | Mean of grades (with extra credits) | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % |
166 | Median of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % |
167 | Lowest grade | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % |
168 | Highest grade | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % |
169 | Mode of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % |