CSC/ECE 517 Fall 2020 - E2062. Add test cases to review mapping helper.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 128: Line 128:
=== link_updated_since_last? ===
=== link_updated_since_last? ===


This methods checks if the link submitted for evaluation has been updated since the last round.
This methods checks if the link submitted for evaluation has been updated or not since the last round. The method returns false if it's not updated and true otherwise


'''Setup'''
'''Setup'''

Revision as of 22:31, 13 October 2020

Project Introduction

The ReviewMappingHelper is a helper class that is responsible for mapping reviews and feedback to reviewers and assignment teams. Additionally, this helper class reports of the status of project reviews.

Team

Courtney Ripoll (ctripoll)

Rohit Nair (rnair2)

Prasanth Yadla (pyadla2)

Project Goal

The goal of this project was to add RSpec tests for the functionality added for project CSC/ECE 517 Fall 2019 - E1948. Refactor review mapping helper.rb. The changes submitted by project E1948 can be found here. See the Test Outline section to see the specifics of our testing work.

Files Involved

review_mapping_helper.rb

review_mapping_helper_spec.rb

Running Tests

  rspec spec/helpers/review_mapping_helper_spec.rb

Test Plan

In total, our team wrote 34 tests to cover the 8 new methods created or altered methods in project E1948 for ReviewMappingHelper.

ReviewMappingHelper Relevant Methods

  • get_review_volume
  • get_team_color
  • obtain_team_color
  • link_updated_since_last?
  • get_each_review_and_feedback_response_map
  • get_awarded_review_score
  • check_submission_state
  • feedback_response_map_record
  • get_team_color

Test Outline

This section shows the RSpec test we created for each of the methods defined in Relevant Methods above. The full test file can be found here.


get_team_color

This method gets the team name's color according to review and assignment submission status.

Setup

Tests

get_each_review_and_feedback_response_map

This method gets review and feedback responses for all rounds for the feedback report.

Setup

Tests

get_awarded_review_score

This method gets the review score awarded based on each round of the review.

Setup

Tests

check_submission_state

This method checks the submission state within each round and assigns team color accordingly.

Setup

Tests

feedback_response_map_record

This method is a helper method for get_each_review_and_feedback_response_map. It sets the instance variables @review_responses_round_ and @feedback_response_maps_round_ after calculating the number of responses received by the team after each round.

Setup

Tests

get_review_volume

This method is a helper method for _team_score.html.erb view. It sets the metrics, namely min, max and avg score value for all reviews for a particular round and team. It uses the pre-populated instance variable @avg_and_ranges and makes new instance variables @min, @max, @avg and sets the latter values to the corresponding value from the former.

Setup

Tests

link_updated_since_last?

This methods checks if the link submitted for evaluation has been updated or not since the last round. The method returns false if it's not updated and true otherwise

Setup

Tests

obtain_team_color

This method calls check_submission_state to get the color in each of rounds and returns the value of the color at the end of the stack accumulated.

Setup

Tests

Results

34 out of 34 tests in the review_mapping_helper_spec.rb test file.

Our code changes can be viewed here.

URL link of video of review_mapping_helper_spec.rb tests running and passing:- https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view

Relevant Links

Main Expertiza Repository can be found here.

Our forked Repository can be found here.

Extra Tasks

In addition to adding new test cases to ReviewMappingHelper, we implemented two other changes to the Expertiza code.

Refactoring Methods

  • We refactored get_review_metrics to get_review_volume, as per request from the professor

  • We refactored get_team_colour & obtain_team_colour to read get_team_color & obtain_team_color, as per request from the professor

  • We refactored calcutate_average_author_feedback_score to calculate_average_author_feedback_score, as per request from the professor

Fixing Code

  • The use of the "dig" method in Expertiza was causing failures in the Travis build because the "dig" method is supported after ruby version 2.3 and expertiza uses ruby version 2.2.7. We fixed this by replacing "dig" with an equivalent dictionary accessing code in the methods get_awarded_review_score and get_review_volume.