From 3569920982889a1165cf993363ec382d872081d2 Mon Sep 17 00:00:00 2001 From: andelacruz Date: Wed, 23 Jul 2025 20:16:21 +0800 Subject: [PATCH 1/2] MDL-85674 mod_grade: Behat test for multiple questions manual grading --- .../grading/tests/behat/grading.feature | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/mod/quiz/report/grading/tests/behat/grading.feature b/mod/quiz/report/grading/tests/behat/grading.feature index 6e0f76a827c..cfb18005ca1 100644 --- a/mod/quiz/report/grading/tests/behat/grading.feature +++ b/mod/quiz/report/grading/tests/behat/grading.feature @@ -213,3 +213,54 @@ Feature: Basic use of the Manual grading report Then I should see "Grading attempts 1 to 1 of 2" And I press "Save and show next" And I should see "Grading attempts 2 to 2 of 2" + + @javascript + Scenario: Manually grade quiz with multiple questions + Given the following "questions" exist: + | questioncategory | qtype | name | questiontext | defaultmark | + | Test questions | essay | Essay 1 | First question | 20 | + | Test questions | essay | Essay 2 | Second question | 20 | + | Test questions | truefalse | TF1 | Third question | | + And quiz "Quiz 2" contains the following questions: + | question | page | + | Essay 1 | 1 | + | Essay 2 | 2 | + | TF1 | 2 | + And user "student1" has attempted "Quiz 2" with responses: + | slot | response | + | 1 | Answer to Essay 1 | + | 2 | Answer to Essay 2 | + | 3 | True | + And I am on the "Quiz 2 > student1 > Attempt 1" "mod_quiz > Attempt review" page logged in as "teacher1" + And I follow "Make comment or override mark" + And I switch to "commentquestion" window + And I set the field "Mark" to "15" + And I press "Save" and switch to main window + When I am on the "Quiz 2" "mod_quiz > Manual grading report" page + And I click on "Also show questions that have been graded automatically" "link" + # Confirm that Essay 1 is already graded. + Then "Essay 1" row "To grade" column of "questionstograde" table should contain "0" + And "Essay 1" row "Already graded" column of "questionstograde" table should contain "1" + And "Essay 1" row "Automatically graded" column of "questionstograde" table should contain "0" + # Confirm that Essay 2 is not yet graded. + And "Essay 2" row "To grade" column of "questionstograde" table should contain "1" + And "Essay 2" row "Already graded" column of "questionstograde" table should contain "0" + And "Essay 2" row "Automatically graded" column of "questionstograde" table should contain "0" + # Confirm that TF1 is automatically graded. + And "TF1" row "To grade" column of "questionstograde" table should contain "0" + And "TF1" row "Already graded" column of "questionstograde" table should contain "0" + And "TF1" row "Automatically graded" column of "questionstograde" table should contain "1" + # Grade the not yet graded Essay 2. + And I click on "Grade" "link" in the "2" "table_row" + And I set the field "Mark" to "20" + And I press "Save and show next" + And I am on the "Quiz 2" "mod_quiz > Manual grading report" page + # Update the already graded Essay 1. + And I click on "grade all" "link" in the "1" "table_row" + And I set the field "Mark" to "5" + And I press "Save and show next" + # Confirm that each question is graded for the corresponding student. + And I am on the "Quiz 2" "mod_quiz > Grades report" page + And "S1 Student1" row "Q. 1" column of "generaltable" table should contain "12.50" + And "S1 Student1" row "Q. 2" column of "generaltable" table should contain "50.00" + And "S1 Student1" row "Q. 3" column of "generaltable" table should contain "-" From 292a559fd7bbc518dc0b58576d1af6ff82830ba7 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Wed, 6 Aug 2025 17:40:06 +0800 Subject: [PATCH 2/2] MDL-85674 behat: replace multiple steps by a single table step --- .../grading/tests/behat/grading.feature | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/mod/quiz/report/grading/tests/behat/grading.feature b/mod/quiz/report/grading/tests/behat/grading.feature index cfb18005ca1..77b8281240b 100644 --- a/mod/quiz/report/grading/tests/behat/grading.feature +++ b/mod/quiz/report/grading/tests/behat/grading.feature @@ -238,29 +238,22 @@ Feature: Basic use of the Manual grading report And I press "Save" and switch to main window When I am on the "Quiz 2" "mod_quiz > Manual grading report" page And I click on "Also show questions that have been graded automatically" "link" - # Confirm that Essay 1 is already graded. - Then "Essay 1" row "To grade" column of "questionstograde" table should contain "0" - And "Essay 1" row "Already graded" column of "questionstograde" table should contain "1" - And "Essay 1" row "Automatically graded" column of "questionstograde" table should contain "0" - # Confirm that Essay 2 is not yet graded. - And "Essay 2" row "To grade" column of "questionstograde" table should contain "1" - And "Essay 2" row "Already graded" column of "questionstograde" table should contain "0" - And "Essay 2" row "Automatically graded" column of "questionstograde" table should contain "0" - # Confirm that TF1 is automatically graded. - And "TF1" row "To grade" column of "questionstograde" table should contain "0" - And "TF1" row "Already graded" column of "questionstograde" table should contain "0" - And "TF1" row "Automatically graded" column of "questionstograde" table should contain "1" + # Confirm that Essay 1 is already graded, Essay 2 is not yet graded and that TF1 is automatically graded. + Then the following should exist in the "questionstograde" table: + | Question name | To grade | Already graded | Automatically graded | + | Essay 1 | 0 | 1 | 0 | + | Essay 2 | 1 | 0 | 0 | + | TF1 | 0 | 0 | 1 | # Grade the not yet graded Essay 2. And I click on "Grade" "link" in the "2" "table_row" And I set the field "Mark" to "20" And I press "Save and show next" - And I am on the "Quiz 2" "mod_quiz > Manual grading report" page # Update the already graded Essay 1. And I click on "grade all" "link" in the "1" "table_row" And I set the field "Mark" to "5" And I press "Save and show next" # Confirm that each question is graded for the corresponding student. And I am on the "Quiz 2" "mod_quiz > Grades report" page - And "S1 Student1" row "Q. 1" column of "generaltable" table should contain "12.50" - And "S1 Student1" row "Q. 2" column of "generaltable" table should contain "50.00" - And "S1 Student1" row "Q. 3" column of "generaltable" table should contain "-" + And the following should exist in the "generaltable" table: + | Username | Q. 1 | Q. 2 | Q. 3 | + | student1 | 12.50 | 50.00 | - |