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
(Created page with "This page provides a description of the Expertiza based OSS project. == About Expertiza == [https://expertiza.ncsu.edu/ Expertiza] is an open source project based on [https://...")
 
No edit summary
Line 6: Line 6:
[https://expertiza.ncsu.edu/ Expertiza] is an open source project based on [https://rubyonrails.org/ 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.
[https://expertiza.ncsu.edu/ Expertiza] is an open source project based on [https://rubyonrails.org/ 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.


'''Motivation'''
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.




Line 42: Line 45:


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 [https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests Pull Request].
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 [https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests Pull Request].
== Running the Project Locally ==
The project could be run locally by cloning the Github repository [https://github.com/tusharkundra/expertiza Expertiza] and then running the following commands sequentially.
<pre>
.
.
bundle install
rake db:create:all
rake db:migrate
rails s
.
.
</pre>

Revision as of 04:34, 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.

Motivation

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.


Files modified in current project

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

1. student_task.rb

2. student_task_spec.rb

student_task.rb


Problem Statement

The following tasks were accomplished in this project:

1- 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%.

3- Cover edge cases.

4- 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
.
.