toolExercise.feature 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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 I fill in ckeditor field "<string>" with "<string>"
  261. Then wait for the page to be loaded
  262. Then I press "Next question"
  263. # Question 6 - Oral question
  264. Then wait for the page to be loaded
  265. Then I press "Next question"
  266. # Question 7 - Exact answers combination
  267. Then I check "Answer true"
  268. Then I press "Next question"
  269. Then wait for the page to be loaded
  270. # Question 8 - Unique answer with unknown
  271. And I check the "Answer true" radio button
  272. Then I press "Next question"
  273. Then wait for the page to be loaded
  274. # Question 9 - Multiple answer true - false - dont know
  275. #@todo
  276. Then I press "Next question"
  277. # Question 10 - Combination true - false - don't-know
  278. #@todo
  279. Then I press "Next question"
  280. # Question 11 - Global multiple answer
  281. Then I check "Answer true"
  282. Then I press "End test"
  283. Then I should see "Score for the test: 83 / 117"
  284. Scenario: Check exercise result
  285. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  286. And I follow "Exercise 1"
  287. And I follow "Edit"
  288. And I follow "Results and feedback"
  289. Then I should see "Learner score"
  290. And wait for the page to be loaded
  291. And I follow "Grade activity"
  292. Then I should see "Score for the test: 83 / 117"
  293. Scenario: Create a session "Session Exercise" and add user "acostea"
  294. Given I am on "/main/session/session_add.php"
  295. When I fill in the following:
  296. | name | Session Exercise |
  297. And I fill in select2 input "#coach_username" with id "1" and value "admin"
  298. And I press "submit"
  299. Then wait for the page to be loaded
  300. Then I should see "Add courses to this session (Session Exercise)"
  301. Then I select "TEMP (TEMP)" from "NoSessionCoursesList[]"
  302. And I press "add_course"
  303. And I press "next"
  304. Then I should see "Update successful"
  305. Then I follow "Multiple registration"
  306. Then I select "Costea Andrea (acostea)" from "nosessionUsersList[]"
  307. And I press "add_user"
  308. And I press "next"
  309. Then I should see "Update successful"
  310. Scenario: Try exercise with categorized questions as student
  311. Given I am a student
  312. And I am on course "TEMP" homepage in session "Session Exercise"
  313. Then I should see "TEMP (Session Exercise)"
  314. And I am on "/main/exercise/exercise.php?cidReq=TEMP"
  315. And I follow "Exercise for Behat test"
  316. And I follow "Start test"
  317. When wait for the page to be loaded
  318. And I press "Next question"
  319. And I check "oligarchy"
  320. And I check "oligopoly"
  321. And I check "timocracy"
  322. And I check "autocracy"
  323. And I press "Next question"
  324. And I check the "semantics" radio button
  325. And I press "Next question"
  326. And I check the "RNASL" radio button
  327. And I press "Next question"
  328. And I check the "10" radio button
  329. And I press "Next question"
  330. And fill in the following:
  331. | choice_id_6_0 | words |
  332. | choice_id_6_1 | fill |
  333. | choice_id_6_2 | blanks |
  334. And I press "Next question"
  335. And I select "A" from "choice_id_7_1"
  336. And I select "B" from "choice_id_7_2"
  337. And I select "C" from "choice_id_7_3"
  338. And I press "Next question"
  339. And wait for the page to be loaded
  340. And I check "1"
  341. And I press "Next question"
  342. And wait for the page to be loaded
  343. And I press "End test"
  344. Then I should see "Score for the test: 190 / 190"
  345. And I should see the table "#category_results":
  346. | Categories | Absolute score | Relative score |
  347. | Categoryname2 | 50 / 70 | 71.43% |
  348. | Categoryname1 | 60 / 60 | 100% |
  349. | none | 80 / 60 | 133.33% |
  350. | Total | 190 / 190 | 100% |
  351. Scenario: Teacher looks at exercise results by categories
  352. Given I am on "/user_portal.php"
  353. And I am on course "TEMP" homepage in session "Session Exercise"
  354. Then I should see "TEMP (Session Exercise)"
  355. And I am on "/main/exercise/exercise.php?cidReq=TEMP"
  356. And I follow "Exercise for Behat test"
  357. And I follow "Results and feedback"
  358. Then I should see "Learner score"
  359. And wait very long for the page to be loaded
  360. And I follow "Grade activity"
  361. Then I should see "Score for the test: 190 / 190"
  362. And I should see the table "#category_results":
  363. | Categories | Absolute score | Relative score |
  364. | Categoryname2 | 50 / 70 | 71.43% |
  365. | Categoryname1 | 60 / 60 | 100% |
  366. | none | 80 / 60 | 133.33% |
  367. | Total | 190 / 190 | 100% |
  368. Scenario: Delete an exercise
  369. Given I am on "/main/exercise/exercise.php?cidReq=TEMP"
  370. And I follow "Delete"
  371. And I confirm the popup
  372. Then I should see "The test has been deleted"
  373. Scenario: Delete an exercise category
  374. Given I am on "/main/exercise/tests_category.php?cidReq=TEMP"
  375. And I follow "Delete"
  376. Then I should see "Category deleted"
  377. Scenario: Delete an exercise category
  378. Given I am on "/main/exercise/tests_category.php?cidReq=TEMP"
  379. And I follow "Delete"
  380. Then I should see "Category deleted"
  381. Scenario: Delete session
  382. Given I am on "/main/session/session_list.php?keyword=Session+Exercise"
  383. And wait for the page to be loaded
  384. And I follow "Delete"
  385. And I confirm the popup
  386. Then I should see "Deleted"