CSC/ECE 517 Fall 2018/E1849 Write Unit Tests for vm question response.rb

From Expertiza_Wiki
Revision as of 04:39, 10 November 2018 by Jtgill (talk | contribs) (→‎Results)
Jump to navigation Jump to search

Introduction

VMQuestionResponse in Brief

This class acquires reviews from a given questionnaire and assignment, and creates a heat map visualization of the review scores a reviewee received from other people (reviewers) for an assignment.


Objective

There are currently no test cases for vm_question_response.rb. We seek to create unit tests to attain at least 90% coverage by line.

Team

Matt Leader (mfleader@ncsu.edu)

Jonathan Gill (jtgill@ncsu.edu)

Files Involved

app/models/vm_question_response.rb

spec/models/vm_question_response_spec.rb

Testing Plan

Testing Strategy: Unit Test

Testing VMQuestionResponse hinges upon collaboration verification, so that we know VMQuestionResponse is getting the right messages from the right classes, so that it can appropriately create its data structures.

We first went through each method of the VMQuestionResponse class and determined whether the method was a command, or query and whether the method was incoming, outgoing, or sent-to-self. For each method we will write tests for valid and invalid inputs as well as edge cases.

Here is an outline of our implementation strategy:

To describe VMQuestionResponse

1) Test initialize

  • in the context when VMQuestionResponse is initialized with a review questionnaire
  • in the context when VMQuestionResponse is initialized with any other questionnaire type

2) Test add questions

  • in the context when VMQuestionResponse is given a list of questions

3) Test add_reviews

  • in the context when VMQuestionResponse is initialized with a review questionnaire
  • in the context when VMQuestionResponse is initialized with a author feedback questionnaire
  • in the context when VMQuestionResponse is initialized with a teammate review questionnaire
  • in the context when VMQuestionResponse is initialized with a metareview questionnaire

4) Test display_team_members

5) Test add_team_members

6) Test listofteamparticipants

7) Test max_score_for_questionnaire

8) Test add_answer

9) Test get_number_of_comments_greater_than_10_words

Testing Implementation

  • initialize : This tests that the VmQuestionResponse is initialized with the appropriate round number.


  • add_reviews : This tests that the add_review adds reviews and reviewers to the VmQuestionResponse from a given review
- stub simulates the


  • display_team_members : This tests that the VmQuestionResponse can print out the appropriate team member names.


  • add_answers : This tests that the VmQuestionResponse adds all of the review scores from its reviews to VmQuestionResponseCells

in VmQuestionResponseRows.



  • get_number_of_comments_greater_than_10_words : This tests that VmQuestionResponse only finds comments that have at least 10 words.

Results

We have now attained 97.25% coverage.

Links/Resources

spec/models/vm_question_response_spec.rb