CSC/ECE 517 Spring 2018/E1814 Write unit tests for collusion cycle.rb

From Expertiza_Wiki
Revision as of 16:36, 1 April 2018 by Rjmontgo (talk | contribs)
Jump to navigation Jump to search

Introduction

Team

Zhewei Hu (zhu6) (mentor)

  • Cameron Nelson (cenelso3)
  • Peter Shore (pnshore)
  • Robert Montgomery (rjmontgo)

Background

Expertiza

Expertiza is an open source project that can be used by instructors to create assignments and assign them to students. Students can manage teams for the assignment and submit work for each of the assignments. After the students have submitted their work they can review other student's work to facilitate grading. The project is based on the Ruby on Rails framework. You can find our GitHub Repo to view our work.

Collusion Cycles

The collusion cycle model is used to handle situations where a cycle is created when students are reviewing each other's work. The cycles in the review relationships are common since each assignment to review is randomly selected. The collusion cycle model calculates the assignment scores from the reviewers as well as other statistics such as similarity and difference between each score. The model is built to handle two, three, and four node cycles where each node represents a student.

Motivation

Achieving good coverage with quality tests is part of a good development process. The collusion_cycle.rb class is used to calculate the grade received based on the reviews from other students as well as handle cases where the reviewer is also reviewed by the reviewee effectively creating a cycle. We want to test this class to achieve good coverage in order to catch possible bugs in the program and ensure that it works correctly.

Test Plan

Tasks Identified

  • Test Two Node Cycle
  • Test Three Node Cycle
  • Test Four Node Cycle
  • Test Cycle Similarity Score
  • Test Cycle Deviation Score

Writing the Cycle Tests

Each of the cycle tests

Impact Analysis

Currently, we have already found one bug, which was a missing parameter in the collusion_cycle.rb file with each of the node_cycle methods (two_node_cycle, three_node_cycle, four_node_cycle) which needed an assignmentparticipant parameter to be passed in for the function to even work. In addition the obvious benefit of adding more coverage you a better assurance that the code works well. Of course testing does not guarantee that the code works, but can only be used to find where the code does not work.

Running the Test Files

To run the test files you need to clone the repository in an Expertiza environment Expertiza Github. Instructions for creating an appropriate Expertiza environment can be found in the README file in the Expertiza GitHub repository.

Once you have the Expertiza repository setup make sure you are in the root directory of the app and run `rspec spec/models/collusion_cycle_spec.rb`

Future Work

Because the scope of this addition is relatively small, and we have tested all possible branches within the code there is not much future work to do other than possibly refactor the code with a more efficient tool. Test coverage through quality tests consistently added throughout the development of the Expertiza project should be the future work of the project.