CSC/ECE 517 Fall 2019 - E1955.Write unit tests for student task.rb

From Expertiza_Wiki
Revision as of 04:59, 24 October 2019 by Arungta (talk | contribs)
Jump to navigation Jump to search

This page provides a description of the Expertiza based OSS project.


About Expertiza

Expertiza is an open source project based on Ruby on Rails framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.

This project in particular intends that the students collaborate with each other and work on making enhancements to the code base by applying the concepts of Rails,RSpec, DRY code,Test driven development etc. This provides an opportunity for students to contribute to an open source project and learn further about software deployment etc.


About RSpec Ruby Code

RSpec is a unit test framework for the Ruby programming language. RSpec is different than traditional xUnit frameworks like JUnit because RSpec is a Behavior driven development tool. What this means is that, tests written in RSpec focus on the "behavior" of an application being tested. RSpec does not put emphasis on, how the application works but instead on how it behaves, in other words, what the application actually does.Each RSpec file contains one or more tests. Each test ensures if a particular feature of our website is working properly.The output of an RSpec run will tell you exactly what features aren't working. The benefit is that tested code is unlikely to break unnoticed.The tests are run every time someone makes, or updates, a Pull Request.


Description of the current project

The following is an Expertiza based OSS project which deals primarily with the student_task.rb and student_task_spec.rb. It focuses on writing RSpec unit tests for the code affected or added.The goal of this project is to attempt to add suffivient unit tests to this part of the application and increase its path coverage.

Team

Carmen Bentley,Mentor

  • Tushar Kundra,tusharkundra
  • Ram Chavali,ramlohith
  • Ayushi Rungta,Rungta1001

Files modified in current project

A model and a rspec file were modified for this project namely:

  • student_task.rb
  • student_task_spec.rb

Running Tests

What we need to do is to set up the environment and complete the 'student_task.rb' and 'student_task_spec.rb' to increase the path coverage from only 43.0% with 43 lines covered and 57 lines missed to above 90%.

You can run RSpec tests by executing the command:


rspec spec/models/student_task_spec.rb

After that, you can see the detailed coverage information by opening this file in your Expertiza folder.


coverage/index.html


Problem Statement

The following tasks were accomplished in this project:

  • Complete the insufficient unit tests for student_task.rb.
  • Increase path coverage from only 43.0% with 43 lines covered and 57 lines missed to above 90%.
  • Cover edge cases.
  • High branch coverage to be achieved.



Running the Project Locally

The project could be run locally by cloning the Github repository Expertiza and then running the following commands sequentially.


bundle install
rake db:create:all
rake db:migrate
rails s