CSC/ECE 517 Fall 2021 - E2166. Testing - Scoring & Grades: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 273: Line 273:


*Test Cases Added:
*Test Cases Added:
[[File:n3.png|border|1000px]]
[[File:n_3.png|border|1000px]]


=== done_by_staff_participant? ===
=== done_by_staff_participant? ===

Revision as of 23:38, 30 November 2021

Project Overview

In Expertiza, scoring and grades are a large part of its implement that benefit for both instructor and students. They play important role for students to examine others' work and for the instructor to grade students' performance. However, they are not fully tested and considered thoroughly. The main purpose of this project is to refactor grades in beta and adding test cases would be the method to do so.

Objectives

Our objectives for this project are the following:

  • Develop the files below further to cover missing methods and lines.
  • Write extra tests to cover any edge cases that may need to be considered.
  • Increase the coverage of the spec.

Files Involved and original coverage

  • Grades_controller_spec [here]-86%covered
  • Grades_helper_spec [here]-58%covered
  • Response_spec [here]-86.4%covered

Run the file

  rspec ./spec/helpers/Grades_helper_spec.rb
  rspec ./spec/controller/Grades_controller_spec.rb
  rsepc ./spec/model/Response_spec.rb

Test Plan

We look into these file and their related functions. The initial coverage is high, but we still want to add more test cases to cover almost every situation. Therefore, the functions below are what we plan to work on in this project. We are going to run the initial code first and see which lines are not executed and add the corresponding test cases to increase the coverage.

Relevant Methods

Grades_controller_spec

  • action_allowed
  • update
  • save_grade_and_comment_for_submission
  • self_review_finished

Grades_helper_spec

  • accordion_title(last_topic, new_topic)
  • has_team_and_metareview
  • view_heatgrid(participant_id, type)

Response_spec

  • maximum_score
  • email
  • populate_new_response
  • questionnaire_by_answer

GradesController_spec

action_allowed

This function allows students to view their score and view their team by checking if current user has student privilege. We plan to add test on method of allowing current user to view team. If current user is a student, user id is expected to be found in AssignmentParticipant.


  • Initial Coverage:


  • Test Cases Added:

update

In this function, it returns a message depending on whether the participant grade is nil or not and redirects to a edit action. We plan to add test on computing the message if the participant score is not nil, it is expected to print a sentence like "A score of ... has been saved for ...".



  • Initial Coverage:


  • Test Cases Added:

save_grade_and_comment_for_submission

This function saves the grade and comment after submission. We plan to add a test case that fails to save the submission. When we look up in flash, it is expected to be "$ERROR_INFO".



  • Initial Coverage:


  • Test Cases Added:


self_review_finished

This is a boolean function that tells if the students finished their self reviews or not. We plan to add a test case that shows if the system enables student to self review, which means the student hasn't submit the self review and the test is expected to get false.




  • Initial Coverage:


  • Problem:

The self_review_finished method is a private method, difficult to test every scenarios through the public interface.

GradesHelper_spec

accordion_title(last_topic, new_topic)

This function would render different view according to the comparison of last_topic and new_topic. We plan to create three contexts to test it as below:

1. When last_topic is empty, the function should return view which contains the new_topic
2. last_topic doesn't equal to new_topic, the function should return view which contains the new_topic
3. Other situation, the function should return nothing




  • Initial status:


  • Test cases added:



has_team_and_metareview?

In this function, we plan to complete cases to cover all the function. The cases include: 1. When an assignment is a team assignment and has meta review, the return values should contain true_num = 2. 2. When an assignment is a team assignment or has meta review, the return values should contain true_num = 1. 3. When an assignment is a personal assignment and doesn't has meta review, the return values should contain true_num = 0.


  • Initial status:


  • Test cases added





view_heatgrid(participant_id, type)

This function would get all the questionnaires belonging to a participant, and filter questionnaires according to 'type' parameter, and then collect questionnaire to render the target view So, we plan to check if the return value only contends the certain type of questionnaires.

  • Initial Coverage:


  • Test cases added:

penalty

This function would calcualte the penalties of an assignment. We plan to give an assignment and check if its field 'is_penalty_calculated' change to 'true'

  • Initial Coverage:



  • Latest Coverage:



  • Test Cases Added:

Response_spec

maximum_score

This function returns the highest possible score for this response, and it only accepts the scorable question and non nil answer. We plan to add a test case that a response doesn't have any score, in this case, total_weight is expected to remain 0 and result should be 0 as well.


  • Initial Coverage:


  • Latest Coverage:

  • Test Cases Added:

File:Max.jpg

email

This function finds out which kind of survey is it and searches the parent of the result. Parent is used as a common variable name for either an assignment or a course. We plan to add test case that the type of survey is associated with course, so we would directly get the assignment from participant, which is the response of course survey.



  • Initial Coverage:


  • Latest Coverage:

  • Test Cases Added:

File:Emailtest.jpg

populate_new_response

This function returns a Response object used to populate @response instance object with the correct response according to review round or with a new response object that the controller can use. We plan to add test case that concludes three scenarios: A response exists after the latest submission, A response exists before the latest submission, No response exists in current submission. For the first case, it is expected to get the original response. As for the rest, it is expected to populate new response.


  • Initial Coverage:

  • Latest Coverage:


  • Test Cases Added:

File:Populatetest.jpeg

questionnaire_by_answer

In this function, a questionnaire can be found by its answer, and this assignment can be gotten through either participant or map. We plan to add a test case that is to obtain the assignment through participant by a given answer.

  • Initial Coverage:


  • Latest Coverage:

  • Test Cases Added:

File:Questionnairetest.jpeg

delete

  • Initial Coverage:

  • Latest Coverage:

  • Test Cases Added:

self.calibration_results_info(calibration_id, response_id, assignment_id)

  • Initial Coverage:

  • Latest Coverage:

  • Test Cases Added:

File:S3.jpg

notify_instructor_on_difference

  • Initial Coverage:

  • Latest Coverage:

  • Test Cases Added:

done_by_staff_participant?

  • Initial Coverage:

  • Latest Coverage:

  • Test Cases Added:

File:Do3.jpg

dispaly_as_html(prefix = nil, count = nil, _file_url = nil, show_tags = nil, current_user = nil)

  • Initial Coverage:

File:Di1.jpg

  • Latest Coverage:

  • Test Cases Added:

File:Di3.jpg

construct_review_response(code, self_id, show_tags = nil, current_user = nil)

  • Initial Coverage:

  • Latest Coverage:

  • Test Cases Added:

Results

Collaborators

  • Li Yu Shan (lshan3)
  • Chao Ting Hung (chung4)
  • Chen Ni Liu (cliu43)
  • Kan No Lee (klee32)

Relevant Links

Main Expertiza Repository can be found here.

Our forked Repository can be found here.