<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mzhang18</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mzhang18"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Mzhang18"/>
	<updated>2026-09-30T15:14:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100269</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100269"/>
		<updated>2015-12-05T03:29:31Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Testing Tools and Concepts''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/ Capybara page]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara github page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; # Make the Capybara DSL available in all integration tests &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; include Capybara::DSL &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt; end &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing&amp;lt;ref&amp;gt;[https://msdn.microsoft.com/en-us/library/aa292128(v=vs.71).aspx Integration test]&amp;lt;/ref&amp;gt; is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component. A component, in this time, refers to an integrated aggregate of more than one unit. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups.&lt;br /&gt;
* '''Big Bang for Integration test '''&lt;br /&gt;
&lt;br /&gt;
Big Bang&amp;lt;ref&amp;gt;[http://www.tutorialspoint.com/software_testing_dictionary/big_bang_testing.htm Big Bang]&amp;lt;/ref&amp;gt; Integration Testing is an integration testing strategy wherein all units are linked at once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult to isolate any errors found, because attention is not paid to verifying the interfaces across individual units.&lt;br /&gt;
&lt;br /&gt;
* '''Two apporachs: Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
•The top-down approach to integration testing requires the highest-level modules be test and integrated first. This allows high-level logic and data flow to be tested early in the process and it tends to minimize the need for drivers. However, the need for stubs complicates test management and low-level utilities are tested relatively late in the development cycle. Another disadvantage of top-down integration testing is its poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
•The bottom-up approach requires the lowest-level units be tested and integrated first. These units are frequently referred to as utility modules. By using this approach, utility modules are tested early in the development process and the need for stubs is minimized. The downside, however, is that the need for drivers complicates test management and high-level logic and data flow are tested late. Like the top-down approach, the bottom-up approach also provides poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Modifying factories''' ==&lt;br /&gt;
Factory_girl&amp;lt;ref&amp;gt;[https://github.com/thoughtbot/factory_girl]&amp;lt;/ref&amp;gt; is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.&lt;br /&gt;
The file listed below is used for modifying factories for test.&lt;br /&gt;
* /expertiza/spec/factories/factories.rb&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify course data.&lt;br /&gt;
&lt;br /&gt;
  factory :course ,class:Course do&lt;br /&gt;
    name &amp;quot;CSC 517 Fall 2009&amp;quot;&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    directory_path &amp;quot;csc517/f09&amp;quot;&lt;br /&gt;
    info &amp;quot;Object-Oriented Languages and Systems&amp;quot;&lt;br /&gt;
    private true&lt;br /&gt;
    institutions_id nil&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify assignment data.&lt;br /&gt;
&lt;br /&gt;
  factory :assignment ,class:Assignment do&lt;br /&gt;
    name &amp;quot;final2&amp;quot;&lt;br /&gt;
    directory_path &amp;quot;try&amp;quot; &lt;br /&gt;
    submitter_count 0 &lt;br /&gt;
    course&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    private false&lt;br /&gt;
    num_reviews 0&lt;br /&gt;
    num_review_of_reviews 0&lt;br /&gt;
    num_review_of_reviewers 0&lt;br /&gt;
    review_questionnaire_id nil&lt;br /&gt;
    review_of_review_questionnaire_id nil&lt;br /&gt;
    teammate_review_questionnaire_id nil&lt;br /&gt;
    reviews_visible_to_all false&lt;br /&gt;
    association  :wiki_type ,:factory =&amp;gt; :wikitype&lt;br /&gt;
    num_reviewers 0&lt;br /&gt;
    spec_location &amp;quot;bfbfb&amp;quot;&lt;br /&gt;
    author_feedback_questionnaire_id nil&lt;br /&gt;
    max_team_size 3&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to set due date.&lt;br /&gt;
&lt;br /&gt;
  factory :due_date ,class:DueDate do&lt;br /&gt;
    due_at  &amp;quot;2015-12-30 23:30:12&amp;quot;&lt;br /&gt;
    association :deadline_type, :factory =&amp;gt; :deadline_type,strategy: :build &lt;br /&gt;
    assignment { Assignment.first || association(:assignment)}   &lt;br /&gt;
    submission_allowed_id nil&lt;br /&gt;
    review_allowed_id  nil&lt;br /&gt;
    resubmission_allowed_id  nil&lt;br /&gt;
    rereview_allowed_id  nil&lt;br /&gt;
    review_of_review_allowed_id  nil&lt;br /&gt;
    round  1&lt;br /&gt;
    flag  false&lt;br /&gt;
    threshold  1&lt;br /&gt;
    delayed_job_id  nil&lt;br /&gt;
    deadline_name  nil&lt;br /&gt;
    description_url nil&lt;br /&gt;
    quiz_allowed_id nil&lt;br /&gt;
    teammate_review_allowed_id nil&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing Scenario''' ==&lt;br /&gt;
Using Capybara to test expertize by simulating how a real user would do to form or join a team. &lt;br /&gt;
The file listed below is used for simulating uses` behavior.&lt;br /&gt;
* /expertiza/spec/features/team_creation_spec.rb&lt;br /&gt;
&lt;br /&gt;
Simulating one student creates a team and send an invitation to another student, and the other one accept this.&lt;br /&gt;
&lt;br /&gt;
  it 'one student should send invitation and the other student should accept' do&lt;br /&gt;
  student=User.find_by_name(&amp;quot;student2064&amp;quot;)  &lt;br /&gt;
  role=student.role&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_user).and_return(student)&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role_name).and_return('Student')&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role).and_return(role)&lt;br /&gt;
  visit '/student_task/list'&lt;br /&gt;
  expect(page).to have_content('final2')&lt;br /&gt;
  click_link 'final2'&lt;br /&gt;
  expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
  click_link 'Signup sheet'&lt;br /&gt;
  expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
  visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=1'&lt;br /&gt;
  expect(page).to have_content('Your topic(s)')&lt;br /&gt;
  visit '/student_task/list'&lt;br /&gt;
  expect(page).to have_content('final2')&lt;br /&gt;
  click_link 'final2'&lt;br /&gt;
  click_link 'Your team'&lt;br /&gt;
  expect(page).to have_content('final2_Team1')&lt;br /&gt;
  fill_in 'user_name', with:'student2065'&lt;br /&gt;
  click_button 'Invite'&lt;br /&gt;
  expect(page).to have_content('student2065') &lt;br /&gt;
  student=User.find_by_name(&amp;quot;student2065&amp;quot;)  &lt;br /&gt;
  role=student.role&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_user).and_return(student)&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role_name).and_return('Student')&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role).and_return(role)&lt;br /&gt;
  visit '/student_task/list'&lt;br /&gt;
  expect(page).to have_content('final2')&lt;br /&gt;
  click_link 'final2'&lt;br /&gt;
  click_link 'Your team'&lt;br /&gt;
  #expect(page).to have_content('student2064') &lt;br /&gt;
  visit '/invitation/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
  expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100267</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100267"/>
		<updated>2015-12-05T03:27:14Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Testing Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Testing Tools and Concepts''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/ Capybara page]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara github page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; # Make the Capybara DSL available in all integration tests &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; include Capybara::DSL &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt; end &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing&amp;lt;ref&amp;gt;[https://msdn.microsoft.com/en-us/library/aa292128(v=vs.71).aspx Integration test]&amp;lt;/ref&amp;gt; is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component. A component, in this time, refers to an integrated aggregate of more than one unit. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups.&lt;br /&gt;
* '''Big Bang for Integration test '''&lt;br /&gt;
&lt;br /&gt;
Big Bang&amp;lt;ref&amp;gt;[http://www.tutorialspoint.com/software_testing_dictionary/big_bang_testing.htm Big Bang]&amp;lt;/ref&amp;gt; Integration Testing is an integration testing strategy wherein all units are linked at once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult to isolate any errors found, because attention is not paid to verifying the interfaces across individual units.&lt;br /&gt;
&lt;br /&gt;
* '''Two apporachs: Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
•The top-down approach to integration testing requires the highest-level modules be test and integrated first. This allows high-level logic and data flow to be tested early in the process and it tends to minimize the need for drivers. However, the need for stubs complicates test management and low-level utilities are tested relatively late in the development cycle. Another disadvantage of top-down integration testing is its poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
•The bottom-up approach requires the lowest-level units be tested and integrated first. These units are frequently referred to as utility modules. By using this approach, utility modules are tested early in the development process and the need for stubs is minimized. The downside, however, is that the need for drivers complicates test management and high-level logic and data flow are tested late. Like the top-down approach, the bottom-up approach also provides poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Modifying factories''' ==&lt;br /&gt;
Factory_girl&amp;lt;ref&amp;gt;[https://github.com/thoughtbot/factory_girl]&amp;lt;/ref&amp;gt; is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.&lt;br /&gt;
The file listed below is used for modifying factories for test.&lt;br /&gt;
* /expertiza/spec/factories/factories.rb&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify course data.&lt;br /&gt;
&lt;br /&gt;
  factory :course ,class:Course do&lt;br /&gt;
    name &amp;quot;CSC 517 Fall 2009&amp;quot;&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    directory_path &amp;quot;csc517/f09&amp;quot;&lt;br /&gt;
    info &amp;quot;Object-Oriented Languages and Systems&amp;quot;&lt;br /&gt;
    private true&lt;br /&gt;
    institutions_id nil&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify assignment data.&lt;br /&gt;
&lt;br /&gt;
  factory :assignment ,class:Assignment do&lt;br /&gt;
    name &amp;quot;final2&amp;quot;&lt;br /&gt;
    directory_path &amp;quot;try&amp;quot; &lt;br /&gt;
    submitter_count 0 &lt;br /&gt;
    course&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    private false&lt;br /&gt;
    num_reviews 0&lt;br /&gt;
    num_review_of_reviews 0&lt;br /&gt;
    num_review_of_reviewers 0&lt;br /&gt;
    review_questionnaire_id nil&lt;br /&gt;
    review_of_review_questionnaire_id nil&lt;br /&gt;
    teammate_review_questionnaire_id nil&lt;br /&gt;
    reviews_visible_to_all false&lt;br /&gt;
    association  :wiki_type ,:factory =&amp;gt; :wikitype&lt;br /&gt;
    num_reviewers 0&lt;br /&gt;
    spec_location &amp;quot;bfbfb&amp;quot;&lt;br /&gt;
    author_feedback_questionnaire_id nil&lt;br /&gt;
    max_team_size 3&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to set due date.&lt;br /&gt;
&lt;br /&gt;
  factory :due_date ,class:DueDate do&lt;br /&gt;
    due_at  &amp;quot;2015-12-30 23:30:12&amp;quot;&lt;br /&gt;
    association :deadline_type, :factory =&amp;gt; :deadline_type,strategy: :build &lt;br /&gt;
    assignment { Assignment.first || association(:assignment)}   &lt;br /&gt;
    submission_allowed_id nil&lt;br /&gt;
    review_allowed_id  nil&lt;br /&gt;
    resubmission_allowed_id  nil&lt;br /&gt;
    rereview_allowed_id  nil&lt;br /&gt;
    review_of_review_allowed_id  nil&lt;br /&gt;
    round  1&lt;br /&gt;
    flag  false&lt;br /&gt;
    threshold  1&lt;br /&gt;
    delayed_job_id  nil&lt;br /&gt;
    deadline_name  nil&lt;br /&gt;
    description_url nil&lt;br /&gt;
    quiz_allowed_id nil&lt;br /&gt;
    teammate_review_allowed_id nil&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing Scenario''' ==&lt;br /&gt;
Using Capybara to test expertize by simulating how a real user would do to form or join a team. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  it 'one student should send inviatation and the other student should accept' do&lt;br /&gt;
  student=User.find_by_name(&amp;quot;student2064&amp;quot;)  &lt;br /&gt;
  role=student.role&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_user).and_return(student)&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role_name).and_return('Student')&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role).and_return(role)&lt;br /&gt;
  visit '/student_task/list'&lt;br /&gt;
  expect(page).to have_content('final2')&lt;br /&gt;
  click_link 'final2'&lt;br /&gt;
  expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
  click_link 'Signup sheet'&lt;br /&gt;
  expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
  visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=1'&lt;br /&gt;
  expect(page).to have_content('Your topic(s)')&lt;br /&gt;
  visit '/student_task/list'&lt;br /&gt;
  expect(page).to have_content('final2')&lt;br /&gt;
  click_link 'final2'&lt;br /&gt;
  click_link 'Your team'&lt;br /&gt;
  expect(page).to have_content('final2_Team1')&lt;br /&gt;
  fill_in 'user_name', with:'student2065'&lt;br /&gt;
  click_button 'Invite'&lt;br /&gt;
  expect(page).to have_content('student2065') &lt;br /&gt;
  student=User.find_by_name(&amp;quot;student2065&amp;quot;)  &lt;br /&gt;
  role=student.role&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_user).and_return(student)&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role_name).and_return('Student')&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role).and_return(role)&lt;br /&gt;
  visit '/student_task/list'&lt;br /&gt;
  expect(page).to have_content('final2')&lt;br /&gt;
  click_link 'final2'&lt;br /&gt;
  click_link 'Your team'&lt;br /&gt;
  #expect(page).to have_content('student2064') &lt;br /&gt;
  visit '/invitation/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
  expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100265</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100265"/>
		<updated>2015-12-05T03:25:42Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Testing Tools and Concepts''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/ Capybara page]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara github page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; # Make the Capybara DSL available in all integration tests &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; include Capybara::DSL &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt; end &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing&amp;lt;ref&amp;gt;[https://msdn.microsoft.com/en-us/library/aa292128(v=vs.71).aspx Integration test]&amp;lt;/ref&amp;gt; is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component. A component, in this time, refers to an integrated aggregate of more than one unit. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups.&lt;br /&gt;
