toolExercise.feature 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. Feature: Exercise tool
  2. In order to use the exercise tool
  3. The teachers should be able to create exercises
  4. Background:
  5. Given I am a platform administrator
  6. And I am on course "TEMP" homepage
  7. Scenario: Create a question category
  8. Given I am on "/main/exercise/tests_category.php?action=addcategory&cidReq=TEMP"
  9. And wait for the page to be loaded
  10. When I fill in the following:
  11. | category_name | Category 1 |
  12. And I fill in ckeditor field "category_description" with "Category 1 description"
  13. And I press "SubmitNote"
  14. Then I should see "Category added"
  15. Scenario: Create a second question category
  16. Given I am on "/main/exercise/tests_category.php?action=addcategory&cidReq=TEMP"
  17. And wait for the page to be loaded
  18. When I fill in the following:
  19. | category_name | Category 2 |
  20. And I fill in ckeditor field "category_description" with "Category 2 description"
  21. And I press "SubmitNote"
  22. Then I should see "Category added"
  23. Scenario: Create an exercise
  24. Given I am on "/main/exercise/exercise_admin.php?cidReq=TEMP"
  25. And I press advanced settings
  26. When I fill in the following:
  27. | exercise_title | Exercise 1 |
  28. And I fill in ckeditor field "exerciseDescription" with "Exercise description"
  29. And I press "submitExercise"
  30. Then I should see "Exercise added"
  31. Scenario: Edit an exercise
  32. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  33. And I follow "Exercise 1"
  34. And I follow "Edit"
  35. And I follow "Edit test name and settings"
  36. And I press "submitExercise"
  37. Then I should see "Test name and settings have been saved."
  38. Scenario: Add question "Multiple choice" to exercise created "Exercise 1"
  39. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  40. And I follow "Exercise 1"
  41. And I follow "Edit"
  42. And I follow "Multiple choice"
  43. When I fill in the following:
  44. | questionName | Multiple choice |
  45. | weighting[1] | 10 |
  46. Then I fill in ckeditor field "answer[1]" with "Answer true"
  47. Then I fill in ckeditor field "answer[2]" with "Answer false"
  48. Then I fill in ckeditor field "answer[3]" with "Answer false"
  49. Then I fill in ckeditor field "answer[4]" with "Answer false"
  50. Then I fill in ckeditor field "comment[1]" with "Comment true"
  51. Then I fill in ckeditor field "comment[2]" with "Comment false"
  52. Then I fill in ckeditor field "comment[3]" with "Comment false"
  53. Then I fill in ckeditor field "comment[4]" with "Comment false"
  54. And I press "submit-question"
  55. Then I should see "Item added"
  56. Scenario: Add question "Multiple answer" to exercise created "Exercise 1"
  57. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  58. And I follow "Exercise 1"
  59. And I follow "Edit"
  60. And I follow "Multiple answer"
  61. When I fill in the following:
  62. | questionName | Multiple answers |
  63. | weighting[1] | 10 |
  64. Then I check the "correct[1]" radio button
  65. Then I fill in ckeditor field "answer[1]" with "Answer true"
  66. Then I fill in ckeditor field "answer[2]" with "Answer false"
  67. Then I fill in ckeditor field "answer[3]" with "Answer false"
  68. Then I fill in ckeditor field "answer[4]" with "Answer false"
  69. Then I fill in ckeditor field "comment[1]" with "Comment true"
  70. Then I fill in ckeditor field "comment[2]" with "Comment false"
  71. Then I fill in ckeditor field "comment[3]" with "Comment false"
  72. Then I fill in ckeditor field "comment[4]" with "Comment false"
  73. And I press "submit-question"
  74. Then I should see "Item added"
  75. Scenario: Add question "Fill in blanks" to "Exercise 1"
  76. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  77. And I follow "Exercise 1"
  78. And I follow "Edit"
  79. And I follow "Fill blanks or form"
  80. When I fill in the following:
  81. | questionName | Fill blanks |
  82. Then I fill in ckeditor field "answer" with "Romeo and [Juliet] [Hätten||Haetten] [möchte||moechte] [wäre||waere] [können||koennen] [Könnten||Koennten] [Ärger] [voilà] [müssen] [l'été] [cherchent à] [Übung] [Ärger|Möglichkeit]"
  83. And I press "submitQuestion"
  84. Then I should see "Item added"
  85. Scenario: Add question "Matching" to exercise created "Exercise 1"
  86. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  87. And I follow "Exercise 1"
  88. And I follow "Edit"
  89. And I follow "Matching"
  90. When I fill in the following:
  91. | questionName | Matching |
  92. And I fill in ckeditor field "answer[1]" with "Answer A"
  93. And I fill in ckeditor field "answer[2]" with "Answer B"
  94. And I fill in ckeditor field "option[1]" with "Option A"
  95. And I fill in ckeditor field "option[2]" with "Option B"
  96. And I fill in select bootstrap static input "#matches_2" select "2"
  97. And I press "submitQuestion"
  98. Then I should see "Item added"
  99. Scenario: Add question "Open" to exercise created "Exercise 1"
  100. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  101. And I follow "Exercise 1"
  102. And I follow "Edit"
  103. And I follow "Open"
  104. When I fill in the following:
  105. | questionName | Open question |
  106. | weighting | 10 |
  107. And I press "submitQuestion"
  108. Then I should see "Item added"
  109. Scenario: Add question "Oral expression" to exercise created "Exercise 1"
  110. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  111. And I follow "Exercise 1"
  112. And I follow "Edit"
  113. And I follow "Oral expression"
  114. When I fill in the following:
  115. | questionName | Oral expression question |
  116. | weighting | 10 |
  117. And I press "submitQuestion"
  118. Then I should see "Item added"
  119. Scenario: Add question "Exact answers combination" to exercise created "Exercise 1"
  120. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  121. And I follow "Exercise 1"
  122. And I follow "Edit"
  123. And I follow "Exact Selection"
  124. When I fill in the following:
  125. | questionName | Exact answers combination |
  126. Then I check the "correct[1]" radio button
  127. Then I fill in ckeditor field "answer[1]" with "Answer true"
  128. Then I fill in ckeditor field "answer[2]" with "Answer false"
  129. Then I fill in ckeditor field "comment[1]" with "Comment true"
  130. Then I fill in ckeditor field "comment[2]" with "Comment false"
  131. And I press "submitQuestion"
  132. Then I should see "Item added"
  133. Scenario: Add question "Unique answer with unknown" to exercise created "Exercise 1"
  134. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  135. And I follow "Exercise 1"
  136. And I follow "Edit"
  137. And I follow "Unique answer with unknown"
  138. When I fill in the following:
  139. | questionName | Unique answer with unknown |
  140. | weighting[1] | 10 |
  141. Then I check the "correct" radio button
  142. Then I fill in ckeditor field "answer[1]" with "Answer true"
  143. Then I fill in ckeditor field "answer[2]" with "Answer false"
  144. Then I fill in ckeditor field "answer[3]" with "Answer false"
  145. Then I fill in ckeditor field "comment[1]" with "Comment true"
  146. Then I fill in ckeditor field "comment[2]" with "Comment false"
  147. Then I fill in ckeditor field "comment[3]" with "Comment false"
  148. And I press "submitQuestion"
  149. Then I should see "Item added"
  150. Scenario: Add question "Multiple answer true/false/don't know" to exercise created "Exercise 1"
  151. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  152. And I follow "Exercise 1"
  153. And I follow "Edit"
  154. And I follow "Multiple answer true/false/don't know"
  155. When I fill in the following:
  156. | questionName | Multiple answer true - false - dont know |
  157. Then I check the "correct[1]" radio button
  158. Then I check the "correct[2]" radio button
  159. Then I check the "correct[3]" radio button
  160. Then I check the "correct[4]" radio button
  161. Then I fill in ckeditor field "answer[1]" with "Answer true"
  162. Then I fill in ckeditor field "answer[2]" with "Answer true"
  163. Then I fill in ckeditor field "answer[3]" with "Answer true"
  164. Then I fill in ckeditor field "answer[4]" with "Answer true"
  165. Then I fill in ckeditor field "comment[1]" with "Comment true"
  166. Then I fill in ckeditor field "comment[2]" with "Comment true"
  167. Then I fill in ckeditor field "comment[3]" with "Comment true"
  168. Then I fill in ckeditor field "comment[4]" with "Comment true"
  169. And I press "submitQuestion"
  170. Then I should see "Item added"
  171. Scenario: Add question "Combination true/false/don't-know" to exercise created "Exercise 1"
  172. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  173. And I follow "Exercise 1"
  174. And I follow "Edit"
  175. And I follow "Combination true/false/don't-know"
  176. When I fill in the following:
  177. | questionName | Combination true - false - don't-know |
  178. Then I check the "correct[1]" radio button
  179. Then I fill in ckeditor field "answer[1]" with "Answer true"
  180. Then I fill in ckeditor field "answer[2]" with "Answer false"
  181. Then I fill in ckeditor field "comment[1]" with "Comment true"
  182. Then I fill in ckeditor field "comment[2]" with "Comment false"
  183. And I press "submitQuestion"
  184. Then I should see "Item added"
  185. Scenario: Add question "Global multiple answer" to exercise created "Exercise 1"
  186. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  187. And I follow "Exercise 1"
  188. And I follow "Edit"
  189. And I follow "Global multiple answer"
  190. When I fill in the following:
  191. | questionName | Global multiple answer |
  192. | weighting[1] | 10 |
  193. Then I check the "correct[1]" radio button
  194. Then I fill in ckeditor field "answer[1]" with "Answer true"
  195. Then I fill in ckeditor field "answer[2]" with "Answer false"
  196. Then I fill in ckeditor field "answer[3]" with "Answer false"
  197. Then I fill in ckeditor field "answer[4]" with "Answer false"
  198. Then I fill in ckeditor field "comment[1]" with "Comment true"
  199. Then I fill in ckeditor field "comment[2]" with "Comment false"
  200. Then I fill in ckeditor field "comment[3]" with "Comment false"
  201. Then I fill in ckeditor field "comment[4]" with "Comment false"
  202. And I press "submitQuestion"
  203. Then I should see "Item added"
  204. Scenario: Duplicate exercise
  205. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  206. And I follow "Copy this exercise as a new one"
  207. And I confirm the popup
  208. Then I should see "Exercise copied"
  209. And I should see "Exercise 1 - Copy"
  210. Scenario: Import exercise to test questions categories
  211. Given I am on "/main/exercise/upload_exercise.php?cidReq=TEMP"
  212. And I should see "Import quiz from Excel"
  213. And I attach the file "/tests/behat/uploadable_files/exercise.xls" to "user_upload_quiz"
  214. When I press "Upload"
  215. And wait for the page to be loaded
  216. Then I should see "Exercise for Behat test"
  217. Scenario: Import exercise from excel
  218. Given I am on "/main/exercise/upload_exercise.php?cidReq=TEMP"
  219. Then I should see "Import quiz from Excel"
  220. Then I attach the file "/main/exercise/quiz_template.xls" to "user_upload_quiz"
  221. And I press "Upload"
  222. And wait for the page to be loaded
  223. Then I should see "Definition of oligarchy"
  224. Scenario: Try exercise "Exercise 1"
  225. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  226. And I follow "Exercise 1"
  227. And I follow "Start test"
  228. # Question 1
  229. Then I should see "Multiple choice"
  230. And I check the "Answer true" radio button
  231. And wait for the page to be loaded
  232. Then I press "Next question"
  233. # Question 2
  234. And wait for the page to be loaded
  235. And I check the "Answer true" radio button
  236. And wait for the page to be loaded
  237. Then I press "Next question"
  238. # Question 3
  239. Then I fill in the following:
  240. | choice_id_3_0 | Juliet |
  241. | choice_id_3_1 | Hätten |
  242. | choice_id_3_2 | möchte |
  243. | choice_id_3_3 | wäre |
  244. | choice_id_3_4 | können |
  245. | choice_id_3_5 | Könnten |
  246. | choice_id_3_6 | Ärger |
  247. | choice_id_3_7 | voilà |
  248. | choice_id_3_8 | müssen |
  249. | choice_id_3_9 | l'été |
  250. | choice_id_3_10 | cherchent à |
  251. | choice_id_3_11 | Übung |
  252. Then I fill in select bootstrap static by text "#choice_id_3_12" select "Ärger"
  253. And wait for the page to be loaded
  254. Then I press "Next question"
  255. # Question 4 - Matching
  256. Then I select "A" from "choice_id_4_1"
  257. Then I select "B" from "choice_id_4_2"
  258. Then I press "Next question"
  259. # Question 5 - Open question
  260. Then wait for the page to be loaded
  261. Then I fill the only ckeditor in the page with "Hello you"
  262. Then wait for the page to be loaded
  263. Then I press "Next question"
  264. # Question 6 - Oral question
  265. Then wait for the page to be loaded
  266. Then I press "Next question"
  267. # Question 7 - Exact answers combination
  268. Then I check "Answer true"
  269. Then I press "Next question"
  270. Then wait for the page to be loaded
  271. # Question 8 - Unique answer with unknown
  272. And I check the "Answer true" radio button
  273. Then I press "Next question"
  274. Then wait for the page to be loaded
  275. # Question 9 - Multiple answer true - false - dont know
  276. #@todo
  277. Then I press "Next question"
  278. # Question 10 - Combination true - false - don't-know
  279. #@todo
  280. Then I press "Next question"
  281. # Question 11 - Global multiple answer
  282. Then I check "Answer true"
  283. Then I press "End test"
  284. Then I should see "Hello you"
  285. Then I should see "Score for the test: 83 / 117"
  286. Scenario: Check exercise result
  287. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  288. And I follow "Exercise 1"
  289. And I follow "Edit"
  290. And I follow "Results and feedback"
  291. Then I should see "Learner score"
  292. And wait very long for the page to be loaded
  293. And I follow "Grade activity"
  294. Then I should see "Score for the test: 83 / 117"
  295. And I press "Edit individual feedback and grade the open question"
  296. And I should see "Assign a grade"
  297. And I fill the only ckeditor in the page with "open question teacher answer"
  298. And I fill in select "select[name=marks]" with option value "10" with class ".grade_select"
  299. Then I press "Correct test"
  300. And wait very long for the page to be loaded
  301. And I follow "Edit"
  302. Then I should see "open question teacher answer"
  303. And I should see "Score for the test: 93 / 117"
  304. Scenario: Create a session "Session Exercise" and add user "acostea"
  305. Given I am on "/main/session/session_add.php"
  306. When I fill in the following:
  307. | name | Session Exercise |
  308. And I fill in select2 input "#coach_username" with id "1" and value "admin"
  309. And I press "submit"
  310. Then wait for the page to be loaded
  311. Then I should see "Add courses to this session (Session Exercise)"
  312. Then I select "TEMP (TEMP)" from "NoSessionCoursesList[]"
  313. And I press "add_course"
  314. And I press "next"
  315. Then I should see "Update successful"
  316. Then I follow "Multiple registration"
  317. Then I select "Costea Andrea (acostea)" from "nosessionUsersList[]"
  318. And I press "add_user"
  319. And I press "next"
  320. Then I should see "Update successful"
  321. Scenario: Try exercise with categorized questions as student
  322. Given I am a student
  323. And I am on course "TEMP" homepage in session "Session Exercise"
  324. Then I should see "TEMP (Session Exercise)"
  325. And I am on "/main/exercise/exercise.php?cidReq=TEMP"
  326. And I follow "Exercise for Behat test"
  327. And I follow "Start test"
  328. When wait for the page to be loaded
  329. And I press "Next question"
  330. And I check "oligarchy"
  331. And I check "oligopoly"
  332. And I check "timocracy"
  333. And I check "autocracy"
  334. And I press "Next question"
  335. And I check the "semantics" radio button
  336. And I press "Next question"
  337. And I check the "RNASL" radio button
  338. And I press "Next question"
  339. And I check the "10" radio button
  340. And I press "Next question"
  341. And fill in the following:
  342. | choice_id_6_0 | words |
  343. | choice_id_6_1 | fill |
  344. | choice_id_6_2 | blanks |
  345. And I press "Next question"
  346. And I select "A" from "choice_id_7_1"
  347. And I select "B" from "choice_id_7_2"
  348. And I select "C" from "choice_id_7_3"
  349. And I press "Next question"
  350. And wait for the page to be loaded
  351. And I check "1"
  352. And I press "Next question"
  353. And wait for the page to be loaded
  354. And I press "End test"
  355. Then I should see "Score for the test: 190 / 190"
  356. And I should see the table "#category_results":
  357. | Categories | Absolute score | Relative score |
  358. | Categoryname2 | 50 / 70 | 71.43% |
  359. | Categoryname1 | 60 / 60 | 100% |
  360. | none | 80 / 60 | 133.33% |
  361. | Total | 190 / 190 | 100% |
  362. Scenario: Teacher looks at exercise results by categories
  363. Given I am on "/user_portal.php"
  364. And I am on course "TEMP" homepage in session "Session Exercise"
  365. Then I should see "TEMP (Session Exercise)"
  366. And I am on "/main/exercise/exercise.php?cidReq=TEMP"
  367. And I follow "Exercise for Behat test"
  368. And I follow "Results and feedback"
  369. Then I should see "Learner score"
  370. And wait very long for the page to be loaded
  371. And I follow "Grade activity"
  372. Then I should see "Score for the test: 190 / 190"
  373. And I should see the table "#category_results":
  374. | Categories | Absolute score | Relative score |
  375. | Categoryname2 | 50 / 70 | 71.43% |
  376. | Categoryname1 | 60 / 60 | 100% |
  377. | none | 80 / 60 | 133.33% |
  378. | Total | 190 / 190 | 100% |
  379. Scenario: Delete an exercise
  380. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  381. And I follow "Delete"
  382. And I confirm the popup
  383. Then I should see "The test has been deleted"
  384. Scenario: Delete an exercise category
  385. Given I am on "/main/exercise/tests_category.php?cidReq=TEMP"
  386. And I follow "Delete"
  387. Then I should see "Category deleted"
  388. Scenario: Delete an exercise category
  389. Given I am on "/main/exercise/tests_category.php?cidReq=TEMP"
  390. And I follow "Delete"
  391. Then I should see "Category deleted"
  392. Scenario: Delete session
  393. Given I am on "/main/session/session_list.php?keyword=Session+Exercise"
  394. And wait for the page to be loaded
  395. And I follow "Delete"
  396. And I confirm the popup
  397. Then I should see "Deleted"