CSC/ECE 517 Fall 2016/E1671. Unit Tests for participants.rb Hierarchy

From Expertiza_Wiki
Jump to navigation Jump to search

This wiki page is for the description of changes made under E1671 OSS assignment for Fall 2016, CSC/ECE 517.


Background

Expertiza is an open source web based peer review system developed and maintained by students and faculty members at North Carolina State University. It enables students enrolled in a particular course to form online teams and complete assignments.

Problem

The participant, course_participant and assignment_pariticipant models does not have any unit tests.

What to do

  • Create a Fatcory for assignment participant and course participant model.
  • Test the relationships and validations
  • Write model spec for major instances

Files modified/created

  • spec/factories/factories.rb
  • spec/models/participant_spec.rb
  • spec/models/assignment_participant_spec.rb
  • spec/models/course_participant_spec.rb

Unit test Description

Unit tests are used to test the functionality of methods in the model. These tests can be based on either test-driven development (TDD) or behavior-driven development (BDD). BDD is preferred for testing because it easy to understand compared to the more specialized TDD.<ref>https://www.toptal.com/freelance/your-boss-won-t-appreciate-tdd-try-bdd</ref> In this project, BDD is used to test the functionality using RSpec. RSpec is a testing tool for ruby using the BDD approach.<ref>https://semaphoreci.com/community/tutorials/getting-started-with-rspec</ref>

Run the test

The tests can be run on the terminal from inside the expertiza folder using following commands:

For participant:

 rspec spec/models/participant_spec.rb

For assignment_participant:

 rspec spec/models/assignment_participant_spec.rb

For participant:

 rspec spec/models/assignment_participant_spec.rb

References

1. https://github.com/expertiza/expertiza - Github link for original repository

2. https://en.wikipedia.org/wiki/RSpec - RSpec Tutorial on Wiki

3. https://github.com/jnicklas/capybara Capybara Documentation on Github