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

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
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.
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


== Files modified in current project ==
* 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:
A model and a rspec file were modified for this project namely:


1. student_task.rb
* 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:


2. student_task_spec.rb
<pre>


'''student_task.rb'''
rspec spec/models/student_task_spec.rb


</pre>
After that, you can see the detailed coverage information by opening this file in your Expertiza folder.
<pre>
coverage/index.html
</pre>




Line 31: Line 56:
The following tasks were accomplished in this project:
The following tasks were accomplished in this project:


1- Complete the insufficient unit tests for student_task.rb.  
* Complete the insufficient unit tests for student_task.rb.  


2- Increase path coverage from only 43.0% with 43 lines covered and 57 lines missed to above 90%.
* Increase path coverage from only 43.0% with 43 lines covered and 57 lines missed to above 90%.


3- Cover edge cases.
* Cover edge cases.


4- High branch coverage to be achieved.
* High branch coverage to be achieved.




Line 49: Line 74:


<pre>
<pre>


bundle install
bundle install
Line 55: Line 79:
rake db:migrate
rake db:migrate
rails s
rails s


</pre>
</pre>

Revision as of 04:55, 24 October 2019

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.


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.


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.


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