* '''Big Bang for Integration test '''&lt;br /&gt;
&lt;br /&gt;
Big Bang&amp;lt;ref&amp;gt;[http://www.tutorialspoint.com/software_testing_dictionary/big_bang_testing.htm Big Bang]&amp;lt;/ref&amp;gt; Integration Testing is an integration testing strategy wherein all units are linked at once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult to isolate any errors found, because attention is not paid to verifying the interfaces across individual units.&lt;br /&gt;
&lt;br /&gt;
* '''Two apporachs: Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
•The top-down approach to integration testing requires the highest-level modules be test and integrated first. This allows high-level logic and data flow to be tested early in the process and it tends to minimize the need for drivers. However, the need for stubs complicates test management and low-level utilities are tested relatively late in the development cycle. Another disadvantage of top-down integration testing is its poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
•The bottom-up approach requires the lowest-level units be tested and integrated first. These units are frequently referred to as utility modules. By using this approach, utility modules are tested early in the development process and the need for stubs is minimized. The downside, however, is that the need for drivers complicates test management and high-level logic and data flow are tested late. Like the top-down approach, the bottom-up approach also provides poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Modifying factories''' ==&lt;br /&gt;
Factory_girl&amp;lt;ref&amp;gt;[https://github.com/thoughtbot/factory_girl]&amp;lt;/ref&amp;gt; is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.&lt;br /&gt;
The file listed below is used for modifying factories for test.&lt;br /&gt;
* /expertiza/spec/factories/factories.rb&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify course data.&lt;br /&gt;
&lt;br /&gt;
  factory :course ,class:Course do&lt;br /&gt;
    name &amp;quot;CSC 517 Fall 2009&amp;quot;&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    directory_path &amp;quot;csc517/f09&amp;quot;&lt;br /&gt;
    info &amp;quot;Object-Oriented Languages and Systems&amp;quot;&lt;br /&gt;
    private true&lt;br /&gt;
    institutions_id nil&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify assignment data.&lt;br /&gt;
&lt;br /&gt;
  factory :assignment ,class:Assignment do&lt;br /&gt;
    name &amp;quot;final2&amp;quot;&lt;br /&gt;
    directory_path &amp;quot;try&amp;quot; &lt;br /&gt;
    submitter_count 0 &lt;br /&gt;
    course&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    private false&lt;br /&gt;
    num_reviews 0&lt;br /&gt;
    num_review_of_reviews 0&lt;br /&gt;
    num_review_of_reviewers 0&lt;br /&gt;
    review_questionnaire_id nil&lt;br /&gt;
    review_of_review_questionnaire_id nil&lt;br /&gt;
    teammate_review_questionnaire_id nil&lt;br /&gt;
    reviews_visible_to_all false&lt;br /&gt;
    association  :wiki_type ,:factory =&amp;gt; :wikitype&lt;br /&gt;
    num_reviewers 0&lt;br /&gt;
    spec_location &amp;quot;bfbfb&amp;quot;&lt;br /&gt;
    author_feedback_questionnaire_id nil&lt;br /&gt;
    max_team_size 3&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to set due date.&lt;br /&gt;
&lt;br /&gt;
  factory :due_date ,class:DueDate do&lt;br /&gt;
    due_at  &amp;quot;2015-12-30 23:30:12&amp;quot;&lt;br /&gt;
    association :deadline_type, :factory =&amp;gt; :deadline_type,strategy: :build &lt;br /&gt;
    assignment { Assignment.first || association(:assignment)}   &lt;br /&gt;
    submission_allowed_id nil&lt;br /&gt;
    review_allowed_id  nil&lt;br /&gt;
    resubmission_allowed_id  nil&lt;br /&gt;
    rereview_allowed_id  nil&lt;br /&gt;
    review_of_review_allowed_id  nil&lt;br /&gt;
    round  1&lt;br /&gt;
    flag  false&lt;br /&gt;
    threshold  1&lt;br /&gt;
    delayed_job_id  nil&lt;br /&gt;
    deadline_name  nil&lt;br /&gt;
    description_url nil&lt;br /&gt;
    quiz_allowed_id nil&lt;br /&gt;
    teammate_review_allowed_id nil&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing Scenario''' ==&lt;br /&gt;
&lt;br /&gt;
  it 'one student should send inviatation and the other student should accept' do&lt;br /&gt;
  student=User.find_by_name(&amp;quot;student2064&amp;quot;)  &lt;br /&gt;
  role=student.role&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_user).and_return(student)&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role_name).and_return('Student')&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role).and_return(role)&lt;br /&gt;
  visit '/student_task/list'&lt;br /&gt;
  expect(page).to have_content('final2')&lt;br /&gt;
  click_link 'final2'&lt;br /&gt;
  expect(page).to have_content('Submit or Review work for final2')&lt;br /&gt;
  click_link 'Signup sheet'&lt;br /&gt;
  expect(page).to have_content('Signup sheet for final2 assignment')&lt;br /&gt;
  visit '/sign_up_sheet/sign_up?assignment_id=1&amp;amp;id=1'&lt;br /&gt;
  expect(page).to have_content('Your topic(s)')&lt;br /&gt;
  visit '/student_task/list'&lt;br /&gt;
  expect(page).to have_content('final2')&lt;br /&gt;
  click_link 'final2'&lt;br /&gt;
  click_link 'Your team'&lt;br /&gt;
  expect(page).to have_content('final2_Team1')&lt;br /&gt;
  fill_in 'user_name', with:'student2065'&lt;br /&gt;
  click_button 'Invite'&lt;br /&gt;
  expect(page).to have_content('student2065') &lt;br /&gt;
  student=User.find_by_name(&amp;quot;student2065&amp;quot;)  &lt;br /&gt;
  role=student.role&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_user).and_return(student)&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role_name).and_return('Student')&lt;br /&gt;
  ApplicationController.any_instance.stub(:current_role).and_return(role)&lt;br /&gt;
  visit '/student_task/list'&lt;br /&gt;
  expect(page).to have_content('final2')&lt;br /&gt;
  click_link 'final2'&lt;br /&gt;
  click_link 'Your team'&lt;br /&gt;
  #expect(page).to have_content('student2064') &lt;br /&gt;
  visit '/invitation/accept?inv_id=1&amp;amp;student_id=1&amp;amp;team_id=0'&lt;br /&gt;
  expect(page).to have_content('Team Name: final2_Team1')&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100253</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100253"/>
		<updated>2015-12-05T02:57:28Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Modifying factories */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Testing Tools and Concepts''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/ Capybara page]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara github page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; # Make the Capybara DSL available in all integration tests &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; include Capybara::DSL &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt; end &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing&amp;lt;ref&amp;gt;[https://msdn.microsoft.com/en-us/library/aa292128(v=vs.71).aspx Integration test]&amp;lt;/ref&amp;gt; is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component. A component, in this time, refers to an integrated aggregate of more than one unit. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups.&lt;br /&gt;
* '''Big Bang for Integration test '''&lt;br /&gt;
&lt;br /&gt;
Big Bang&amp;lt;ref&amp;gt;[http://www.tutorialspoint.com/software_testing_dictionary/big_bang_testing.htm Big Bang]&amp;lt;/ref&amp;gt; Integration Testing is an integration testing strategy wherein all units are linked at once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult to isolate any errors found, because attention is not paid to verifying the interfaces across individual units.&lt;br /&gt;
&lt;br /&gt;
* '''Two apporachs: Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
•The top-down approach to integration testing requires the highest-level modules be test and integrated first. This allows high-level logic and data flow to be tested early in the process and it tends to minimize the need for drivers. However, the need for stubs complicates test management and low-level utilities are tested relatively late in the development cycle. Another disadvantage of top-down integration testing is its poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
•The bottom-up approach requires the lowest-level units be tested and integrated first. These units are frequently referred to as utility modules. By using this approach, utility modules are tested early in the development process and the need for stubs is minimized. The downside, however, is that the need for drivers complicates test management and high-level logic and data flow are tested late. Like the top-down approach, the bottom-up approach also provides poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Modifying factories''' ==&lt;br /&gt;
Factory_girl&amp;lt;ref&amp;gt;[https://github.com/thoughtbot/factory_girl]&amp;lt;/ref&amp;gt; is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.&lt;br /&gt;
The file listed below is used for modifying factories for test.&lt;br /&gt;
* /expertiza/spec/factories/factories.rb&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify course data.&lt;br /&gt;
&lt;br /&gt;
  factory :course ,class:Course do&lt;br /&gt;
    name &amp;quot;CSC 517 Fall 2009&amp;quot;&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    directory_path &amp;quot;csc517/f09&amp;quot;&lt;br /&gt;
    info &amp;quot;Object-Oriented Languages and Systems&amp;quot;&lt;br /&gt;
    private true&lt;br /&gt;
    institutions_id nil&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify assignment data.&lt;br /&gt;
&lt;br /&gt;
  factory :assignment ,class:Assignment do&lt;br /&gt;
    name &amp;quot;final2&amp;quot;&lt;br /&gt;
    directory_path &amp;quot;try&amp;quot; &lt;br /&gt;
    submitter_count 0 &lt;br /&gt;
    course&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    private false&lt;br /&gt;
    num_reviews 0&lt;br /&gt;
    num_review_of_reviews 0&lt;br /&gt;
    num_review_of_reviewers 0&lt;br /&gt;
    review_questionnaire_id nil&lt;br /&gt;
    review_of_review_questionnaire_id nil&lt;br /&gt;
    teammate_review_questionnaire_id nil&lt;br /&gt;
    reviews_visible_to_all false&lt;br /&gt;
    association  :wiki_type ,:factory =&amp;gt; :wikitype&lt;br /&gt;
    num_reviewers 0&lt;br /&gt;
    spec_location &amp;quot;bfbfb&amp;quot;&lt;br /&gt;
    author_feedback_questionnaire_id nil&lt;br /&gt;
    max_team_size 3&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to set due date.&lt;br /&gt;
&lt;br /&gt;
  factory :due_date ,class:DueDate do&lt;br /&gt;
    due_at  &amp;quot;2015-12-30 23:30:12&amp;quot;&lt;br /&gt;
    association :deadline_type, :factory =&amp;gt; :deadline_type,strategy: :build &lt;br /&gt;
    assignment { Assignment.first || association(:assignment)}   &lt;br /&gt;
    submission_allowed_id nil&lt;br /&gt;
    review_allowed_id  nil&lt;br /&gt;
    resubmission_allowed_id  nil&lt;br /&gt;
    rereview_allowed_id  nil&lt;br /&gt;
    review_of_review_allowed_id  nil&lt;br /&gt;
    round  1&lt;br /&gt;
    flag  false&lt;br /&gt;
    threshold  1&lt;br /&gt;
    delayed_job_id  nil&lt;br /&gt;
    deadline_name  nil&lt;br /&gt;
    description_url nil&lt;br /&gt;
    quiz_allowed_id nil&lt;br /&gt;
    teammate_review_allowed_id nil&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100246</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100246"/>
		<updated>2015-12-05T02:41:06Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Testing Tools and Concepts''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/ Capybara page]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara github page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; # Make the Capybara DSL available in all integration tests &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; include Capybara::DSL &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt; end &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing&amp;lt;ref&amp;gt;[https://msdn.microsoft.com/en-us/library/aa292128(v=vs.71).aspx Integration test]&amp;lt;/ref&amp;gt; is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component. A component, in this time, refers to an integrated aggregate of more than one unit. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups.&lt;br /&gt;
* '''Big Bang for Integration test '''&lt;br /&gt;
&lt;br /&gt;
Big Bang&amp;lt;ref&amp;gt;[http://www.tutorialspoint.com/software_testing_dictionary/big_bang_testing.htm Big Bang]&amp;lt;/ref&amp;gt; Integration Testing is an integration testing strategy wherein all units are linked at once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult to isolate any errors found, because attention is not paid to verifying the interfaces across individual units.&lt;br /&gt;
&lt;br /&gt;
* '''Two apporachs: Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
•The top-down approach to integration testing requires the highest-level modules be test and integrated first. This allows high-level logic and data flow to be tested early in the process and it tends to minimize the need for drivers. However, the need for stubs complicates test management and low-level utilities are tested relatively late in the development cycle. Another disadvantage of top-down integration testing is its poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
•The bottom-up approach requires the lowest-level units be tested and integrated first. These units are frequently referred to as utility modules. By using this approach, utility modules are tested early in the development process and the need for stubs is minimized. The downside, however, is that the need for drivers complicates test management and high-level logic and data flow are tested late. Like the top-down approach, the bottom-up approach also provides poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Modifying factories''' ==&lt;br /&gt;
Factory_girl&amp;lt;ref&amp;gt;[https://github.com/thoughtbot/factory_girl]&amp;lt;/ref&amp;gt; is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.&lt;br /&gt;
The file listed below is used for modifying factories for test.&lt;br /&gt;
* /expertiza/spec/factories/factories.rb&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify course data.&lt;br /&gt;
&lt;br /&gt;
  factory :course ,class:Course do&lt;br /&gt;
    name &amp;quot;CSC 517 Fall 2009&amp;quot;&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    directory_path &amp;quot;csc517/f09&amp;quot;&lt;br /&gt;
    info &amp;quot;Object-Oriented Languages and Systems&amp;quot;&lt;br /&gt;
    private true&lt;br /&gt;
    institutions_id nil&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Using factory_girl to modify assignment data.&lt;br /&gt;
&lt;br /&gt;
  factory :assignment ,class:Assignment do&lt;br /&gt;
    name &amp;quot;final2&amp;quot;&lt;br /&gt;
    directory_path &amp;quot;try&amp;quot; &lt;br /&gt;
    submitter_count 0 &lt;br /&gt;
    course&lt;br /&gt;
    instructor_id nil&lt;br /&gt;
    private false&lt;br /&gt;
    num_reviews 0&lt;br /&gt;
    num_review_of_reviews 0&lt;br /&gt;
    num_review_of_reviewers 0&lt;br /&gt;
    review_questionnaire_id nil&lt;br /&gt;
    review_of_review_questionnaire_id nil&lt;br /&gt;
    teammate_review_questionnaire_id nil&lt;br /&gt;
    reviews_visible_to_all false&lt;br /&gt;
    association  :wiki_type ,:factory =&amp;gt; :wikitype&lt;br /&gt;
    num_reviewers 0&lt;br /&gt;
    spec_location &amp;quot;bfbfb&amp;quot;&lt;br /&gt;
    author_feedback_questionnaire_id nil&lt;br /&gt;
    max_team_size 3&lt;br /&gt;
    ...&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100241</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100241"/>
		<updated>2015-12-05T02:25:16Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Testing Tools and Concepts''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/ Capybara page]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara github page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; # Make the Capybara DSL available in all integration tests &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; include Capybara::DSL &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt; end &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing&amp;lt;ref&amp;gt;[https://msdn.microsoft.com/en-us/library/aa292128(v=vs.71).aspx Integration test]&amp;lt;/ref&amp;gt; is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component. A component, in this time, refers to an integrated aggregate of more than one unit. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups.&lt;br /&gt;
* '''Big Bang for Integration test '''&lt;br /&gt;
&lt;br /&gt;
Big Bang&amp;lt;ref&amp;gt;[http://www.tutorialspoint.com/software_testing_dictionary/big_bang_testing.htm Big Bang]&amp;lt;/ref&amp;gt; Integration Testing is an integration testing strategy wherein all units are linked at once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult to isolate any errors found, because attention is not paid to verifying the interfaces across individual units.&lt;br /&gt;
&lt;br /&gt;
* '''Two apporachs: Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
•The top-down approach to integration testing requires the highest-level modules be test and integrated first. This allows high-level logic and data flow to be tested early in the process and it tends to minimize the need for drivers. However, the need for stubs complicates test management and low-level utilities are tested relatively late in the development cycle. Another disadvantage of top-down integration testing is its poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
•The bottom-up approach requires the lowest-level units be tested and integrated first. These units are frequently referred to as utility modules. By using this approach, utility modules are tested early in the development process and the need for stubs is minimized. The downside, however, is that the need for drivers complicates test management and high-level logic and data flow are tested late. Like the top-down approach, the bottom-up approach also provides poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Modifying factories''' ==&lt;br /&gt;
Factory_girl&amp;lt;ref&amp;gt;[https://github.com/thoughtbot/factory_girl]&amp;lt;/ref&amp;gt; is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.&lt;br /&gt;
The file listed below is used for modifying factories for test.&lt;br /&gt;
* /expertiza/spec/factories/factories.rb&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100238</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=100238"/>
		<updated>2015-12-05T02:20:28Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Testing Tools and Concepts''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/ Capybara page]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara github page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; # Make the Capybara DSL available in all integration tests &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; include Capybara::DSL &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt; end &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing&amp;lt;ref&amp;gt;[https://msdn.microsoft.com/en-us/library/aa292128(v=vs.71).aspx Integration test]&amp;lt;/ref&amp;gt; is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component. A component, in this time, refers to an integrated aggregate of more than one unit. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups.&lt;br /&gt;
* '''Big Bang for Integration test '''&lt;br /&gt;
&lt;br /&gt;
Big Bang&amp;lt;ref&amp;gt;[http://www.tutorialspoint.com/software_testing_dictionary/big_bang_testing.htm Big Bang]&amp;lt;/ref&amp;gt; Integration Testing is an integration testing strategy wherein all units are linked at once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult to isolate any errors found, because attention is not paid to verifying the interfaces across individual units.&lt;br /&gt;
&lt;br /&gt;
* '''Two apporachs: Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
•The top-down approach to integration testing requires the highest-level modules be test and integrated first. This allows high-level logic and data flow to be tested early in the process and it tends to minimize the need for drivers. However, the need for stubs complicates test management and low-level utilities are tested relatively late in the development cycle. Another disadvantage of top-down integration testing is its poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
•The bottom-up approach requires the lowest-level units be tested and integrated first. These units are frequently referred to as utility modules. By using this approach, utility modules are tested early in the development process and the need for stubs is minimized. The downside, however, is that the need for drivers complicates test management and high-level logic and data flow are tested late. Like the top-down approach, the bottom-up approach also provides poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
== '''Testing Plan''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Modifying factories''' ==&lt;br /&gt;
&amp;lt;ref&amp;gt;[https://github.com/thoughtbot/factory_girl Factory_girl]&amp;lt;/ref&amp;gt; is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.&amp;lt;ref&amp;gt;[https://github.com/thoughtbot/factory_girl Big Bang]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99471</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99471"/>
		<updated>2015-11-12T03:51:11Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Capybara */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; # Make the Capybara DSL available in all integration tests &amp;lt;/code&amp;gt;&lt;br /&gt;
    &amp;lt;code&amp;gt; include Capybara::DSL &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt; end &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing&amp;lt;ref&amp;gt;[https://msdn.microsoft.com/en-us/library/aa292128(v=vs.71).aspx Integration test]&amp;lt;/ref&amp;gt; is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component. A component, in this time, refers to an integrated aggregate of more than one unit. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups.&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
Big Bang&amp;lt;ref&amp;gt;[http://www.tutorialspoint.com/software_testing_dictionary/big_bang_testing.htm]&amp;lt;/ref&amp;gt; Integration Testing is an integration testing strategy wherein all units are linked at once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult to isolate any errors found, because attention is not paid to verifying the interfaces across individual units.&lt;br /&gt;
&lt;br /&gt;
* '''Two apporachs: Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
•The top-down approach to integration testing requires the highest-level modules be test and integrated first. This allows high-level logic and data flow to be tested early in the process and it tends to minimize the need for drivers. However, the need for stubs complicates test management and low-level utilities are tested relatively late in the development cycle. Another disadvantage of top-down integration testing is its poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
•The bottom-up approach requires the lowest-level units be tested and integrated first. These units are frequently referred to as utility modules. By using this approach, utility modules are tested early in the development process and the need for stubs is minimized. The downside, however, is that the need for drivers complicates test management and high-level logic and data flow are tested late. Like the top-down approach, the bottom-up approach also provides poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99470</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99470"/>
		<updated>2015-11-12T03:49:54Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Capybara */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;code&amp;gt; include Capybara::DSL &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; end &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing&amp;lt;ref&amp;gt;[https://msdn.microsoft.com/en-us/library/aa292128(v=vs.71).aspx Integration test]&amp;lt;/ref&amp;gt; is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component. A component, in this time, refers to an integrated aggregate of more than one unit. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups.&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
Big Bang&amp;lt;ref&amp;gt;[http://www.tutorialspoint.com/software_testing_dictionary/big_bang_testing.htm]&amp;lt;/ref&amp;gt; Integration Testing is an integration testing strategy wherein all units are linked at once, resulting in a complete system. When this type of testing strategy is adopted, it is difficult to isolate any errors found, because attention is not paid to verifying the interfaces across individual units.&lt;br /&gt;
&lt;br /&gt;
* '''Two apporachs: Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
•The top-down approach to integration testing requires the highest-level modules be test and integrated first. This allows high-level logic and data flow to be tested early in the process and it tends to minimize the need for drivers. However, the need for stubs complicates test management and low-level utilities are tested relatively late in the development cycle. Another disadvantage of top-down integration testing is its poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
•The bottom-up approach requires the lowest-level units be tested and integrated first. These units are frequently referred to as utility modules. By using this approach, utility modules are tested early in the development process and the need for stubs is minimized. The downside, however, is that the need for drivers complicates test management and high-level logic and data flow are tested late. Like the top-down approach, the bottom-up approach also provides poor support for early release of limited functionality.&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99467</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99467"/>
		<updated>2015-11-12T03:46:39Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Capybara */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; class ActionDispatch::IntegrationTest&lt;br /&gt;
  # Make the Capybara DSL available in all integration tests&lt;br /&gt;
  include Capybara::DSL&lt;br /&gt;
end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component and the interface between them is tested. A component, in this sense, refers to an integrated aggregate of more than one unit. In a realistic scenario, many units are combined into components, which are in turn aggregated into even larger parts of the program. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups. Eventually all the modules making up a process are tested together. Beyond that, if the program is composed of more than one process, they should be tested in pairs rather than all at once.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99466</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99466"/>
		<updated>2015-11-12T03:46:10Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Capybara */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class ActionDispatch::IntegrationTest&lt;br /&gt;
  # Make the Capybara DSL available in all integration tests&lt;br /&gt;
  include Capybara::DSL&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component and the interface between them is tested. A component, in this sense, refers to an integrated aggregate of more than one unit. In a realistic scenario, many units are combined into components, which are in turn aggregated into even larger parts of the program. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups. Eventually all the modules making up a process are tested together. Beyond that, if the program is composed of more than one process, they should be tested in pairs rather than all at once.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99465</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99465"/>
		<updated>2015-11-12T03:45:36Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Capybara */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line: &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Test::Unit:&lt;br /&gt;
&lt;br /&gt;
When using Rails, add the following code in &amp;lt;code&amp;gt; test_helper.rb &amp;lt;/code&amp;gt; file to make Capybara available in all test cases deriving from &amp;lt;code&amp;gt;ActionDispatch::IntegrationTest &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component and the interface between them is tested. A component, in this sense, refers to an integrated aggregate of more than one unit. In a realistic scenario, many units are combined into components, which are in turn aggregated into even larger parts of the program. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups. Eventually all the modules making up a process are tested together. Beyond that, if the program is composed of more than one process, they should be tested in pairs rather than all at once.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99464</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99464"/>
		<updated>2015-11-12T03:43:37Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Capybara */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with RSpec:&lt;br /&gt;
&lt;br /&gt;
Load RSpec 2.x support by adding the line &amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component and the interface between them is tested. A component, in this sense, refers to an integrated aggregate of more than one unit. In a realistic scenario, many units are combined into components, which are in turn aggregated into even larger parts of the program. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups. Eventually all the modules making up a process are tested together. Beyond that, if the program is composed of more than one process, they should be tested in pairs rather than all at once.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99463</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99463"/>
		<updated>2015-11-12T03:42:39Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Capybara */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component and the interface between them is tested. A component, in this sense, refers to an integrated aggregate of more than one unit. In a realistic scenario, many units are combined into components, which are in turn aggregated into even larger parts of the program. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups. Eventually all the modules making up a process are tested together. Beyond that, if the program is composed of more than one process, they should be tested in pairs rather than all at once.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99462</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99462"/>
		<updated>2015-11-12T03:40:55Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Capybara */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt; cucumber-rails gem &amp;lt;/code&amp;gt; comes with Capybara support built-in&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component and the interface between them is tested. A component, in this sense, refers to an integrated aggregate of more than one unit. In a realistic scenario, many units are combined into components, which are in turn aggregated into even larger parts of the program. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups. Eventually all the modules making up a process are tested together. Beyond that, if the program is composed of more than one process, they should be tested in pairs rather than all at once.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99461</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99461"/>
		<updated>2015-11-12T03:39:26Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Capybara */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Capybara with Cucumber:&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration testing is a logical extension of unit testing. In its simplest form, two units that have already been tested are combined into a component and the interface between them is tested. A component, in this sense, refers to an integrated aggregate of more than one unit. In a realistic scenario, many units are combined into components, which are in turn aggregated into even larger parts of the program. The idea is to test combinations of pieces and eventually expand the process to test your modules with those of other groups. Eventually all the modules making up a process are tested together. Beyond that, if the program is composed of more than one process, they should be tested in pairs rather than all at once.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99459</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99459"/>
		<updated>2015-11-12T03:37:24Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.In this project we will use expectation part of RSpec at most time.&lt;br /&gt;
&lt;br /&gt;
; RSpec-expectations&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-expectations RSpec expectations page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec::Expectations lets you express expected outcomes on an object in an example&lt;br /&gt;
&lt;br /&gt;
; RSpec-rails&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails RSpec rails page]&amp;lt;/ref&amp;gt;&lt;br /&gt;
: RSpec-rails is a testing framework for Rails 3.x and 4.x..&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with application. Capybara can talk with many different drivers which execute tests through the same clean and simple interface.&amp;lt;ref&amp;gt;[http://www.gamesparks.com/blog/automated-testing-with-cucumber-and-capybara/]&amp;lt;/ref&amp;gt;Capybara helps developer test web applications by simulating how a real user would interact with app.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99075</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99075"/>
		<updated>2015-11-09T06:46:29Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram1.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:5190_diagram1.jpg&amp;diff=99074</id>
		<title>File:5190 diagram1.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:5190_diagram1.jpg&amp;diff=99074"/>
		<updated>2015-11-09T06:46:00Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: 111&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;111&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99073</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99073"/>
		<updated>2015-11-09T06:42:19Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram_zmc.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99072</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99072"/>
		<updated>2015-11-09T06:42:05Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram_zmc.jpg|200px]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99071</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99071"/>
		<updated>2015-11-09T06:41:00Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram_zmc.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99070</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99070"/>
		<updated>2015-11-09T06:40:51Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:5190_diagram_zmc.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:5190_diagram_zmc.jpg&amp;diff=99069</id>
		<title>File:5190 diagram zmc.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:5190_diagram_zmc.jpg&amp;diff=99069"/>
		<updated>2015-11-09T06:40:16Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: 5190 diagram&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;5190 diagram&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99068</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99068"/>
		<updated>2015-11-09T06:37:16Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
== '''Scenario''' ==&lt;br /&gt;
[[File:Final_Diagram_517_5190.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99067</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99067"/>
		<updated>2015-11-09T06:34:27Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
=== Scenario ===&lt;br /&gt;
[[File:Final_Diagram_517_5190.jpg|thumb]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Final_Diagram_517_5190.jpg&amp;diff=99065</id>
		<title>File:Final Diagram 517 5190.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Final_Diagram_517_5190.jpg&amp;diff=99065"/>
		<updated>2015-11-09T06:32:51Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99064</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99064"/>
		<updated>2015-11-09T06:32:12Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: /* Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
=== Scenario ===&lt;br /&gt;
[[File:Final_Diagram_517_5190.jpg|thumb|right|insert a caption here]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99063</id>
		<title>CSC/ECE 517 Fall 2015 E1590 Integration testing for Team creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1590_Integration_testing_for_Team_creation&amp;diff=99063"/>
		<updated>2015-11-09T06:31:49Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to perform integration testing for team creation. The testing needs to be done with the help of RSpec and Capybara. The UI procedures need to be tested are:&lt;br /&gt;
* Log in as a student&lt;br /&gt;
* Choose a available topic&lt;br /&gt;
* Invite one or more students as teammates&lt;br /&gt;
* Students who get the invition could accept or denial&lt;br /&gt;
* After accept the invitation, the team should form and all teammates should have same topic&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with RSpec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of an integration test is to verify the functionality of interface between integrated parts, also we can know the performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Testing''' ==&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure a student is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure a student is able to choose a topic from the assignment.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure a student is able to form a team by inviting other students enrolled in this course. &lt;br /&gt;
    S1. If the invitation is sent to a student who isn't enrolled in the class, it should not be allowed.&lt;br /&gt;
    S2. If the invitation is sent to a student who is enrolled in the class, it should be allowed.&lt;br /&gt;
 &lt;br /&gt;
T4. Ensure an invitee is able to accept or reject.&lt;br /&gt;
    &lt;br /&gt;
T5. Ensure all teammates have the same topic.&lt;br /&gt;
    S1. If a student accepts the invitation and the student have a topic before, the topic should be dropped.&lt;br /&gt;
    S2. If a student accepts the invitation and did not have the topic before, the student should have the same topic as other teammates who accepted the invitation.&lt;br /&gt;
&lt;br /&gt;
=== Scenario ===&lt;br /&gt;
[[:File:Final_Diagram_517_5190.jpg]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97716</id>
		<title>CSC/ECE 517 Fall 2015/oss E1561 WZL</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97716"/>
		<updated>2015-10-31T21:41:13Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1561. Refactoring due_date.rb and deadline_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring due_date.rb and deadline_helper.rb.&lt;br /&gt;
&lt;br /&gt;
=Introduction to Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
This page is for the explanation of refactoring Expertiza. The specific work we done here is to refactor due_date.rb model and deadline_helper.rb. Based on the DRY principle and Rails convention, we also need to rewrite some methods to adhere to the RESTful style.&lt;br /&gt;
&lt;br /&gt;
=Problem Statement=&lt;br /&gt;
&lt;br /&gt;
1. setFlag() in due_date.rb is not adhere to Ruby on Rails naming conventions.&lt;br /&gt;
&lt;br /&gt;
2. DueDate.assign_topic_deadline method is same as DeadlineHelper.create_topic_deadline.&lt;br /&gt;
&lt;br /&gt;
3. The code to sort dates is duplicated in due_date.rb and response_controller.rb.&lt;br /&gt;
&lt;br /&gt;
4. DeadlineHelper.set_start_due_date method is too long.&lt;br /&gt;
&lt;br /&gt;
5. DueDate.default_permission needs to be refactored to get better performance.&lt;br /&gt;
&lt;br /&gt;
'''due_date.rb and deadline_helper.rb:'''&lt;br /&gt;
&lt;br /&gt;
due_date.rb is a model class to manage the deadlines of an assignment. It has methods&lt;br /&gt;
for setting due dates for an assignment, copying due dates from one assignment to a new&lt;br /&gt;
assignment etc.&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1uWs3zyrupTmrOFuv5IbVWCF4NRvCXqJmg8dZ0wCqgus/edit&amp;lt;/ref&amp;gt;=&lt;br /&gt;
'''Files involved:'''&lt;br /&gt;
 due_date.rb &lt;br /&gt;
 response_controller.rb&lt;br /&gt;
 deadline_helper.rb&lt;br /&gt;
 sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
'''What it does:'''&lt;br /&gt;
Manages the deadlines of an assignment, setting due dates for an assignment, copying due dates from one assignment to a new assignment etc.&lt;br /&gt;
&lt;br /&gt;
'''What's wrong with it:'''&lt;br /&gt;
* It has methods making unnecessary DB calls.&lt;br /&gt;
* It contains duplicated methods.&lt;br /&gt;
&lt;br /&gt;
'''What needs to be done:'''&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method wherever possible.&lt;br /&gt;
&lt;br /&gt;
2. Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and invoke it from places used in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions.&lt;br /&gt;
&lt;br /&gt;
4. Refactor &amp;lt;code&amp;gt;DueDate.default_permission&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
5. Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods.&lt;br /&gt;
 &lt;br /&gt;
=Modification=&lt;br /&gt;
==Case 1: Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; method which is same as &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |DueDate.assign_topic_deadline Method&lt;br /&gt;
! |DeadlineHelper.create_topic_deadline Method&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.assign_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.create_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
First remove the &amp;lt;code&amp;gt;assign_topic_deadline&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;, then use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;sign_up_sheet.rb&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DueDate.assign_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DeadlineHelper.create_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 2: Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and use and invoke it from where use it ==&lt;br /&gt;
First, create a new class method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.deadline_sort(due_dates)     &lt;br /&gt;
    due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }   &lt;br /&gt;
  end&lt;br /&gt;
Then call the new method when we sort the deadline in in line number 104 of &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and in line number 61 of &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
In due_date.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])&lt;br /&gt;
  sorted_deadlines = Array.new&lt;br /&gt;
  #sorted so that the earliest deadline is at the first&lt;br /&gt;
  sorted_deadlines = due_dates.sort { |m1, m2| (m1.due_at and m2.due_at)?m1.due_at &amp;lt;=&amp;gt; m2.due_at:(m1.due_at ? -1:1)}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])     sorted_deadlines = Array.new     &lt;br /&gt;
  #sorted so that the earliest deadline is at the first     &lt;br /&gt;
  sorted_deadlines = deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
In response_controller.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])&lt;br /&gt;
  @sorted_deadlines=Array.new&lt;br /&gt;
  @sorted_deadlines=due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])       &lt;br /&gt;
  @sorted_deadlines=Array.new       &lt;br /&gt;
  @sorted_deadlines=DueDate.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 3: Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions ==&lt;br /&gt;
Find the method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and rename it to &amp;lt;code&amp;gt;set_flag&amp;lt;/code&amp;gt;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def setFlag()&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_flag&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
Then also change the method name where it is called.&lt;br /&gt;
In &amp;lt;code&amp;gt;background_email_reminder.rake&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.setFlag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.set_flag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 4: Use the class variable in &amp;lt;code&amp;gt;default_permission&amp;lt;/code&amp;gt; method and use conditionally check deadline type using &amp;lt;code&amp;gt;if...else&amp;lt;/code&amp;gt; statements ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
  permission_id = Hash.new&lt;br /&gt;
  permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
  permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
  permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['review'] = Hash.new&lt;br /&gt;
  default_permission['review']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['review']['can_review'] = permission_id['OK']&lt;br /&gt;
  default_permission['review']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['metareview'] = Hash.new&lt;br /&gt;
  default_permission['metareview']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['review_of_review_allowed'] = permission_id['OK']&lt;br /&gt;
&lt;br /&gt;
  default_permission['drop_topic'] = Hash.new&lt;br /&gt;
  default_permission['drop_topic']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['drop_topic']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['drop_topic']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['signup'] = Hash.new&lt;br /&gt;
  default_permission['signup']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['signup']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['signup']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['team_formation'] = Hash.new&lt;br /&gt;
  default_permission['team_formation']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['team_formation']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['team_formation']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
@@permission_id = Hash.new&lt;br /&gt;
@@permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
@@permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
@@permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  if (deadline_type == 'submission')&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = @@permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    elsif (deadline_type == 'review')&lt;br /&gt;
    default_permission['review'] = Hash.new&lt;br /&gt;
    default_permission['review']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
    default_permission['review']['can_review'] = @@permission_id['OK']&lt;br /&gt;
    default_permission['review']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
       elsif (deadline_type == 'metareview')&lt;br /&gt;
        default_permission['metareview'] = Hash.new&lt;br /&gt;
        default_permission['metareview']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['can_review'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['review_of_review_allowed'] = @@permission_id['OK']&lt;br /&gt;
          elsif (deadline_type == 'drop_topic')&lt;br /&gt;
          default_permission['drop_topic'] = Hash.new&lt;br /&gt;
          default_permission['drop_topic']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
          default_permission['drop_topic']['can_review'] = @@permission_id['No']&lt;br /&gt;
          default_permission['drop_topic']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
            elsif (deadline_type == 'signup')&lt;br /&gt;
            default_permission['signup'] = Hash.new&lt;br /&gt;
            default_permission['signup']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
            default_permission['signup']['can_review'] = @@permission_id['No']&lt;br /&gt;
            default_permission['signup']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
              elsif (deadline_type == 'team_formation')&lt;br /&gt;
              default_permission['team_formation'] = Hash.new&lt;br /&gt;
              default_permission['team_formation']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
              default_permission['team_formation']['can_review'] = @@permission_id['No']&lt;br /&gt;
              default_permission['team_formation']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    end&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 5: Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods ==&lt;br /&gt;
The &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method in &amp;lt;/code&amp;gt;deadline_helper.rb&amp;lt;/code&amp;gt;is too long. First create a new method &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
Then call &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt; method in the original &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_topic.each { |topic_id|&lt;br /&gt;
        #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
        #then delete existing n create again&lt;br /&gt;
        prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
        #Only if there is a dependency for the topic&lt;br /&gt;
        if !prev_saved_due_dates.nil?&lt;br /&gt;
          num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
          #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
          for x in 0..num_due_dates - 1&lt;br /&gt;
            #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
            and destroy the old one&lt;br /&gt;
            if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
            DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
              set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
              offset = 0&lt;br /&gt;
            end&lt;br /&gt;
            prev_saved_due_dates[x].destroy&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
          create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
          and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
          DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
== Steps to verify deadline type default ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Click on Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Click on Edit.&lt;br /&gt;
&lt;br /&gt;
3. Click on Due dates.&lt;br /&gt;
&lt;br /&gt;
You will see the default of each deadline type in each row is &amp;quot;Yes&amp;quot;, while the others are &amp;quot;No&amp;quot;.&lt;br /&gt;
[[File:Q3.png]]&lt;br /&gt;
&lt;br /&gt;
== Steps to verify save dependency ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Go to Page: http://152.1.13.227:3000/sign_up_sheet/add_signup_topics_staggered/723 (723 can be changed to the id of any assignments).&lt;br /&gt;
&lt;br /&gt;
2. Click on Save dependencies.&lt;br /&gt;
&lt;br /&gt;
Successful loading of this page confirms the save dependency method.&lt;br /&gt;
[[File:Q5.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97713</id>
		<title>CSC/ECE 517 Fall 2015/oss E1561 WZL</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97713"/>
		<updated>2015-10-31T21:39:53Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1561. Refactoring due_date.rb and deadline_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring due_date.rb and deadline_helper.rb.&lt;br /&gt;
&lt;br /&gt;
=Introduction to Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
This page is for the explanation of refactoring Expertiza. The specific work we done here is to refactor due_date.rb model and deadline_helper.rb. Based on the DRY principle and Rails convention, we also need to rewrite some methods to adhere to the RESTful style.&lt;br /&gt;
&lt;br /&gt;
=Problem Statement=&lt;br /&gt;
1. setFlag() in due_date.rb is not adhere to Ruby on Rails naming conventions.&lt;br /&gt;
2. DueDate.assign_topic_deadline method is same as DeadlineHelper.create_topic_deadline.&lt;br /&gt;
3. The code to sort dates is duplicated in due_date.rb and response_controller.rb.&lt;br /&gt;
4. DeadlineHelper.set_start_due_date method is too long.&lt;br /&gt;
5. DueDate.default_permission needs to be refactored to get better performance.&lt;br /&gt;
&lt;br /&gt;
'''due_date.rb and deadline_helper.rb:'''&lt;br /&gt;
&lt;br /&gt;
due_date.rb is a model class to manage the deadlines of an assignment. It has methods&lt;br /&gt;
for setting due dates for an assignment, copying due dates from one assignment to a new&lt;br /&gt;
assignment etc.&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1uWs3zyrupTmrOFuv5IbVWCF4NRvCXqJmg8dZ0wCqgus/edit&amp;lt;/ref&amp;gt;=&lt;br /&gt;
'''Files involved:'''&lt;br /&gt;
 due_date.rb &lt;br /&gt;
 response_controller.rb&lt;br /&gt;
 deadline_helper.rb&lt;br /&gt;
 sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
'''What it does:'''&lt;br /&gt;
Manages the deadlines of an assignment, setting due dates for an assignment, copying due dates from one assignment to a new assignment etc.&lt;br /&gt;
&lt;br /&gt;
'''What's wrong with it:'''&lt;br /&gt;
* It has methods making unnecessary DB calls.&lt;br /&gt;
* It contains duplicated methods.&lt;br /&gt;
&lt;br /&gt;
'''What needs to be done:'''&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method wherever possible.&lt;br /&gt;
&lt;br /&gt;
2. Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and invoke it from places used in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions.&lt;br /&gt;
&lt;br /&gt;
4. Refactor &amp;lt;code&amp;gt;DueDate.default_permission&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
5. Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods.&lt;br /&gt;
 &lt;br /&gt;
=Modification=&lt;br /&gt;
==Case 1: Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; method which is same as &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |DueDate.assign_topic_deadline Method&lt;br /&gt;
! |DeadlineHelper.create_topic_deadline Method&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.assign_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.create_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
First remove the &amp;lt;code&amp;gt;assign_topic_deadline&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;, then use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;sign_up_sheet.rb&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DueDate.assign_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DeadlineHelper.create_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 2: Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and use and invoke it from where use it ==&lt;br /&gt;
First, create a new class method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.deadline_sort(due_dates)     &lt;br /&gt;
    due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }   &lt;br /&gt;
  end&lt;br /&gt;
Then call the new method when we sort the deadline in in line number 104 of &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and in line number 61 of &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
In due_date.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])&lt;br /&gt;
  sorted_deadlines = Array.new&lt;br /&gt;
  #sorted so that the earliest deadline is at the first&lt;br /&gt;
  sorted_deadlines = due_dates.sort { |m1, m2| (m1.due_at and m2.due_at)?m1.due_at &amp;lt;=&amp;gt; m2.due_at:(m1.due_at ? -1:1)}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])     sorted_deadlines = Array.new     &lt;br /&gt;
  #sorted so that the earliest deadline is at the first     &lt;br /&gt;
  sorted_deadlines = deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
In response_controller.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])&lt;br /&gt;
  @sorted_deadlines=Array.new&lt;br /&gt;
  @sorted_deadlines=due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])       &lt;br /&gt;
  @sorted_deadlines=Array.new       &lt;br /&gt;
  @sorted_deadlines=DueDate.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 3: Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions ==&lt;br /&gt;
Find the method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and rename it to &amp;lt;code&amp;gt;set_flag&amp;lt;/code&amp;gt;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def setFlag()&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_flag&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
Then also change the method name where it is called.&lt;br /&gt;
In &amp;lt;code&amp;gt;background_email_reminder.rake&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.setFlag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.set_flag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 4: Use the class variable in &amp;lt;code&amp;gt;default_permission&amp;lt;/code&amp;gt; method and use conditionally check deadline type using &amp;lt;code&amp;gt;if...else&amp;lt;/code&amp;gt; statements ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
  permission_id = Hash.new&lt;br /&gt;
  permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
  permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
  permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['review'] = Hash.new&lt;br /&gt;
  default_permission['review']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['review']['can_review'] = permission_id['OK']&lt;br /&gt;
  default_permission['review']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['metareview'] = Hash.new&lt;br /&gt;
  default_permission['metareview']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['review_of_review_allowed'] = permission_id['OK']&lt;br /&gt;
&lt;br /&gt;
  default_permission['drop_topic'] = Hash.new&lt;br /&gt;
  default_permission['drop_topic']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['drop_topic']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['drop_topic']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['signup'] = Hash.new&lt;br /&gt;
  default_permission['signup']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['signup']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['signup']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['team_formation'] = Hash.new&lt;br /&gt;
  default_permission['team_formation']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['team_formation']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['team_formation']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
@@permission_id = Hash.new&lt;br /&gt;
@@permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
@@permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
@@permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  if (deadline_type == 'submission')&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = @@permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    elsif (deadline_type == 'review')&lt;br /&gt;
    default_permission['review'] = Hash.new&lt;br /&gt;
    default_permission['review']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
    default_permission['review']['can_review'] = @@permission_id['OK']&lt;br /&gt;
    default_permission['review']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
       elsif (deadline_type == 'metareview')&lt;br /&gt;
        default_permission['metareview'] = Hash.new&lt;br /&gt;
        default_permission['metareview']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['can_review'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['review_of_review_allowed'] = @@permission_id['OK']&lt;br /&gt;
          elsif (deadline_type == 'drop_topic')&lt;br /&gt;
          default_permission['drop_topic'] = Hash.new&lt;br /&gt;
          default_permission['drop_topic']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
          default_permission['drop_topic']['can_review'] = @@permission_id['No']&lt;br /&gt;
          default_permission['drop_topic']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
            elsif (deadline_type == 'signup')&lt;br /&gt;
            default_permission['signup'] = Hash.new&lt;br /&gt;
            default_permission['signup']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
            default_permission['signup']['can_review'] = @@permission_id['No']&lt;br /&gt;
            default_permission['signup']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
              elsif (deadline_type == 'team_formation')&lt;br /&gt;
              default_permission['team_formation'] = Hash.new&lt;br /&gt;
              default_permission['team_formation']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
              default_permission['team_formation']['can_review'] = @@permission_id['No']&lt;br /&gt;
              default_permission['team_formation']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    end&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 5: Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods ==&lt;br /&gt;
The &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method in &amp;lt;/code&amp;gt;deadline_helper.rb&amp;lt;/code&amp;gt;is too long. First create a new method &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
Then call &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt; method in the original &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_topic.each { |topic_id|&lt;br /&gt;
        #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
        #then delete existing n create again&lt;br /&gt;
        prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
        #Only if there is a dependency for the topic&lt;br /&gt;
        if !prev_saved_due_dates.nil?&lt;br /&gt;
          num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
          #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
          for x in 0..num_due_dates - 1&lt;br /&gt;
            #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
            and destroy the old one&lt;br /&gt;
            if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
            DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
              set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
              offset = 0&lt;br /&gt;
            end&lt;br /&gt;
            prev_saved_due_dates[x].destroy&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
          create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
          and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
          DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
== Steps to verify deadline type default ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Click on Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Click on Edit.&lt;br /&gt;
&lt;br /&gt;
3. Click on Due dates.&lt;br /&gt;
&lt;br /&gt;
You will see the default of each deadline type in each row is &amp;quot;Yes&amp;quot;, while the others are &amp;quot;No&amp;quot;.&lt;br /&gt;
[[File:Q3.png]]&lt;br /&gt;
&lt;br /&gt;
== Steps to verify save dependency ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Go to Page: http://152.1.13.227:3000/sign_up_sheet/add_signup_topics_staggered/723 (723 can be changed to the id of any assignments).&lt;br /&gt;
&lt;br /&gt;
2. Click on Save dependencies.&lt;br /&gt;
&lt;br /&gt;
Successful loading of this page confirms the save dependency method.&lt;br /&gt;
[[File:Q5.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97711</id>
		<title>CSC/ECE 517 Fall 2015/oss E1561 WZL</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97711"/>
		<updated>2015-10-31T21:38:35Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1561. Refactoring due_date.rb and deadline_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring due_date.rb and deadline_helper.rb.&lt;br /&gt;
&lt;br /&gt;
=Introduction to Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
This page is for the explanation of refactoring Expertiza. The specific work we done here is to refactor due_date.rb model and deadline_helper.rb. Based on the DRY principle and Rails convention, we also need to rewrite some methods to adhere to the RESTful style.&lt;br /&gt;
&lt;br /&gt;
=Problem Statement=&lt;br /&gt;
1. setFlag() in due_date.rb is not adhere to Ruby on Rails naming conventions.&lt;br /&gt;
2. DueDate.assign_topic_deadline method is same as DeadlineHelper.create_topic_deadline.&lt;br /&gt;
3. The code to sort dates is duplicated in due_date.rb and response_controller.rb.&lt;br /&gt;
4. DeadlineHelper.set_start_due_date method is too long.&lt;br /&gt;
5. DueDate.default_permission needs to be refactored to get better performance.&lt;br /&gt;
&lt;br /&gt;
'''due_date.rb and deadline_helper.rb'''&lt;br /&gt;
due_date.rb is a model class to manage the deadlines of an assignment. It has methods&lt;br /&gt;
for setting due dates for an assignment, copying due dates from one assignment to a new&lt;br /&gt;
assignment etc.&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1uWs3zyrupTmrOFuv5IbVWCF4NRvCXqJmg8dZ0wCqgus/edit&amp;lt;/ref&amp;gt;=&lt;br /&gt;
'''Files involved:'''&lt;br /&gt;
 due_date.rb &lt;br /&gt;
 response_controller.rb&lt;br /&gt;
 deadline_helper.rb&lt;br /&gt;
 sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
'''What it does:'''&lt;br /&gt;
Manages the deadlines of an assignment, setting due dates for an assignment, copying due dates from one assignment to a new assignment etc.&lt;br /&gt;
&lt;br /&gt;
'''What's wrong with it:'''&lt;br /&gt;
* It has methods making unnecessary DB calls.&lt;br /&gt;
* It contains duplicated methods.&lt;br /&gt;
&lt;br /&gt;
'''What needs to be done:'''&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method wherever possible.&lt;br /&gt;
&lt;br /&gt;
2. Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and invoke it from places used in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions.&lt;br /&gt;
&lt;br /&gt;
4. Refactor &amp;lt;code&amp;gt;DueDate.default_permission&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
5. Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods.&lt;br /&gt;
 &lt;br /&gt;
=Modification=&lt;br /&gt;
==Case 1: Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; method which is same as &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |DueDate.assign_topic_deadline Method&lt;br /&gt;
! |DeadlineHelper.create_topic_deadline Method&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.assign_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.create_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
First remove the &amp;lt;code&amp;gt;assign_topic_deadline&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;, then use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;sign_up_sheet.rb&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DueDate.assign_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DeadlineHelper.create_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 2: Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and use and invoke it from where use it ==&lt;br /&gt;
First, create a new class method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.deadline_sort(due_dates)     &lt;br /&gt;
    due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }   &lt;br /&gt;
  end&lt;br /&gt;
Then call the new method when we sort the deadline in in line number 104 of &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and in line number 61 of &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
In due_date.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])&lt;br /&gt;
  sorted_deadlines = Array.new&lt;br /&gt;
  #sorted so that the earliest deadline is at the first&lt;br /&gt;
  sorted_deadlines = due_dates.sort { |m1, m2| (m1.due_at and m2.due_at)?m1.due_at &amp;lt;=&amp;gt; m2.due_at:(m1.due_at ? -1:1)}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])     sorted_deadlines = Array.new     &lt;br /&gt;
  #sorted so that the earliest deadline is at the first     &lt;br /&gt;
  sorted_deadlines = deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
In response_controller.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])&lt;br /&gt;
  @sorted_deadlines=Array.new&lt;br /&gt;
  @sorted_deadlines=due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])       &lt;br /&gt;
  @sorted_deadlines=Array.new       &lt;br /&gt;
  @sorted_deadlines=DueDate.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 3: Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions ==&lt;br /&gt;
Find the method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and rename it to &amp;lt;code&amp;gt;set_flag&amp;lt;/code&amp;gt;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def setFlag()&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_flag&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
Then also change the method name where it is called.&lt;br /&gt;
In &amp;lt;code&amp;gt;background_email_reminder.rake&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.setFlag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.set_flag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 4: Use the class variable in &amp;lt;code&amp;gt;default_permission&amp;lt;/code&amp;gt; method and use conditionally check deadline type using &amp;lt;code&amp;gt;if...else&amp;lt;/code&amp;gt; statements ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
  permission_id = Hash.new&lt;br /&gt;
  permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
  permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
  permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['review'] = Hash.new&lt;br /&gt;
  default_permission['review']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['review']['can_review'] = permission_id['OK']&lt;br /&gt;
  default_permission['review']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['metareview'] = Hash.new&lt;br /&gt;
  default_permission['metareview']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['review_of_review_allowed'] = permission_id['OK']&lt;br /&gt;
&lt;br /&gt;
  default_permission['drop_topic'] = Hash.new&lt;br /&gt;
  default_permission['drop_topic']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['drop_topic']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['drop_topic']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['signup'] = Hash.new&lt;br /&gt;
  default_permission['signup']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['signup']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['signup']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['team_formation'] = Hash.new&lt;br /&gt;
  default_permission['team_formation']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['team_formation']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['team_formation']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
@@permission_id = Hash.new&lt;br /&gt;
@@permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
@@permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
@@permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  if (deadline_type == 'submission')&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = @@permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    elsif (deadline_type == 'review')&lt;br /&gt;
    default_permission['review'] = Hash.new&lt;br /&gt;
    default_permission['review']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
    default_permission['review']['can_review'] = @@permission_id['OK']&lt;br /&gt;
    default_permission['review']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
       elsif (deadline_type == 'metareview')&lt;br /&gt;
        default_permission['metareview'] = Hash.new&lt;br /&gt;
        default_permission['metareview']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['can_review'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['review_of_review_allowed'] = @@permission_id['OK']&lt;br /&gt;
          elsif (deadline_type == 'drop_topic')&lt;br /&gt;
          default_permission['drop_topic'] = Hash.new&lt;br /&gt;
          default_permission['drop_topic']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
          default_permission['drop_topic']['can_review'] = @@permission_id['No']&lt;br /&gt;
          default_permission['drop_topic']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
            elsif (deadline_type == 'signup')&lt;br /&gt;
            default_permission['signup'] = Hash.new&lt;br /&gt;
            default_permission['signup']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
            default_permission['signup']['can_review'] = @@permission_id['No']&lt;br /&gt;
            default_permission['signup']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
              elsif (deadline_type == 'team_formation')&lt;br /&gt;
              default_permission['team_formation'] = Hash.new&lt;br /&gt;
              default_permission['team_formation']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
              default_permission['team_formation']['can_review'] = @@permission_id['No']&lt;br /&gt;
              default_permission['team_formation']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    end&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 5: Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods ==&lt;br /&gt;
The &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method in &amp;lt;/code&amp;gt;deadline_helper.rb&amp;lt;/code&amp;gt;is too long. First create a new method &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
Then call &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt; method in the original &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_topic.each { |topic_id|&lt;br /&gt;
        #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
        #then delete existing n create again&lt;br /&gt;
        prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
        #Only if there is a dependency for the topic&lt;br /&gt;
        if !prev_saved_due_dates.nil?&lt;br /&gt;
          num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
          #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
          for x in 0..num_due_dates - 1&lt;br /&gt;
            #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
            and destroy the old one&lt;br /&gt;
            if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
            DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
              set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
              offset = 0&lt;br /&gt;
            end&lt;br /&gt;
            prev_saved_due_dates[x].destroy&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
          create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
          and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
          DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
== Steps to verify deadline type default ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Click on Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Click on Edit.&lt;br /&gt;
&lt;br /&gt;
3. Click on Due dates.&lt;br /&gt;
&lt;br /&gt;
You will see the default of each deadline type in each row is &amp;quot;Yes&amp;quot;, while the others are &amp;quot;No&amp;quot;.&lt;br /&gt;
[[File:Q3.png]]&lt;br /&gt;
&lt;br /&gt;
== Steps to verify save dependency ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Go to Page: http://152.1.13.227:3000/sign_up_sheet/add_signup_topics_staggered/723 (723 can be changed to the id of any assignments).&lt;br /&gt;
&lt;br /&gt;
2. Click on Save dependencies.&lt;br /&gt;
&lt;br /&gt;
Successful loading of this page confirms the save dependency method.&lt;br /&gt;
[[File:Q5.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97706</id>
		<title>CSC/ECE 517 Fall 2015/oss E1561 WZL</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97706"/>
		<updated>2015-10-31T21:36:20Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1561. Refactoring due_date.rb and deadline_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring due_date.rb and deadline_helper.rb.&lt;br /&gt;
&lt;br /&gt;
=Introduction to Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;].&lt;br /&gt;
This page is for the explanation of refactoring Expertiza. The specific work we done here is to refactor due_date.rb model and deadline_helper.rb. Based on the DRY principle and Rails convention, we also need to rewrite some methods to adhere to the RESTful style.&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1uWs3zyrupTmrOFuv5IbVWCF4NRvCXqJmg8dZ0wCqgus/edit&amp;lt;/ref&amp;gt;=&lt;br /&gt;
'''Files involved:'''&lt;br /&gt;
 due_date.rb &lt;br /&gt;
 response_controller.rb&lt;br /&gt;
 deadline_helper.rb&lt;br /&gt;
 sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
'''What it does:'''&lt;br /&gt;
Manages the deadlines of an assignment, setting due dates for an assignment, copying due dates from one assignment to a new assignment etc.&lt;br /&gt;
&lt;br /&gt;
'''What's wrong with it:'''&lt;br /&gt;
* It has methods making unnecessary DB calls.&lt;br /&gt;
* It contains duplicated methods.&lt;br /&gt;
&lt;br /&gt;
'''What needs to be done:'''&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method wherever possible.&lt;br /&gt;
&lt;br /&gt;
2. Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and invoke it from places used in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions.&lt;br /&gt;
&lt;br /&gt;
4. Refactor &amp;lt;code&amp;gt;DueDate.default_permission&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
5. Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods.&lt;br /&gt;
 &lt;br /&gt;
=Modification=&lt;br /&gt;
==Case 1: Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; method which is same as &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |DueDate.assign_topic_deadline Method&lt;br /&gt;
! |DeadlineHelper.create_topic_deadline Method&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.assign_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.create_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
First remove the &amp;lt;code&amp;gt;assign_topic_deadline&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;, then use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;sign_up_sheet.rb&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DueDate.assign_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DeadlineHelper.create_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 2: Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and use and invoke it from where use it ==&lt;br /&gt;
First, create a new class method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.deadline_sort(due_dates)     &lt;br /&gt;
    due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }   &lt;br /&gt;
  end&lt;br /&gt;
Then call the new method when we sort the deadline in in line number 104 of &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and in line number 61 of &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
In due_date.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])&lt;br /&gt;
  sorted_deadlines = Array.new&lt;br /&gt;
  #sorted so that the earliest deadline is at the first&lt;br /&gt;
  sorted_deadlines = due_dates.sort { |m1, m2| (m1.due_at and m2.due_at)?m1.due_at &amp;lt;=&amp;gt; m2.due_at:(m1.due_at ? -1:1)}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])     sorted_deadlines = Array.new     &lt;br /&gt;
  #sorted so that the earliest deadline is at the first     &lt;br /&gt;
  sorted_deadlines = deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
In response_controller.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])&lt;br /&gt;
  @sorted_deadlines=Array.new&lt;br /&gt;
  @sorted_deadlines=due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])       &lt;br /&gt;
  @sorted_deadlines=Array.new       &lt;br /&gt;
  @sorted_deadlines=DueDate.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 3: Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions ==&lt;br /&gt;
Find the method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and rename it to &amp;lt;code&amp;gt;set_flag&amp;lt;/code&amp;gt;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def setFlag()&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_flag&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
Then also change the method name where it is called.&lt;br /&gt;
In &amp;lt;code&amp;gt;background_email_reminder.rake&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.setFlag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.set_flag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 4: Use the class variable in &amp;lt;code&amp;gt;default_permission&amp;lt;/code&amp;gt; method and use conditionally check deadline type using &amp;lt;code&amp;gt;if...else&amp;lt;/code&amp;gt; statements ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
  permission_id = Hash.new&lt;br /&gt;
  permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
  permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
  permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['review'] = Hash.new&lt;br /&gt;
  default_permission['review']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['review']['can_review'] = permission_id['OK']&lt;br /&gt;
  default_permission['review']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['metareview'] = Hash.new&lt;br /&gt;
  default_permission['metareview']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['review_of_review_allowed'] = permission_id['OK']&lt;br /&gt;
&lt;br /&gt;
  default_permission['drop_topic'] = Hash.new&lt;br /&gt;
  default_permission['drop_topic']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['drop_topic']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['drop_topic']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['signup'] = Hash.new&lt;br /&gt;
  default_permission['signup']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['signup']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['signup']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['team_formation'] = Hash.new&lt;br /&gt;
  default_permission['team_formation']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['team_formation']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['team_formation']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
@@permission_id = Hash.new&lt;br /&gt;
@@permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
@@permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
@@permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  if (deadline_type == 'submission')&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = @@permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    elsif (deadline_type == 'review')&lt;br /&gt;
    default_permission['review'] = Hash.new&lt;br /&gt;
    default_permission['review']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
    default_permission['review']['can_review'] = @@permission_id['OK']&lt;br /&gt;
    default_permission['review']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
       elsif (deadline_type == 'metareview')&lt;br /&gt;
        default_permission['metareview'] = Hash.new&lt;br /&gt;
        default_permission['metareview']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['can_review'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['review_of_review_allowed'] = @@permission_id['OK']&lt;br /&gt;
          elsif (deadline_type == 'drop_topic')&lt;br /&gt;
          default_permission['drop_topic'] = Hash.new&lt;br /&gt;
          default_permission['drop_topic']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
          default_permission['drop_topic']['can_review'] = @@permission_id['No']&lt;br /&gt;
          default_permission['drop_topic']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
            elsif (deadline_type == 'signup')&lt;br /&gt;
            default_permission['signup'] = Hash.new&lt;br /&gt;
            default_permission['signup']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
            default_permission['signup']['can_review'] = @@permission_id['No']&lt;br /&gt;
            default_permission['signup']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
              elsif (deadline_type == 'team_formation')&lt;br /&gt;
              default_permission['team_formation'] = Hash.new&lt;br /&gt;
              default_permission['team_formation']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
              default_permission['team_formation']['can_review'] = @@permission_id['No']&lt;br /&gt;
              default_permission['team_formation']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    end&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 5: Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods ==&lt;br /&gt;
The &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method in &amp;lt;/code&amp;gt;deadline_helper.rb&amp;lt;/code&amp;gt;is too long. First create a new method &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
Then call &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt; method in the original &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_topic.each { |topic_id|&lt;br /&gt;
        #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
        #then delete existing n create again&lt;br /&gt;
        prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
        #Only if there is a dependency for the topic&lt;br /&gt;
        if !prev_saved_due_dates.nil?&lt;br /&gt;
          num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
          #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
          for x in 0..num_due_dates - 1&lt;br /&gt;
            #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
            and destroy the old one&lt;br /&gt;
            if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
            DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
              set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
              offset = 0&lt;br /&gt;
            end&lt;br /&gt;
            prev_saved_due_dates[x].destroy&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
          create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
          and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
          DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
== Steps to verify deadline type default ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Click on Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Click on Edit.&lt;br /&gt;
&lt;br /&gt;
3. Click on Due dates.&lt;br /&gt;
&lt;br /&gt;
You will see the default of each deadline type in each row is &amp;quot;Yes&amp;quot;, while the others are &amp;quot;No&amp;quot;.&lt;br /&gt;
[[File:Q3.png]]&lt;br /&gt;
&lt;br /&gt;
== Steps to verify save dependency ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Go to Page: http://152.1.13.227:3000/sign_up_sheet/add_signup_topics_staggered/723 (723 can be changed to the id of any assignments).&lt;br /&gt;
&lt;br /&gt;
2. Click on Save dependencies.&lt;br /&gt;
&lt;br /&gt;
Successful loading of this page confirms the save dependency method.&lt;br /&gt;
[[File:Q5.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97705</id>
		<title>CSC/ECE 517 Fall 2015/oss E1561 WZL</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1561_WZL&amp;diff=97705"/>
		<updated>2015-10-31T21:35:15Z</updated>

		<summary type="html">&lt;p&gt;Mzhang18: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1561. Refactoring due_date.rb and deadline_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. This project aimed at refactoring due_date.rb and deadline_helper.rb.&lt;br /&gt;
&lt;br /&gt;
=Introduction to Expertiza=&lt;br /&gt;
[http://http://expertiza.ncsu.edu/ Expertiza] is a [http://en.wikipedia.org/wiki/Open-source_software Open Source] [http://rubyonrails.org/ Rails] application where students can submit and peer-review learning objects (articles, code, web sites, etc). It is used in select courses at NC State and by professors at several other colleges and universities.  This Open Source application can be cloned from [https://github.com/expertiza/expertiza/ Github], the latest active branch is [https://github.com/expertiza/expertiza/tree/rails4 &amp;quot;Rails 4&amp;quot;]. &lt;br /&gt;
This page is for the explanation of refactoring Expertiza. The specific work we done here is to refactor due_date.rb model and deadline_helper.rb. Based on the DRY principle and Rails convention, we also need to rewrite some methods to adhere to the RESTful style.&lt;br /&gt;
&lt;br /&gt;
=Project Desicription&amp;lt;ref&amp;gt;https://docs.google.com/document/d/1uWs3zyrupTmrOFuv5IbVWCF4NRvCXqJmg8dZ0wCqgus/edit&amp;lt;/ref&amp;gt;=&lt;br /&gt;
'''Files involved:'''&lt;br /&gt;
 due_date.rb &lt;br /&gt;
 response_controller.rb&lt;br /&gt;
 deadline_helper.rb&lt;br /&gt;
 sign_up_sheet.rb&lt;br /&gt;
&lt;br /&gt;
'''What it does:'''&lt;br /&gt;
Manages the deadlines of an assignment, setting due dates for an assignment, copying due dates from one assignment to a new assignment etc.&lt;br /&gt;
&lt;br /&gt;
'''What's wrong with it:'''&lt;br /&gt;
* It has methods making unnecessary DB calls.&lt;br /&gt;
* It contains duplicated methods.&lt;br /&gt;
&lt;br /&gt;
'''What needs to be done:'''&lt;br /&gt;
There are 5 major goals for this project:&lt;br /&gt;
&lt;br /&gt;
1. Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method wherever possible.&lt;br /&gt;
&lt;br /&gt;
2. Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and invoke it from places used in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
3. Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions.&lt;br /&gt;
&lt;br /&gt;
4. Refactor &amp;lt;code&amp;gt;DueDate.default_permission&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
5. Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods.&lt;br /&gt;
 &lt;br /&gt;
=Modification=&lt;br /&gt;
==Case 1: Remove &amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; and use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;DueDate.assign_topic_deadline&amp;lt;/code&amp;gt; method which is same as &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |DueDate.assign_topic_deadline Method&lt;br /&gt;
! |DeadlineHelper.create_topic_deadline Method&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.assign_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.create_topic_deadline(due_date,offset,topic_id)&lt;br /&gt;
    topic_deadline = TopicDeadline.new&lt;br /&gt;
    topic_deadline.topic_id = topic_id&lt;br /&gt;
    topic_deadline.due_at = DateTime.parse(due_date.due_at.to_s) + offset.to_i&lt;br /&gt;
    topic_deadline.deadline_type_id = due_date.deadline_type_id&lt;br /&gt;
    topic_deadline.late_policy_id = nil&lt;br /&gt;
    topic_deadline.submission_allowed_id = due_date.submission_allowed_id&lt;br /&gt;
    topic_deadline.review_allowed_id = due_date.review_allowed_id&lt;br /&gt;
    topic_deadline.review_of_review_allowed_id = due_date.review_of_review_allowed_id&lt;br /&gt;
    topic_deadline.round = due_date.round&lt;br /&gt;
    topic_deadline.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
First remove the &amp;lt;code&amp;gt;assign_topic_deadline&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;, then use &amp;lt;code&amp;gt;DeadlineHelper.create_topic_deadline&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;sign_up_sheet.rb&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DueDate.assign_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
  set_of_due_dates.each { |due_date|&lt;br /&gt;
  DeadlineHelper.create_topic_deadline(due_date, 0, topic.id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 2: Create a new method for sort in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and use and invoke it from where use it ==&lt;br /&gt;
First, create a new class method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.deadline_sort(due_dates)     &lt;br /&gt;
    due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }   &lt;br /&gt;
  end&lt;br /&gt;
Then call the new method when we sort the deadline in in line number 104 of &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and in line number 61 of &amp;lt;code&amp;gt;response_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
In due_date.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])&lt;br /&gt;
  sorted_deadlines = Array.new&lt;br /&gt;
  #sorted so that the earliest deadline is at the first&lt;br /&gt;
  sorted_deadlines = due_dates.sort { |m1, m2| (m1.due_at and m2.due_at)?m1.due_at &amp;lt;=&amp;gt; m2.due_at:(m1.due_at ? -1:1)}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, assignment_id])     sorted_deadlines = Array.new     &lt;br /&gt;
  #sorted so that the earliest deadline is at the first     &lt;br /&gt;
  sorted_deadlines = deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
In response_controller.rb:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])&lt;br /&gt;
  @sorted_deadlines=Array.new&lt;br /&gt;
  @sorted_deadlines=due_dates.sort { |m1, m2| (m1.due_at and m2.due_at) ? m1.due_at &amp;lt;=&amp;gt; m2.due_at : (m1.due_at ? -1 : 1) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  due_dates = DueDate.where([&amp;quot;assignment_id = ?&amp;quot;, @assignment.id])       &lt;br /&gt;
  @sorted_deadlines=Array.new       &lt;br /&gt;
  @sorted_deadlines=DueDate.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 3: Rename &amp;lt;code&amp;gt;setFlag()&amp;lt;/code&amp;gt; to adhere to Rails naming conventions ==&lt;br /&gt;
Find the method in &amp;lt;code&amp;gt;due_date.rb&amp;lt;/code&amp;gt; and rename it to &amp;lt;code&amp;gt;set_flag&amp;lt;/code&amp;gt;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def setFlag()&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def set_flag&lt;br /&gt;
    self.flag = true&lt;br /&gt;
    self.save&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
Then also change the method name where it is called.&lt;br /&gt;
In &amp;lt;code&amp;gt;background_email_reminder.rake&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.setFlag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  date.set_flag&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 4: Use the class variable in &amp;lt;code&amp;gt;default_permission&amp;lt;/code&amp;gt; method and use conditionally check deadline type using &amp;lt;code&amp;gt;if...else&amp;lt;/code&amp;gt; statements ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
  permission_id = Hash.new&lt;br /&gt;
  permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
  permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
  permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['review'] = Hash.new&lt;br /&gt;
  default_permission['review']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['review']['can_review'] = permission_id['OK']&lt;br /&gt;
  default_permission['review']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['metareview'] = Hash.new&lt;br /&gt;
  default_permission['metareview']['submission_allowed'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['metareview']['review_of_review_allowed'] = permission_id['OK']&lt;br /&gt;
&lt;br /&gt;
  default_permission['drop_topic'] = Hash.new&lt;br /&gt;
  default_permission['drop_topic']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['drop_topic']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['drop_topic']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['signup'] = Hash.new&lt;br /&gt;
  default_permission['signup']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['signup']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['signup']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission['team_formation'] = Hash.new&lt;br /&gt;
  default_permission['team_formation']['submission_allowed'] = permission_id['OK']&lt;br /&gt;
  default_permission['team_formation']['can_review'] = permission_id['No']&lt;br /&gt;
  default_permission['team_formation']['review_of_review_allowed'] = permission_id['No']&lt;br /&gt;
&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
@@permission_id = Hash.new&lt;br /&gt;
@@permission_id['OK'] = DeadlineRight.find_by_name('OK').id&lt;br /&gt;
@@permission_id['No'] = DeadlineRight.find_by_name('No').id&lt;br /&gt;
@@permission_id['Late'] = DeadlineRight.find_by_name('Late').id&lt;br /&gt;
def self.default_permission(deadline_type, permission_type)&lt;br /&gt;
&lt;br /&gt;
  default_permission = Hash.new&lt;br /&gt;
  if (deadline_type == 'submission')&lt;br /&gt;
  default_permission['submission'] = Hash.new&lt;br /&gt;
  default_permission['submission']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
  default_permission['submission']['can_review'] = @@permission_id['No']&lt;br /&gt;
  default_permission['submission']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    elsif (deadline_type == 'review')&lt;br /&gt;
    default_permission['review'] = Hash.new&lt;br /&gt;
    default_permission['review']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
    default_permission['review']['can_review'] = @@permission_id['OK']&lt;br /&gt;
    default_permission['review']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
       elsif (deadline_type == 'metareview')&lt;br /&gt;
        default_permission['metareview'] = Hash.new&lt;br /&gt;
        default_permission['metareview']['submission_allowed'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['can_review'] = @@permission_id['No']&lt;br /&gt;
        default_permission['metareview']['review_of_review_allowed'] = @@permission_id['OK']&lt;br /&gt;
          elsif (deadline_type == 'drop_topic')&lt;br /&gt;
          default_permission['drop_topic'] = Hash.new&lt;br /&gt;
          default_permission['drop_topic']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
          default_permission['drop_topic']['can_review'] = @@permission_id['No']&lt;br /&gt;
          default_permission['drop_topic']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
            elsif (deadline_type == 'signup')&lt;br /&gt;
            default_permission['signup'] = Hash.new&lt;br /&gt;
            default_permission['signup']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
            default_permission['signup']['can_review'] = @@permission_id['No']&lt;br /&gt;
            default_permission['signup']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
              elsif (deadline_type == 'team_formation')&lt;br /&gt;
              default_permission['team_formation'] = Hash.new&lt;br /&gt;
              default_permission['team_formation']['submission_allowed'] = @@permission_id['OK']&lt;br /&gt;
              default_permission['team_formation']['can_review'] = @@permission_id['No']&lt;br /&gt;
              default_permission['team_formation']['review_of_review_allowed'] = @@permission_id['No']&lt;br /&gt;
    end&lt;br /&gt;
  default_permission[deadline_type][permission_type]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Case 5: Refactor &amp;lt;code&amp;gt;DeadlineHelper.set_start_due_date&amp;lt;/code&amp;gt; method to smaller methods ==&lt;br /&gt;
The &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method in &amp;lt;/code&amp;gt;deadline_helper.rb&amp;lt;/code&amp;gt;is too long. First create a new method &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt;.&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
Then call &amp;lt;code&amp;gt;check_dependency&amp;lt;/code&amp;gt; method in the original &amp;lt;code&amp;gt;set_start_due_date&amp;lt;/code&amp;gt; method.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! |Before Change&lt;br /&gt;
! |After Change&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_topic.each { |topic_id|&lt;br /&gt;
        #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
        #then delete existing n create again&lt;br /&gt;
        prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
        #Only if there is a dependency for the topic&lt;br /&gt;
        if !prev_saved_due_dates.nil?&lt;br /&gt;
          num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
          #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
          for x in 0..num_due_dates - 1&lt;br /&gt;
            #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
            and destroy the old one&lt;br /&gt;
            if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
            DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
              set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
              offset = 0&lt;br /&gt;
            end&lt;br /&gt;
            prev_saved_due_dates[x].destroy&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
          create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.set_start_due_date(assignment_id,set_of_topics)&lt;br /&gt;
&lt;br /&gt;
    #Remember, in create_common_start_time_topics function we reversed the graph so reverse it back&lt;br /&gt;
    set_of_topics = set_of_topics.reverse&lt;br /&gt;
&lt;br /&gt;
    set_of_topics_due_dates = Array.new&lt;br /&gt;
    i=0&lt;br /&gt;
    days_between_submissions = Assignment.find(assignment_id)['days_between_submissions'].to_i&lt;br /&gt;
    set_of_topics.each { |set_of_topic|&lt;br /&gt;
      set_of_due_dates = nil&lt;br /&gt;
      if i==0&lt;br /&gt;
        #take the first set from the table which user stores&lt;br /&gt;
        set_of_due_dates = DueDate.where(assignment_id: assignment_id)&lt;br /&gt;
        offset = 0&lt;br /&gt;
      else&lt;br /&gt;
        set_of_due_dates = TopicDeadline.where(topic_id: set_of_topics[i-1][0])&lt;br /&gt;
&lt;br /&gt;
        set_of_due_dates.sort_by {|a| a.due_at }&lt;br /&gt;
&lt;br /&gt;
        offset = days_between_submissions&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
&lt;br /&gt;
      i = i+1&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.check_dependency(set_of_topic, set_of_due_dates, offset)&lt;br /&gt;
    set_of_topic.each { |topic_id|&lt;br /&gt;
      #if the due dates have already been created and the save dependency is being clicked,&lt;br /&gt;
      #then delete existing n create again&lt;br /&gt;
      prev_saved_due_dates = TopicDeadline.where(topic_id: topic_id)&lt;br /&gt;
&lt;br /&gt;
      #Only if there is a dependency for the topic&lt;br /&gt;
      if !prev_saved_due_dates.nil?&lt;br /&gt;
        num_due_dates = prev_saved_due_dates.length&lt;br /&gt;
        #for each due date in the current topic he want to compare it to the previous due date&lt;br /&gt;
        for x in 0..num_due_dates - 1&lt;br /&gt;
          #we don't want the old date to move earlier in time so we save it as the new due date &lt;br /&gt;
          and destroy the old one&lt;br /&gt;
          if DateTime.parse(set_of_due_dates[x].due_at.to_s) + offset.to_i &amp;lt; &lt;br /&gt;
          DateTime.parse(prev_saved_due_dates[x].due_at.to_s)&lt;br /&gt;
            set_of_due_dates[x] = prev_saved_due_dates[x]&lt;br /&gt;
            offset = 0&lt;br /&gt;
          end&lt;br /&gt;
          prev_saved_due_dates[x].destroy&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      set_of_due_dates.each_with_index {|due_date, index|&lt;br /&gt;
        create_topic_deadline(due_date, offset, topic_id)&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
=Results Screenshot=&lt;br /&gt;
== Steps to verify deadline type default ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Click on Assignments.&lt;br /&gt;
&lt;br /&gt;
2. Click on Edit.&lt;br /&gt;
&lt;br /&gt;
3. Click on Due dates.&lt;br /&gt;
&lt;br /&gt;
You will see the default of each deadline type in each row is &amp;quot;Yes&amp;quot;, while the others are &amp;quot;No&amp;quot;.&lt;br /&gt;
[[File:Q3.png]]&lt;br /&gt;
&lt;br /&gt;
== Steps to verify save dependency ==&lt;br /&gt;
Log into the application with the user having an instructor's role.&lt;br /&gt;
&lt;br /&gt;
1. Go to Page: http://152.1.13.227:3000/sign_up_sheet/add_signup_topics_staggered/723 (723 can be changed to the id of any assignments).&lt;br /&gt;
&lt;br /&gt;
2. Click on Save dependencies.&lt;br /&gt;
&lt;br /&gt;
Successful loading of this page confirms the save dependency method.&lt;br /&gt;
[[File:Q5.png]]&lt;br /&gt;
&lt;br /&gt;
= References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mzhang18</name></author>
	</entry>
</feed>