E1921 Write tests for popup controller.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:


=== Team ===
=== Team ===
Yuhan Chen, ychen239
Hao Lu, hlu6
Drew Marshburn, rdmarshb


=== Files Involved ===  
=== Files Involved ===  

Latest revision as of 20:32, 25 March 2019

The goal of this project was to add testing for the PopupController to raise statement coverage above 90%. See the Test Outline section for specifics of our work.

Project Introduction

The PopupController is responsible for preparing data that will be displayed in popup views. To render the data, which mostly concerns assignments, the controller makes many accesses to database tables such as Response, ResponseMap, Question, Questionnaire, Answer, and Participant. Before our project, there were only two tests implemented that together only achieved a statement coverage of 7%. Our changes have brought the statement coverage to INSERT%.

Team

Yuhan Chen, ychen239

Hao Lu, hlu6

Drew Marshburn, rdmarshb

Files Involved

popup_controller.rb

popup_controller_spec.rb

Running Tests

What we need to do is to set up the environment and complete the 'popup_controller_spec.rb' to finish the integration tests for popup controller. This rspec test file can be run by calling the following code:

  rspec spec/controllers/popup_controller_spec.rb

Design

Test Outline

The following sections show the Rspec outline of the tests we created.

PopupController

    #action_allowed?
      when the role current user is student
        does not allow certain action
      when the role current user is ta
        allows certain action
      when the role name of current user is super admin or admin
        allows certain action
      when the role current user is super instructor
        allows certain action
   #author_feedback_popup
     when response_id exists

   #team_users_popup
     when a response map exists
       calculates response stats for one response
     when a response map does not exist
       finds team and users
   #participants_popup
     called with no response
       does not calculate scores
     called with a response
       assignment has a review questionnaire
         calculates the scores with a max
       assignment has no review questionnaire
         calculates the scores without a max
   tone analysis tests
     #tone_analysis_chart_popup
       review tone analysis is calculated
         prepares tone analysis report for building
     #build_tone_analysis_report
       upon selecting summery, the tone analysis for review comments is calculated and applied to the page
         builds a tone analysis report and returns the heat map URLs
     #view_review_scores_popup
       prepares tone analysis report for building
 
   #reviewer_details_popup
     it will show the reviewer details
       it will show the reviewer details
 
   #self_review_popup
     when response_id exists
       get the result

Results