/grade/tests/behat/grade_natural_exclude_empty_20150619.feature

https://github.com/vadimonus/moodle · Gherkin Specification · 275 lines · 260 code · 11 blank · 4 comment · 6 complexity · 39851649bbf7243eb0d18056978321c9 MD5 · raw file

  1. @core @core_grades
  2. Feature: Gradebook calculations for extra credit items before the fix 20150619
  3. In order to make sure the grades are not changed after upgrade
  4. As a teacher
  5. I need to be able to freeze gradebook calculations
  6. Background:
  7. Given the following "courses" exist:
  8. | fullname | shortname | category | groupmode |
  9. | Course 1 | C1 | 0 | 1 |
  10. And gradebook calculations for the course "C1" are frozen at version "20150619"
  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. @javascript
  35. Scenario: No weights are overridden and student has all grades present (before the fix 20150619)
  36. When I navigate to "Grades" node in "Course administration"
  37. And I turn editing mode on
  38. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  39. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  40. And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
  41. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  42. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  43. And I press "Save changes"
  44. And I set the field "Grade report" to "User report"
  45. And I set the field "Select all or one user" to "Student 1"
  46. Then the following should exist in the "user-grade" table:
  47. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  48. | Test assignment one | 28.57 % | 80.00 | 0100 | 80.00 % | 22.86 % |
  49. | Test assignment two | 14.29 % | 30.00 | 050 | 60.00 % | 8.57 % |
  50. | Test assignment three | 57.14 % | 150.00 | 0200 | 75.00 % | 42.86 % |
  51. | Test assignment four (extra) | 5.71 %( Extra credit ) | 10.00 | 020 | 50.00 % | 2.86 % |
  52. | Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.29 % |
  53. | Course total | - | 278.00 | 0350 | 79.43 % | - |
  54. And I log out
  55. @javascript
  56. Scenario: No weights are overridden, student has some grades present (before the fix 20150619)
  57. When I navigate to "Grades" node in "Course administration"
  58. And I turn editing mode on
  59. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  60. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  61. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  62. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  63. And I press "Save changes"
  64. And I set the field "Grade report" to "User report"
  65. And I set the field "Select all or one user" to "Student 1"
  66. Then the following should exist in the "user-grade" table:
  67. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  68. | Test assignment one | 66.67 % | 80.00 | 0100 | 80.00 % | 53.33 % |
  69. | Test assignment two | 33.33 % | 30.00 | 050 | 60.00 % | 20.00 % |
  70. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  71. | Test assignment four (extra) | 13.33 %( Extra credit ) | 10.00 | 020 | 50.00 % | 6.67 % |
  72. | Test assignment five (extra) | 6.67 %( Extra credit ) | 8.00 | 010 | 80.00 % | 5.33 % |
  73. | Course total | - | 128.00 | 0150 | 85.33 % | - |
  74. And I log out
  75. @javascript
  76. Scenario: No weights are overridden, student has none grades present except for extra credit (before the fix 20150619)
  77. When I navigate to "Grades" node in "Course administration"
  78. And I turn editing mode on
  79. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  80. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  81. And I press "Save changes"
  82. And I set the field "Grade report" to "User report"
  83. And I set the field "Select all or one user" to "Student 1"
  84. Then the following should exist in the "user-grade" table:
  85. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  86. | Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
  87. | Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
  88. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  89. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  90. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  91. | Course total | - | 0.00 | 00 | | - |
  92. And I log out
  93. @javascript
  94. Scenario: Make sure there are no errors when all items are marked as extra credit (before the fix 20150619)
  95. And I set the following settings for grade item "Test assignment one":
  96. | Extra credit | 1 |
  97. And I set the following settings for grade item "Test assignment two":
  98. | Extra credit | 1 |
  99. And I set the following settings for grade item "Test assignment three":
  100. | Extra credit | 1 |
  101. When I navigate to "Grades" node in "Course administration"
  102. And I turn editing mode on
  103. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  104. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  105. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  106. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  107. And I press "Save changes"
  108. And I set the field "Grade report" to "User report"
  109. And I set the field "Select all or one user" to "Student 1"
  110. Then the following should exist in the "user-grade" table:
  111. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  112. | Test assignment one | 0.00 %( Extra credit ) | 80.00 | 0100 | 80.00 % | 0.00 % |
  113. | Test assignment two | 0.00 %( Extra credit ) | 30.00 | 050 | 60.00 % | 0.00 % |
  114. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  115. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  116. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  117. | Course total | - | 0.0 | 00 | | - |
  118. And I log out
  119. @javascript
  120. Scenario: Weights are overridden and student has all grades present (before the fix 20150619)
  121. When I set the field "Override weight of Test assignment one" to "1"
  122. And I set the field "Weight of Test assignment one" to "50"
  123. And I press "Save changes"
  124. When I navigate to "Grades" node in "Course administration"
  125. And I turn editing mode on
  126. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  127. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  128. And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
  129. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  130. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  131. And I press "Save changes"
  132. And I set the field "Grade report" to "User report"
  133. And I set the field "Select all or one user" to "Student 1"
  134. Then the following should exist in the "user-grade" table:
  135. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  136. | Test assignment one | 50.00 % | 80.00 | 0100 | 80.00 % | 40.00 % |
  137. | Test assignment two | 10.00 % | 30.00 | 050 | 60.00 % | 6.00 % |
  138. | Test assignment three | 40.00 % | 150.00 | 0200 | 75.00 % | 30.00 % |
  139. | Test assignment four (extra) | 4.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 2.00 % |
  140. | Test assignment five (extra) | 2.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 1.60 % |
  141. | Course total | - | 278.60 | 0350 | 79.60 % | - |
  142. # Contributions of extra credit "four" should be 20/350=5.71% and "five" 10/350=2.86% (350 is max grade for the course, 20 and 10 are max grades of "four" and "five")
  143. And I log out
  144. @javascript
  145. Scenario: Weights are overridden and student has some grades present (before the fix 20150619)
  146. When I set the field "Override weight of Test assignment one" to "1"
  147. And I set the field "Weight of Test assignment one" to "50"
  148. And I press "Save changes"
  149. When I navigate to "Grades" node in "Course administration"
  150. And I turn editing mode on
  151. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  152. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  153. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  154. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  155. And I press "Save changes"
  156. And I set the field "Grade report" to "User report"
  157. And I set the field "Select all or one user" to "Student 1"
  158. Then the following should exist in the "user-grade" table:
  159. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  160. | Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
  161. | Test assignment two | 16.67 % | 30.00 | 050 | 60.00 % | 10.00 % |
  162. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  163. | Test assignment four (extra) | 6.67 %( Extra credit ) | 10.00 | 020 | 50.00 % | 3.33 % |
  164. | Test assignment five (extra) | 3.33 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.67 % |
  165. | Course total | - | 124.00 | 0150 | 82.67 % | - |
  166. # Contributions of extra credit "four" should be 20/150=13.33% and "five" 10/150=6.67% (150 is max grade for the course, 20 and 10 are max grades of "four" and "five")
  167. And I log out
  168. @javascript
  169. Scenario: Weights are overridden, student has none grades present except for extra credit (before the fix 20150619)
  170. When I set the field "Override weight of Test assignment one" to "1"
  171. And I set the field "Weight of Test assignment one" to "50"
  172. And I press "Save changes"
  173. When I navigate to "Grades" node in "Course administration"
  174. And I turn editing mode on
  175. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  176. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  177. And I press "Save changes"
  178. And I set the field "Grade report" to "User report"
  179. And I set the field "Select all or one user" to "Student 1"
  180. Then the following should exist in the "user-grade" table:
  181. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  182. | Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
  183. | Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
  184. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  185. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  186. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  187. | Course total | - | 0.00 | 00 | | - |
  188. And I log out
  189. @javascript
  190. Scenario: Weights are overridden, including extra credit, and student has all grades present (before the fix 20150619)
  191. When I set the field "Override weight of Test assignment one" to "1"
  192. And I set the field "Weight of Test assignment one" to "50"
  193. And I set the field "Override weight of Test assignment four (extra)" to "1"
  194. And I set the field "Weight of Test assignment four (extra)" to "10"
  195. And I press "Save changes"
  196. When I navigate to "Grades" node in "Course administration"
  197. And I turn editing mode on
  198. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  199. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  200. And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
  201. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  202. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  203. And I press "Save changes"
  204. And I set the field "Grade report" to "User report"
  205. And I set the field "Select all or one user" to "Student 1"
  206. Then the following should exist in the "user-grade" table:
  207. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  208. | Test assignment one | 50.00 % | 80.00 | 0100 | 80.00 % | 40.00 % |
  209. | Test assignment two | 8.70 % | 30.00 | 050 | 60.00 % | 5.22 % |
  210. | Test assignment three | 34.78 % | 150.00 | 0200 | 75.00 % | 26.09 % |
  211. | Test assignment four (extra) | 10.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 5.00 % |
  212. | Test assignment five (extra) | 1.74 %( Extra credit ) | 8.00 | 010 | 80.00 % | 1.39 % |
  213. | Course total | - | 271.93 | 0350 | 77.70 % | - |
  214. # Which is absolutely terrible because weights of normal items do not add up to 100%
  215. And I log out
  216. @javascript
  217. Scenario: Weights are overridden, including extra credit, and student has some grades present (before the fix 20150619)
  218. When I set the field "Override weight of Test assignment one" to "1"
  219. And I set the field "Weight of Test assignment one" to "50"
  220. And I set the field "Override weight of Test assignment four (extra)" to "1"
  221. And I set the field "Weight of Test assignment four (extra)" to "10"
  222. And I press "Save changes"
  223. When I navigate to "Grades" node in "Course administration"
  224. And I turn editing mode on
  225. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  226. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  227. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  228. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  229. And I press "Save changes"
  230. And I set the field "Grade report" to "User report"
  231. And I set the field "Select all or one user" to "Student 1"
  232. Then the following should exist in the "user-grade" table:
  233. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  234. | Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
  235. | Test assignment two | 0.00 % | 30.00 | 050 | 60.00 % | 0.00 % |
  236. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  237. | Test assignment four (extra) | 16.67 %( Extra credit ) | 10.00 | 020 | 50.00 % | 8.33 % |
  238. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  239. | Course total | - | 112.50 | 0150 | 75.00 % | - |
  240. # This is just ridiculous, the grades for "two" and "five" are 0 without any reason, and sum weight of normal items is not 100% again.
  241. And I log out
  242. @javascript
  243. Scenario: Weights are overridden, including extra credit, student has none grades present except for extra credit (before the fix 20150619)
  244. When I set the field "Override weight of Test assignment one" to "1"
  245. And I set the field "Weight of Test assignment one" to "50"
  246. And I set the field "Override weight of Test assignment four (extra)" to "1"
  247. And I set the field "Weight of Test assignment four (extra)" to "10"
  248. And I press "Save changes"
  249. When I navigate to "Grades" node in "Course administration"
  250. And I turn editing mode on
  251. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  252. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  253. And I press "Save changes"
  254. And I set the field "Grade report" to "User report"
  255. And I set the field "Select all or one user" to "Student 1"
  256. Then the following should exist in the "user-grade" table:
  257. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  258. | Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
  259. | Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
  260. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  261. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  262. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  263. | Course total | - | 0.00 | 00 | | - |
  264. And I log out