<?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=Ewhorton</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=Ewhorton"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ewhorton"/>
	<updated>2026-08-07T01:51:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_E1621_Refactor_and_Test_the_Quizzing_Feature&amp;diff=102281</id>
		<title>CSC/ECE 517 Spring 2016 E1621 Refactor and Test the Quizzing Feature</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_E1621_Refactor_and_Test_the_Quizzing_Feature&amp;diff=102281"/>
		<updated>2016-04-18T12:03:00Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Post Completion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by &amp;lt;code&amp;gt;questionnaires_controller.valid_quiz&amp;lt;/code&amp;gt;. This method is rather long, involved, and does not take advantage of object-oriented practices. It combs through the parameters hash received from a request and manually checks all quiz fields, all question fields, all question choice fields, and verifies that each question has a correct choice.&lt;br /&gt;
&lt;br /&gt;
We will refactor the method to construct a quiz questionniare and then call &amp;lt;code&amp;gt;valid?&amp;lt;/code&amp;gt; to recursively validate the object tree using ActiveRecord validations. This is an improvement over the current code which checks all questions manually. The purpose of refactoring in this manner is to enhance readability, DRYness, and maintainability of Expertiza code.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the expected behavior is present for all use cases.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
=Classes involved=&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* quiz_quesetionnaire.rb&lt;br /&gt;
* quiz_question.rb&lt;br /&gt;
* quiz_question_choice.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
=Use Case and Scenarios=&lt;br /&gt;
The Quiz Use Case allows for instructors to create and manage assignments where students may write quizzes for reviewers on materials they have submitted. See the following scenarios for a complete description of how the feature is expected to work.&lt;br /&gt;
&lt;br /&gt;
==Instructors are able to create and manage an assignment's quiz feature==&lt;br /&gt;
An instructor chooses to create an assignment that has a quiz [S1]. While editing the assignment they may choose the number of quiz questions [S2] and set which phases students are allowed to take the quizzes [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - When creating the assignment there is a checkbox labeled &amp;quot;has quiz.&amp;quot; Checking this box creates an assignment that includes a quiz.&lt;br /&gt;
* [S2] - When an assignment has a quiz there is an input field that accepts the number of questions that will be on each quiz. Setting this number appropriately changes the number of quiz questions.&lt;br /&gt;
* [S3] - Students may not take quizzes on a phase that does not allow them to do so. When on a stage that does allow for quizzes, they may take quizzes on work that they have reviewed.&lt;br /&gt;
&lt;br /&gt;
==Instructors can view quiz questions and scores from the tree view==&lt;br /&gt;
After an assignment has been created the instructor may choose to view student quizzes from the tree view [S1]. While on the quiz view page they see student quizzes [S2] and student responses [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The instructor may navigate to the list of assignments. Assignments with quizzes enabled will provide a link for the instructor to follow and view student quizzes.&lt;br /&gt;
* [S2] - The instructor shall be presented with the quiz title, questions, and answer choices. The correct answer choices will be in bold.&lt;br /&gt;
* [S3] - The score for each student who has taken the quiz shall be listed along with the average quiz score.&lt;br /&gt;
&lt;br /&gt;
==Students can create and edit quizzes==&lt;br /&gt;
A student navigates to the assignment work page and chooses to create a new quiz [S1] or edit an existing one [S2]. By doing so they are able to choose a quiz title  and quiz questions [S3]. Invalid input results in an error message prompting the student to fix the issue [E1].&lt;br /&gt;
&lt;br /&gt;
* [S1] - A student may only create a quiz if they have not yet done so.&lt;br /&gt;
* [S2] - A student may only edit a quiz if they have previously created one.&lt;br /&gt;
* [S3] - The quiz has the number of quiz questions defined by the instructor in the assignment.&lt;br /&gt;
&lt;br /&gt;
* [E1] - Possible errors include:&lt;br /&gt;
** The quiz has no name.&lt;br /&gt;
** One or more questions is missing text.&lt;br /&gt;
** One or more choices is missing text.&lt;br /&gt;
** A question is missing a correct answer choice.&lt;br /&gt;
&lt;br /&gt;
==Students can take quizzes on assignments they have reviewed==&lt;br /&gt;
A student decides to take a quiz [S1] on another team's assignment that they have previously reviewed. They select an artifact for review [S2] and fill in their answers. After submitting the quiz they can view their score on the take quizzes page [S3] and see question-by-question scores by clicking view [S4].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The student may only take a quiz during a stage in which the assignment is configured to allow them to do so.&lt;br /&gt;
* [S2] - Only quizzes from submissions they have reviewed are available.&lt;br /&gt;
* [S3] - The take quizzes page lists the final score for each quiz.&lt;br /&gt;
* [S4] - Choosing to view a quiz will show a student each question along with their answers and the correct answers.&lt;br /&gt;
&lt;br /&gt;
=Design and Implementation=&lt;br /&gt;
Design for the refactoring has been driven by object oriented principles and test-driven-development, and makes use of the existing object hierarchy described in the following UML diagram. &lt;br /&gt;
&lt;br /&gt;
[[File:Expertiza_quiz_hierarchy.png|Expertiza Quiz Hierarchy]]&lt;br /&gt;
&lt;br /&gt;
See the below sections for a part-by-part breakdown of the planned implementation for this project.&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
Quiz tests will be added to the file spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Tests will be made which fully cover the expected behavior of each listed scenario in the Use Case.&lt;br /&gt;
&lt;br /&gt;
==Refactoring==&lt;br /&gt;
Each of the following files will be refactored as described.&lt;br /&gt;
&lt;br /&gt;
===QuestionnaireController===&lt;br /&gt;
Refactor the &amp;lt;code&amp;gt;valid_quiz&amp;lt;/code&amp;gt; method. It will be renamed to &amp;lt;code&amp;gt;validate_quiz&amp;lt;/code&amp;gt; to more properly describe the action that occurs as a result of it being called. The behavior will be changed to construct a new quiz questionnaire with submitted questions wich will be validated using &amp;lt;code&amp;gt;quiz.valid?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionnaire===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations.&lt;br /&gt;
* Presence of name&lt;br /&gt;
&lt;br /&gt;
===QuizQuestion===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
* Presence of type&lt;br /&gt;
* Has a correct answer&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionChoice===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
In order to verify that refactoring has been done correctly and maintains the same external behavior, we will write test cases to the existing implementation. These test cases will be the ground truth of the validation feature. Refactored code will not be considered complete until all of these test cases once again pass.&lt;br /&gt;
&lt;br /&gt;
=Post Completion=&lt;br /&gt;
Testing and refactoring have been completed and a [https://github.com/expertiza/expertiza/pull/671 pull request] created to merge features back into master.&lt;br /&gt;
&lt;br /&gt;
==Refactoring==&lt;br /&gt;
Refactoring went according to plan. The following model files were edited to use ActiveRecord validations on specific fields&lt;br /&gt;
* question.rb&lt;br /&gt;
* questionnaire.rb&lt;br /&gt;
* quiz_quesetion.rb&lt;br /&gt;
* quiz_question_choice.rb&lt;br /&gt;
&lt;br /&gt;
In addition, tests were added to &amp;lt;code&amp;gt;spec/controllers/questionnaires_controller_spec.rb&amp;lt;/code&amp;gt; to test quiz validation. With passing tests, the &amp;lt;code&amp;gt;validate_quiz&amp;lt;/code&amp;gt; method in &amp;lt;code&amp;gt;questionnaires_controller&amp;lt;/code&amp;gt; was refactored. It now constructs a quiz from params and returns it if it is valid. If the quiz is invalid an error message is returned.&lt;br /&gt;
&lt;br /&gt;
===Before Refactoring===&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
def valid_quiz&lt;br /&gt;
:num_quiz_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
:valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:(1..num_quiz_questions).each do |i|&lt;br /&gt;
:: if params[:new_question][i.to_s] == ''&lt;br /&gt;
:::// One of the questions text is not filled out&lt;br /&gt;
:::valid = &amp;quot;Please make sure all questions have text&amp;quot;&lt;br /&gt;
:::break&lt;br /&gt;
::elsif !params.has_key?(:question_type) || !params[:question_type].has_key?(i.to_s) || params[:question_type][i.to_s][:type] == nil&lt;br /&gt;
:::// A type isnt selected for a question&lt;br /&gt;
:::valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
:::break&lt;br /&gt;
::elsif params[:questionnaire][:name]==&amp;quot;&amp;quot;&lt;br /&gt;
:::// questionnaire name is not specified&lt;br /&gt;
:::valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
:::break&lt;br /&gt;
::else&lt;br /&gt;
:::type = params[:question_type][i.to_s][:type]&lt;br /&gt;
:::if type == 'MultipleChoiceCheckbox' or type == 'MultipleChoiceRadio'&lt;br /&gt;
::::correct_selected = false&lt;br /&gt;
::::(1..4).each do |x|&lt;br /&gt;
:::::if params[:new_choices][i.to_s][type][x.to_s][:txt] == ''&lt;br /&gt;
::::::// Text isnt provided for an option&lt;br /&gt;
::::::valid = &amp;quot;Please make sure every question has text for all options&amp;quot;&lt;br /&gt;
::::::break&lt;br /&gt;
:::::elsif type == 'MultipleChoiceRadio' and not params[:new_choices][i.to_s][type][x.to_s][:iscorrect] == nil&lt;br /&gt;
::::::correct_selected = true&lt;br /&gt;
:::::elsif type == 'MultipleChoiceCheckbox' and not params[:new_choices][i.to_s][type][x.to_s][:iscorrect] == 0.to_s&lt;br /&gt;
::::::correct_selected = true&lt;br /&gt;
:::::end&lt;br /&gt;
::::end&lt;br /&gt;
::::if valid == &amp;quot;valid&amp;quot; &amp;amp;&amp;amp; !correct_selected&lt;br /&gt;
:::::// A correct option isnt selected for a check box or radio question&lt;br /&gt;
:::::valid = &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
::::::break&lt;br /&gt;
::::end&lt;br /&gt;
:::elsif type == 'TF' # TF is not disabled. We need to test TF later.&lt;br /&gt;
::::if params[:new_choices][i.to_s][&amp;quot;TF&amp;quot;] == nil&lt;br /&gt;
:::::// A correct option isnt selected for a true/false question&lt;br /&gt;
:::::valid = &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
:::::break&lt;br /&gt;
::::end&lt;br /&gt;
:::end&lt;br /&gt;
::end&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:return valid&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===After Refactoring===&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
def validate_quiz&lt;br /&gt;
:num_quiz_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
&lt;br /&gt;
:questionnaire = quiz_questionnaire num_quiz_questions&lt;br /&gt;
&lt;br /&gt;
:if questionnaire.valid?&lt;br /&gt;
::return questionnaire&lt;br /&gt;
: end&lt;br /&gt;
&lt;br /&gt;
:questionnaire_errors questionnaire&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
All tests were implemented as part of &amp;lt;code&amp;gt;spec/features/quiz_spec.rb&amp;lt;/code&amp;gt; and thoroughly cover the Use Case, scenarios, and sub flows listed above. A factory file, &amp;lt;code&amp;gt;spec/factories/quiz_factory.rb&amp;lt;/code&amp;gt; was added to aid testing.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_E1621_Refactor_and_Test_the_Quizzing_Feature&amp;diff=102280</id>
		<title>CSC/ECE 517 Spring 2016 E1621 Refactor and Test the Quizzing Feature</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2016_E1621_Refactor_and_Test_the_Quizzing_Feature&amp;diff=102280"/>
		<updated>2016-04-18T11:27:54Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by &amp;lt;code&amp;gt;questionnaires_controller.valid_quiz&amp;lt;/code&amp;gt;. This method is rather long, involved, and does not take advantage of object-oriented practices. It combs through the parameters hash received from a request and manually checks all quiz fields, all question fields, all question choice fields, and verifies that each question has a correct choice.&lt;br /&gt;
&lt;br /&gt;
We will refactor the method to construct a quiz questionniare and then call &amp;lt;code&amp;gt;valid?&amp;lt;/code&amp;gt; to recursively validate the object tree using ActiveRecord validations. This is an improvement over the current code which checks all questions manually. The purpose of refactoring in this manner is to enhance readability, DRYness, and maintainability of Expertiza code.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the expected behavior is present for all use cases.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
=Classes involved=&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* quiz_quesetionnaire.rb&lt;br /&gt;
* quiz_question.rb&lt;br /&gt;
* quiz_question_choice.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
=Use Case and Scenarios=&lt;br /&gt;
The Quiz Use Case allows for instructors to create and manage assignments where students may write quizzes for reviewers on materials they have submitted. See the following scenarios for a complete description of how the feature is expected to work.&lt;br /&gt;
&lt;br /&gt;
==Instructors are able to create and manage an assignment's quiz feature==&lt;br /&gt;
An instructor chooses to create an assignment that has a quiz [S1]. While editing the assignment they may choose the number of quiz questions [S2] and set which phases students are allowed to take the quizzes [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - When creating the assignment there is a checkbox labeled &amp;quot;has quiz.&amp;quot; Checking this box creates an assignment that includes a quiz.&lt;br /&gt;
* [S2] - When an assignment has a quiz there is an input field that accepts the number of questions that will be on each quiz. Setting this number appropriately changes the number of quiz questions.&lt;br /&gt;
* [S3] - Students may not take quizzes on a phase that does not allow them to do so. When on a stage that does allow for quizzes, they may take quizzes on work that they have reviewed.&lt;br /&gt;
&lt;br /&gt;
==Instructors can view quiz questions and scores from the tree view==&lt;br /&gt;
After an assignment has been created the instructor may choose to view student quizzes from the tree view [S1]. While on the quiz view page they see student quizzes [S2] and student responses [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The instructor may navigate to the list of assignments. Assignments with quizzes enabled will provide a link for the instructor to follow and view student quizzes.&lt;br /&gt;
* [S2] - The instructor shall be presented with the quiz title, questions, and answer choices. The correct answer choices will be in bold.&lt;br /&gt;
* [S3] - The score for each student who has taken the quiz shall be listed along with the average quiz score.&lt;br /&gt;
&lt;br /&gt;
==Students can create and edit quizzes==&lt;br /&gt;
A student navigates to the assignment work page and chooses to create a new quiz [S1] or edit an existing one [S2]. By doing so they are able to choose a quiz title  and quiz questions [S3]. Invalid input results in an error message prompting the student to fix the issue [E1].&lt;br /&gt;
&lt;br /&gt;
* [S1] - A student may only create a quiz if they have not yet done so.&lt;br /&gt;
* [S2] - A student may only edit a quiz if they have previously created one.&lt;br /&gt;
* [S3] - The quiz has the number of quiz questions defined by the instructor in the assignment.&lt;br /&gt;
&lt;br /&gt;
* [E1] - Possible errors include:&lt;br /&gt;
** The quiz has no name.&lt;br /&gt;
** One or more questions is missing text.&lt;br /&gt;
** One or more choices is missing text.&lt;br /&gt;
** A question is missing a correct answer choice.&lt;br /&gt;
&lt;br /&gt;
==Students can take quizzes on assignments they have reviewed==&lt;br /&gt;
A student decides to take a quiz [S1] on another team's assignment that they have previously reviewed. They select an artifact for review [S2] and fill in their answers. After submitting the quiz they can view their score on the take quizzes page [S3] and see question-by-question scores by clicking view [S4].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The student may only take a quiz during a stage in which the assignment is configured to allow them to do so.&lt;br /&gt;
* [S2] - Only quizzes from submissions they have reviewed are available.&lt;br /&gt;
* [S3] - The take quizzes page lists the final score for each quiz.&lt;br /&gt;
* [S4] - Choosing to view a quiz will show a student each question along with their answers and the correct answers.&lt;br /&gt;
&lt;br /&gt;
=Design and Implementation=&lt;br /&gt;
Design for the refactoring has been driven by object oriented principles and test-driven-development, and makes use of the existing object hierarchy described in the following UML diagram. &lt;br /&gt;
&lt;br /&gt;
[[File:Expertiza_quiz_hierarchy.png|Expertiza Quiz Hierarchy]]&lt;br /&gt;
&lt;br /&gt;
See the below sections for a part-by-part breakdown of the planned implementation for this project.&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
Quiz tests will be added to the file spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Tests will be made which fully cover the expected behavior of each listed scenario in the Use Case.&lt;br /&gt;
&lt;br /&gt;
==Refactoring==&lt;br /&gt;
Each of the following files will be refactored as described.&lt;br /&gt;
&lt;br /&gt;
===QuestionnaireController===&lt;br /&gt;
Refactor the &amp;lt;code&amp;gt;valid_quiz&amp;lt;/code&amp;gt; method. It will be renamed to &amp;lt;code&amp;gt;validate_quiz&amp;lt;/code&amp;gt; to more properly describe the action that occurs as a result of it being called. The behavior will be changed to construct a new quiz questionnaire with submitted questions wich will be validated using &amp;lt;code&amp;gt;quiz.valid?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionnaire===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations.&lt;br /&gt;
* Presence of name&lt;br /&gt;
&lt;br /&gt;
===QuizQuestion===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
* Presence of type&lt;br /&gt;
* Has a correct answer&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionChoice===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
In order to verify that refactoring has been done correctly and maintains the same external behavior, we will write test cases to the existing implementation. These test cases will be the ground truth of the validation feature. Refactored code will not be considered complete until all of these test cases once again pass.&lt;br /&gt;
&lt;br /&gt;
=Post Completion=&lt;br /&gt;
Testing and refactoring have been completed and a [https://github.com/expertiza/expertiza/pull/671 pull request] created to merge features back into master.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=102123</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=102123"/>
		<updated>2016-04-11T21:29:32Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Instructors can view quiz questions and scores from the tree view */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by &amp;lt;code&amp;gt;questionnaires_controller.valid_quiz&amp;lt;/code&amp;gt;. This method is rather long, involved, and does not take advantage of object-oriented practices. It combs through the parameters hash received from a request and manually checks all quiz fields, all question fields, all question choice fields, and verifies that each question has a correct choice.&lt;br /&gt;
&lt;br /&gt;
We will refactor the method to construct a quiz questionniare and then call &amp;lt;code&amp;gt;valid?&amp;lt;/code&amp;gt; to recursively validate the object tree using ActiveRecord validations. This is an improvement over the current code which checks all questions manually. The purpose of refactoring in this manner is to enhance readability, DRYness, and maintainability of Expertiza code.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the expected behavior is present for all use cases.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
=Classes involved=&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* quiz_quesetionnaire.rb&lt;br /&gt;
* quiz_question.rb&lt;br /&gt;
* quiz_question_choice.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
=Use Case and Scenarios=&lt;br /&gt;
The Quiz Use Case allows for instructors to create and manage assignments where students may write quizzes for reviewers on materials they have submitted. See the following scenarios for a complete description of how the feature is expected to work.&lt;br /&gt;
&lt;br /&gt;
==Instructors are able to create and manage an assignment's quiz feature==&lt;br /&gt;
An instructor chooses to create an assignment that has a quiz [S1]. While editing the assignment they may choose the number of quiz questions [S2] and set which phases students are allowed to take the quizzes [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - When creating the quiz there is a checkbox labeled &amp;quot;has quiz.&amp;quot; Checking this box creates an assignment that includes a quiz.&lt;br /&gt;
* [S2] - When an assignment has a quiz there is an input field that accepts the number of questions that will be on each quiz. Setting this number appropriately changes the number of quiz questions.&lt;br /&gt;
* [S3] - Students may not take quizzes on a phase that does not allow them to do so. When on a stage that does allow for quizzes, they may take quizzes on work that they have reviewed.&lt;br /&gt;
&lt;br /&gt;
==Instructors can view quiz questions and scores from the tree view==&lt;br /&gt;
After an assignment has been created the instructor may choose to view student quizzes from the tree view [S1]. While on the quiz view page they see student quizzes [S2] and student responses [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The instructor may navigate to the list of assignments. Assignments with quizzes enabled will provide a link for the instructor to follow and view student quizzes.&lt;br /&gt;
* [S2] - The instructor shall be presented with the quiz title, questions, and answer choices. The correct answer choices will be in bold.&lt;br /&gt;
* [S3] - The score for each student who has taken the quiz shall be listed along with the average quiz score.&lt;br /&gt;
&lt;br /&gt;
==Students can create and edit quizzes==&lt;br /&gt;
A student navigates to the assignment work page and chooses to create a new quiz [S1] or edit an existing one [S2]. By doing so they are able to choose a quiz title  and quiz questions [S3]. Invalid input results in an error message prompting the student to fix the issue [E1].&lt;br /&gt;
&lt;br /&gt;
* [S1] - A student may only create a quiz if they have not yet done so.&lt;br /&gt;
* [S2] - A student may only edit a quiz if they have previously created one.&lt;br /&gt;
* [S3] - The quiz has the number of quiz questions defined by the instructor in the assignment.&lt;br /&gt;
&lt;br /&gt;
* [E1] - Possible errors include:&lt;br /&gt;
** The quiz has no name.&lt;br /&gt;
** One or more questions is missing text.&lt;br /&gt;
** One or more choices is missing text.&lt;br /&gt;
** A question is missing a correct answer choice.&lt;br /&gt;
&lt;br /&gt;
==Students can take quizzes on assignments they have reviewed==&lt;br /&gt;
A student decides to take a quiz [S1] on another team's assignment that they have previously reviewed. They select an artifact for review [S2] and fill in their answers. After submitting the quiz they can view their score on the take quizzes page [S3] and see question-by-question scores by clicking view [S4].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The student may only take a quiz during a stage in which the assignment is configured to allow them to do so.&lt;br /&gt;
* [S2] - Only quizzes from submissions they have reviewed are available.&lt;br /&gt;
* [S3] - The take quizzes page lists the final score for each quiz.&lt;br /&gt;
* [S4] - Choosing to view a quiz will show a student each question along with their answers and the correct answers.&lt;br /&gt;
&lt;br /&gt;
=Design and Implementation=&lt;br /&gt;
Design for the refactoring has been driven by object oriented principles and test-driven-development, and makes use of the existing object hierarchy described in the following UML diagram. &lt;br /&gt;
&lt;br /&gt;
[[File:Expertiza_quiz_hierarchy.png|Expertiza Quiz Hierarchy]]&lt;br /&gt;
&lt;br /&gt;
See the below sections for a part-by-part breakdown of the planned implementation for this project.&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
Quiz tests will be added to the file spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Tests will be made which fully cover the expected behavior of each listed scenario in the Use Case.&lt;br /&gt;
&lt;br /&gt;
==Refactoring==&lt;br /&gt;
Each of the following files will be refactored as described.&lt;br /&gt;
&lt;br /&gt;
===QuestionnaireController===&lt;br /&gt;
Refactor the &amp;lt;code&amp;gt;valid_quiz&amp;lt;/code&amp;gt; method. It will be renamed to &amp;lt;code&amp;gt;validate_quiz&amp;lt;/code&amp;gt; to more properly describe the action that occurs as a result of it being called. The behavior will be changed to construct a new quiz questionnaire with submitted questions wich will be validated using &amp;lt;code&amp;gt;quiz.valid?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionnaire===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations.&lt;br /&gt;
* Presence of name&lt;br /&gt;
&lt;br /&gt;
===QuizQuestion===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
* Presence of type&lt;br /&gt;
* Has a correct answer&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionChoice===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
In order to verify that refactoring has been done correctly and maintains the same external behavior, we will write test cases to the existing implementation. These test cases will be the ground truth of the validation feature. Refactored code will not be considered complete until all of these test cases once again pass.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101954</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101954"/>
		<updated>2016-04-09T00:38:58Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Instructors are able to create and manage an assignment's quiz feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by &amp;lt;code&amp;gt;questionnaires_controller.valid_quiz&amp;lt;/code&amp;gt;. This method is rather long, involved, and does not take advantage of object-oriented practices. It combs through the parameters hash received from a request and manually checks all quiz fields, all question fields, all question choice fields, and verifies that each question has a correct choice.&lt;br /&gt;
&lt;br /&gt;
We will refactor the method to construct a quiz questionniare and then call &amp;lt;code&amp;gt;valid?&amp;lt;/code&amp;gt; to recursively validate the object tree using ActiveRecord validations. This is an improvement over the current code which checks all questions manually. The purpose of refactoring in this manner is to enhance readability, DRYness, and maintainability of Expertiza code.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the expected behavior is present for all use cases.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
=Classes involved=&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* quiz_quesetionnaire.rb&lt;br /&gt;
* quiz_question.rb&lt;br /&gt;
* quiz_question_choice.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
=Use Case and Scenarios=&lt;br /&gt;
The Quiz Use Case allows for instructors to create and manage assignments where students may write quizzes for reviewers on materials they have submitted. See the following scenarios for a complete description of how the feature is expected to work.&lt;br /&gt;
&lt;br /&gt;
==Instructors are able to create and manage an assignment's quiz feature==&lt;br /&gt;
An instructor chooses to create an assignment that has a quiz [S1]. While editing the assignment they may choose the number of quiz questions [S2] and set which phases students are allowed to take the quizzes [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - When creating the quiz there is a checkbox labeled &amp;quot;has quiz.&amp;quot; Checking this box creates an assignment that includes a quiz.&lt;br /&gt;
* [S2] - When an assignment has a quiz there is an input field that accepts the number of questions that will be on each quiz. Setting this number appropriately changes the number of quiz questions.&lt;br /&gt;
* [S3] - Students may not take quizzes on a phase that does not allow them to do so. When on a stage that does allow for quizzes, they may take quizzes on work that they have reviewed.&lt;br /&gt;
&lt;br /&gt;
==Instructors can view quiz questions and scores from the tree view==&lt;br /&gt;
After an assignment has been created the instructor may choose to view student quizzes from the tree view [S1]. While on the quiz view page they see student quizzes [S2] and student responses [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The instructor may navigate to the list of assignments. Assignments with quizzes enabled will provide a link for the instructor to follow and view student quizzes.&lt;br /&gt;
* [S2] - The quiz title and questions are to be presented in a clear manner. The correct answer choices should be easily determined.&lt;br /&gt;
* [S3] - The score for each student who has taken the quiz shall be listed along with the average quiz score.&lt;br /&gt;
&lt;br /&gt;
==Students can create and edit quizzes==&lt;br /&gt;
A student navigates to the assignment work page and chooses to create a new quiz [S1] or edit an existing one [S2]. By doing so they are able to choose a quiz title  and quiz questions [S3]. Invalid input results in an error message prompting the student to fix the issue [E1].&lt;br /&gt;
&lt;br /&gt;
* [S1] - A student may only create a quiz if they have not yet done so.&lt;br /&gt;
* [S2] - A student may only edit a quiz if they have previously created one.&lt;br /&gt;
* [S3] - The quiz has the number of quiz questions defined by the instructor in the assignment.&lt;br /&gt;
&lt;br /&gt;
* [E1] - Possible errors include:&lt;br /&gt;
** The quiz has no name.&lt;br /&gt;
** One or more questions is missing text.&lt;br /&gt;
** One or more choices is missing text.&lt;br /&gt;
** A question is missing a correct answer choice.&lt;br /&gt;
&lt;br /&gt;
==Students can take quizzes on assignments they have reviewed==&lt;br /&gt;
A student decides to take a quiz [S1] on another team's assignment that they have previously reviewed. They select an artifact for review [S2] and fill in their answers. After submitting the quiz they can view their score on the take quizzes page [S3] and see question-by-question scores by clicking view [S4].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The student may only take a quiz during a stage in which the assignment is configured to allow them to do so.&lt;br /&gt;
* [S2] - Only quizzes from submissions they have reviewed are available.&lt;br /&gt;
* [S3] - The take quizzes page lists the final score for each quiz.&lt;br /&gt;
* [S4] - Choosing to view a quiz will show a student each question along with their answers and the correct answers.&lt;br /&gt;
&lt;br /&gt;
=Design and Implementation=&lt;br /&gt;
Design for the refactoring has been driven by object oriented principles and test-driven-development, and makes use of the existing object hierarchy described in the following UML diagram. &lt;br /&gt;
&lt;br /&gt;
[[File:Expertiza_quiz_hierarchy.png|Expertiza Quiz Hierarchy]]&lt;br /&gt;
&lt;br /&gt;
See the below sections for a part-by-part breakdown of the planned implementation for this project.&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
Quiz tests will be added to the file spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Tests will be made which fully cover the expected behavior of each listed scenario in the Use Case.&lt;br /&gt;
&lt;br /&gt;
==Refactoring==&lt;br /&gt;
Each of the following files will be refactored as described.&lt;br /&gt;
&lt;br /&gt;
===QuestionnaireController===&lt;br /&gt;
Refactor the &amp;lt;code&amp;gt;valid_quiz&amp;lt;/code&amp;gt; method. It will be renamed to &amp;lt;code&amp;gt;validate_quiz&amp;lt;/code&amp;gt; to more properly describe the action that occurs as a result of it being called. The behavior will be changed to construct a new quiz questionnaire with submitted questions wich will be validated using &amp;lt;code&amp;gt;quiz.valid?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionnaire===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations.&lt;br /&gt;
* Presence of name&lt;br /&gt;
&lt;br /&gt;
===QuizQuestion===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
* Presence of type&lt;br /&gt;
* Has a correct answer&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionChoice===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
In order to verify that refactoring has been done correctly and maintains the same external behavior, we will write test cases to the existing implementation. These test cases will be the ground truth of the validation feature. Refactored code will not be considered complete until all of these test cases once again pass.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101953</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101953"/>
		<updated>2016-04-09T00:37:57Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Classes involved */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by &amp;lt;code&amp;gt;questionnaires_controller.valid_quiz&amp;lt;/code&amp;gt;. This method is rather long, involved, and does not take advantage of object-oriented practices. It combs through the parameters hash received from a request and manually checks all quiz fields, all question fields, all question choice fields, and verifies that each question has a correct choice.&lt;br /&gt;
&lt;br /&gt;
We will refactor the method to construct a quiz questionniare and then call &amp;lt;code&amp;gt;valid?&amp;lt;/code&amp;gt; to recursively validate the object tree using ActiveRecord validations. This is an improvement over the current code which checks all questions manually. The purpose of refactoring in this manner is to enhance readability, DRYness, and maintainability of Expertiza code.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the expected behavior is present for all use cases.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
=Classes involved=&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* quiz_quesetionnaire.rb&lt;br /&gt;
* quiz_question.rb&lt;br /&gt;
* quiz_question_choice.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
=Use Case and Scenarios=&lt;br /&gt;
The Quiz Use Case allows for instructors to create and manage assignments where students may write quizzes for reviewers on materials they have submitted. See the following scenarios for a complete description of how the feature is expected to work.&lt;br /&gt;
&lt;br /&gt;
==Instructors are able to create and manage an assignment's quiz feature==&lt;br /&gt;
An instructor chooses to create an assignment that has quiz [S1]. While editing the assignment they may choose the number of quiz questions [S2] and set which phases students are allowed to take the quizzes [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - When creating the quiz there is a checkbox labeled &amp;quot;has quiz.&amp;quot; Checking this box creates an assignment that includes a quiz.&lt;br /&gt;
* [S2] - When an assignment has a quiz there is an input field that accepts the number of questions that will be on each quiz. Setting this number appropriately changes the number of quiz questions.&lt;br /&gt;
* [S3] - Students may not take quizzes on a phase that does not allow them to do so. When on a stage that does allow for quizzes, they may take quizzes on work that they have reviewed. &lt;br /&gt;
&lt;br /&gt;
==Instructors can view quiz questions and scores from the tree view==&lt;br /&gt;
After an assignment has been created the instructor may choose to view student quizzes from the tree view [S1]. While on the quiz view page they see student quizzes [S2] and student responses [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The instructor may navigate to the list of assignments. Assignments with quizzes enabled will provide a link for the instructor to follow and view student quizzes.&lt;br /&gt;
* [S2] - The quiz title and questions are to be presented in a clear manner. The correct answer choices should be easily determined.&lt;br /&gt;
* [S3] - The score for each student who has taken the quiz shall be listed along with the average quiz score.&lt;br /&gt;
&lt;br /&gt;
==Students can create and edit quizzes==&lt;br /&gt;
A student navigates to the assignment work page and chooses to create a new quiz [S1] or edit an existing one [S2]. By doing so they are able to choose a quiz title  and quiz questions [S3]. Invalid input results in an error message prompting the student to fix the issue [E1].&lt;br /&gt;
&lt;br /&gt;
* [S1] - A student may only create a quiz if they have not yet done so.&lt;br /&gt;
* [S2] - A student may only edit a quiz if they have previously created one.&lt;br /&gt;
* [S3] - The quiz has the number of quiz questions defined by the instructor in the assignment.&lt;br /&gt;
&lt;br /&gt;
* [E1] - Possible errors include:&lt;br /&gt;
** The quiz has no name.&lt;br /&gt;
** One or more questions is missing text.&lt;br /&gt;
** One or more choices is missing text.&lt;br /&gt;
** A question is missing a correct answer choice.&lt;br /&gt;
&lt;br /&gt;
==Students can take quizzes on assignments they have reviewed==&lt;br /&gt;
A student decides to take a quiz [S1] on another team's assignment that they have previously reviewed. They select an artifact for review [S2] and fill in their answers. After submitting the quiz they can view their score on the take quizzes page [S3] and see question-by-question scores by clicking view [S4].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The student may only take a quiz during a stage in which the assignment is configured to allow them to do so.&lt;br /&gt;
* [S2] - Only quizzes from submissions they have reviewed are available.&lt;br /&gt;
* [S3] - The take quizzes page lists the final score for each quiz.&lt;br /&gt;
* [S4] - Choosing to view a quiz will show a student each question along with their answers and the correct answers.&lt;br /&gt;
&lt;br /&gt;
=Design and Implementation=&lt;br /&gt;
Design for the refactoring has been driven by object oriented principles and test-driven-development, and makes use of the existing object hierarchy described in the following UML diagram. &lt;br /&gt;
&lt;br /&gt;
[[File:Expertiza_quiz_hierarchy.png|Expertiza Quiz Hierarchy]]&lt;br /&gt;
&lt;br /&gt;
See the below sections for a part-by-part breakdown of the planned implementation for this project.&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
Quiz tests will be added to the file spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Tests will be made which fully cover the expected behavior of each listed scenario in the Use Case.&lt;br /&gt;
&lt;br /&gt;
==Refactoring==&lt;br /&gt;
Each of the following files will be refactored as described.&lt;br /&gt;
&lt;br /&gt;
===QuestionnaireController===&lt;br /&gt;
Refactor the &amp;lt;code&amp;gt;valid_quiz&amp;lt;/code&amp;gt; method. It will be renamed to &amp;lt;code&amp;gt;validate_quiz&amp;lt;/code&amp;gt; to more properly describe the action that occurs as a result of it being called. The behavior will be changed to construct a new quiz questionnaire with submitted questions wich will be validated using &amp;lt;code&amp;gt;quiz.valid?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionnaire===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations.&lt;br /&gt;
* Presence of name&lt;br /&gt;
&lt;br /&gt;
===QuizQuestion===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
* Presence of type&lt;br /&gt;
* Has a correct answer&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionChoice===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
In order to verify that refactoring has been done correctly and maintains the same external behavior, we will write test cases to the existing implementation. These test cases will be the ground truth of the validation feature. Refactored code will not be considered complete until all of these test cases once again pass.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101952</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101952"/>
		<updated>2016-04-09T00:21:54Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by &amp;lt;code&amp;gt;questionnaires_controller.valid_quiz&amp;lt;/code&amp;gt;. This method is rather long, involved, and does not take advantage of object-oriented practices. It combs through the parameters hash received from a request and manually checks all quiz fields, all question fields, all question choice fields, and verifies that each question has a correct choice.&lt;br /&gt;
&lt;br /&gt;
We will refactor the method to construct a quiz questionniare and then call &amp;lt;code&amp;gt;valid?&amp;lt;/code&amp;gt; to recursively validate the object tree using ActiveRecord validations. This is an improvement over the current code which checks all questions manually. The purpose of refactoring in this manner is to enhance readability, DRYness, and maintainability of Expertiza code.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the expected behavior is present for all use cases.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* quiz_quesetionnaire.rb&lt;br /&gt;
* quiz_question.rb&lt;br /&gt;
* quiz_question_choice.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
=Use Case and Scenarios=&lt;br /&gt;
The Quiz Use Case allows for instructors to create and manage assignments where students may write quizzes for reviewers on materials they have submitted. See the following scenarios for a complete description of how the feature is expected to work.&lt;br /&gt;
&lt;br /&gt;
==Instructors are able to create and manage an assignment's quiz feature==&lt;br /&gt;
An instructor chooses to create an assignment that has quiz [S1]. While editing the assignment they may choose the number of quiz questions [S2] and set which phases students are allowed to take the quizzes [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - When creating the quiz there is a checkbox labeled &amp;quot;has quiz.&amp;quot; Checking this box creates an assignment that includes a quiz.&lt;br /&gt;
* [S2] - When an assignment has a quiz there is an input field that accepts the number of questions that will be on each quiz. Setting this number appropriately changes the number of quiz questions.&lt;br /&gt;
* [S3] - Students may not take quizzes on a phase that does not allow them to do so. When on a stage that does allow for quizzes, they may take quizzes on work that they have reviewed. &lt;br /&gt;
&lt;br /&gt;
==Instructors can view quiz questions and scores from the tree view==&lt;br /&gt;
After an assignment has been created the instructor may choose to view student quizzes from the tree view [S1]. While on the quiz view page they see student quizzes [S2] and student responses [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The instructor may navigate to the list of assignments. Assignments with quizzes enabled will provide a link for the instructor to follow and view student quizzes.&lt;br /&gt;
* [S2] - The quiz title and questions are to be presented in a clear manner. The correct answer choices should be easily determined.&lt;br /&gt;
* [S3] - The score for each student who has taken the quiz shall be listed along with the average quiz score.&lt;br /&gt;
&lt;br /&gt;
==Students can create and edit quizzes==&lt;br /&gt;
A student navigates to the assignment work page and chooses to create a new quiz [S1] or edit an existing one [S2]. By doing so they are able to choose a quiz title  and quiz questions [S3]. Invalid input results in an error message prompting the student to fix the issue [E1].&lt;br /&gt;
&lt;br /&gt;
* [S1] - A student may only create a quiz if they have not yet done so.&lt;br /&gt;
* [S2] - A student may only edit a quiz if they have previously created one.&lt;br /&gt;
* [S3] - The quiz has the number of quiz questions defined by the instructor in the assignment.&lt;br /&gt;
&lt;br /&gt;
* [E1] - Possible errors include:&lt;br /&gt;
** The quiz has no name.&lt;br /&gt;
** One or more questions is missing text.&lt;br /&gt;
** One or more choices is missing text.&lt;br /&gt;
** A question is missing a correct answer choice.&lt;br /&gt;
&lt;br /&gt;
==Students can take quizzes on assignments they have reviewed==&lt;br /&gt;
A student decides to take a quiz [S1] on another team's assignment that they have previously reviewed. They select an artifact for review [S2] and fill in their answers. After submitting the quiz they can view their score on the take quizzes page [S3] and see question-by-question scores by clicking view [S4].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The student may only take a quiz during a stage in which the assignment is configured to allow them to do so.&lt;br /&gt;
* [S2] - Only quizzes from submissions they have reviewed are available.&lt;br /&gt;
* [S3] - The take quizzes page lists the final score for each quiz.&lt;br /&gt;
* [S4] - Choosing to view a quiz will show a student each question along with their answers and the correct answers.&lt;br /&gt;
&lt;br /&gt;
=Design and Implementation=&lt;br /&gt;
Design for the refactoring has been driven by object oriented principles and test-driven-development, and makes use of the existing object hierarchy described in the following UML diagram. &lt;br /&gt;
&lt;br /&gt;
[[File:Expertiza_quiz_hierarchy.png|Expertiza Quiz Hierarchy]]&lt;br /&gt;
&lt;br /&gt;
See the below sections for a part-by-part breakdown of the planned implementation for this project.&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
Quiz tests will be added to the file spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Tests will be made which fully cover the expected behavior of each listed scenario in the Use Case.&lt;br /&gt;
&lt;br /&gt;
==Refactoring==&lt;br /&gt;
Each of the following files will be refactored as described.&lt;br /&gt;
&lt;br /&gt;
===QuestionnaireController===&lt;br /&gt;
Refactor the &amp;lt;code&amp;gt;valid_quiz&amp;lt;/code&amp;gt; method. It will be renamed to &amp;lt;code&amp;gt;validate_quiz&amp;lt;/code&amp;gt; to more properly describe the action that occurs as a result of it being called. The behavior will be changed to construct a new quiz questionnaire with submitted questions wich will be validated using &amp;lt;code&amp;gt;quiz.valid?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionnaire===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations.&lt;br /&gt;
* Presence of name&lt;br /&gt;
&lt;br /&gt;
===QuizQuestion===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
* Presence of type&lt;br /&gt;
* Has a correct answer&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionChoice===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
In order to verify that refactoring has been done correctly and maintains the same external behavior, we will write test cases to the existing implementation. These test cases will be the ground truth of the validation feature. Refactored code will not be considered complete until all of these test cases once again pass.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101951</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101951"/>
		<updated>2016-04-09T00:17:26Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: Obligatory photo.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by &amp;lt;code&amp;gt;questionnaires_controller.valid_quiz&amp;lt;/code&amp;gt;. This method is rather long, involved, and does not take advantage of object-oriented practices. It combs through the parameters hash received from a request and manually checks all quiz fields, all question fields, all question choice fields, and verifies that each question has a correct choice.&lt;br /&gt;
&lt;br /&gt;
We will refactor the method to construct a quiz questionniare and then call &amp;lt;code&amp;gt;valid?&amp;lt;/code&amp;gt; to recursively validate the object tree using ActiveRecord validations. This is an improvement over the current code which checks all questions manually. The purpose of refactoring in this manner is to enhance readability, DRYness, and maintainability of Expertiza code.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the expected behavior is present for all use cases.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* quiz_quesetionnaire.rb&lt;br /&gt;
* quiz_question.rb&lt;br /&gt;
* quiz_question_choice.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
=Use Case and Scenarios=&lt;br /&gt;
The Quiz Use Case allows for instructors to create and manage assignments where students may write quizzes for reviewers on materials they have submitted. See the following scenarios for a complete description of how the feature is expected to work.&lt;br /&gt;
&lt;br /&gt;
==Instructors are able to create and manage an assignment's quiz feature==&lt;br /&gt;
An instructor chooses to create an assignment that has quiz [S1]. While editing the assignment they may choose the number of quiz questions [S2] and set which phases students are allowed to take the quizzes [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - When creating the quiz there is a checkbox labeled &amp;quot;has quiz.&amp;quot; Checking this box creates an assignment that includes a quiz.&lt;br /&gt;
* [S2] - When an assignment has a quiz there is an input field that accepts the number of questions that will be on each quiz. Setting this number appropriately changes the number of quiz questions.&lt;br /&gt;
* [S3] - Students may not take quizzes on a phase that does not allow them to do so. When on a stage that does allow for quizzes, they may take quizzes on work that they have reviewed. &lt;br /&gt;
&lt;br /&gt;
==Instructors can view quiz questions and scores from the tree view==&lt;br /&gt;
After an assignment has been created the instructor may choose to view student quizzes from the tree view [S1]. While on the quiz view page they see student quizzes [S2] and student responses [S3].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The instructor may navigate to the list of assignments. Assignments with quizzes enabled will provide a link for the instructor to follow and view student quizzes.&lt;br /&gt;
* [S2] - The quiz title and questions are to be presented in a clear manner. The correct answer choices should be easily determined.&lt;br /&gt;
* [S3] - The score for each student who has taken the quiz shall be listed along with the average quiz score.&lt;br /&gt;
&lt;br /&gt;
==Students can create and edit quizzes==&lt;br /&gt;
A student navigates to the assignment work page and chooses to create a new quiz [S1] or edit an existing one [S2]. By doing so they are able to choose a quiz title  and quiz questions [S3]. Invalid input results in an error message prompting the student to fix the issue [E1].&lt;br /&gt;
&lt;br /&gt;
* [S1] - A student may only create a quiz if they have not yet done so.&lt;br /&gt;
* [S2] - A student may only edit a quiz if they have previously created one.&lt;br /&gt;
* [S3] - The quiz has the number of quiz questions defined by the instructor in the assignment.&lt;br /&gt;
&lt;br /&gt;
* [E1] - Possible errors include:&lt;br /&gt;
** The quiz has no name.&lt;br /&gt;
** One or more questions is missing text.&lt;br /&gt;
** One or more choices is missing text.&lt;br /&gt;
** A question is missing a correct answer choice.&lt;br /&gt;
&lt;br /&gt;
==Students can take quizzes on assignments they have reviewed==&lt;br /&gt;
A student decides to take a quiz [S1] on another team's assignment that they have previously reviewed. They select an artifact for review [S2] and fill in their answers. After submitting the quiz they can view their score on the take quizzes page [S3] and see question-by-question scores by clicking view [S4].&lt;br /&gt;
&lt;br /&gt;
* [S1] - The student may only take a quiz during a stage in which the assignment is configured to allow them to do so.&lt;br /&gt;
* [S2] - Only quizzes from submissions they have reviewed are available.&lt;br /&gt;
* [S3] - The take quizzes page lists the final score for each quiz.&lt;br /&gt;
* [S4] - Choosing to view a quiz will show a student each question along with their answers and the correct answers.&lt;br /&gt;
&lt;br /&gt;
=Design and Implementation=&lt;br /&gt;
Design for the refactoring has been driven by object oriented principles and test-driven-development, and makes use of the existing object hierarchy described in the following UML diagram. &lt;br /&gt;
&lt;br /&gt;
[[File:Expertiza_quiz_hierarchy.png|Expertiza Quiz Hierarchy]]&lt;br /&gt;
&lt;br /&gt;
See the below sections for a part-by-part breakdown of the planned implementation for this project.&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
Quiz tests will be added to the file spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Test will be made to fully cover the expected behavior of each listed scenario in the quizzes use case.&lt;br /&gt;
&lt;br /&gt;
==Refactoring==&lt;br /&gt;
Each of the following files will be refactored as described.&lt;br /&gt;
&lt;br /&gt;
===QuestionnaireController===&lt;br /&gt;
Refactor the &amp;lt;code&amp;gt;valid_quiz&amp;lt;/code&amp;gt; method. It will be renamed to &amp;lt;code&amp;gt;validate_quiz&amp;lt;/code&amp;gt; to more properly describe the action that occurs as a result of it being called. The behavior will be changed to construct a new quiz questionnaire with submitted questions wich will be validated using &amp;lt;code&amp;gt;quiz.valid?&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionnaire===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations.&lt;br /&gt;
* Presence of name&lt;br /&gt;
&lt;br /&gt;
===QuizQuestion===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
* Presence of type&lt;br /&gt;
* Has a correct answer&lt;br /&gt;
&lt;br /&gt;
===QuizQuestionChoice===&lt;br /&gt;
The following fields will be validated using ActiveRecord validations&lt;br /&gt;
* Presence of text&lt;br /&gt;
&lt;br /&gt;
===Test Cases===&lt;br /&gt;
In order to verify that refactoring has been done correctly and maintains the same external behavior, we will write test cases to the existing implementation. These test cases will be the ground truth of the validation feature. Refactored code will not be considered complete until all of these test cases once again pass.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Expertiza_quiz_hierarchy.png&amp;diff=101950</id>
		<title>File:Expertiza quiz hierarchy.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Expertiza_quiz_hierarchy.png&amp;diff=101950"/>
		<updated>2016-04-09T00:11:36Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: UML describing the hierarchy involved in creating quizzes from the questionnaire controller.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;UML describing the hierarchy involved in creating quizzes from the questionnaire controller.&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101604</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101604"/>
		<updated>2016-04-01T23:17:59Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* QuizQuestionnaire */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by questionnaires_controller#valid_quiz. This method is rather long, involved, and does not take advantage of object-oriented practices. We will refactor the method to construct a quiz question object and then call valid? to check if the question is valid. This is an improvement over the current code which checks all questions manually.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the correct behavior is present.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
The purpose of this assignment is to enhance readability, DRYness, and maintainability of Expertiza code through refactoring and functional testing.&lt;br /&gt;
&lt;br /&gt;
== What is wrong with it ==&lt;br /&gt;
The valid_quiz method in questionnaires_controller needs to be refactored. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid.&lt;br /&gt;
&lt;br /&gt;
== What needs to be done ==&lt;br /&gt;
Student-generated quizzes is the feature that students use for writing quizzes for the Wikipedia contribution assignment. In this project, you need to do refactoring and create functional tests for this feature:&lt;br /&gt;
* Refactoring:&lt;br /&gt;
** Refactor the valid_quiz method in questionnaires_controller. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid. &lt;br /&gt;
* Testing:&lt;br /&gt;
** The instructor can set up an assignment which supports quizzing feature by&lt;br /&gt;
*** Checking the “has quiz” box&lt;br /&gt;
*** Setting the # of question for each set of quiz&lt;br /&gt;
*** Setting in which deadline can student reviewers take the quizzes&lt;br /&gt;
** Student authors can create quizzes and edit them:&lt;br /&gt;
*** They can create quizzes on the “Your work” page&lt;br /&gt;
*** They can edit the quiz questions.&lt;br /&gt;
*** They can view the quiz questions.&lt;br /&gt;
*** If the quiz question has something missing, the system will flash an error message, either:&lt;br /&gt;
**** The name of quiz is missing.&lt;br /&gt;
**** The question text is missing for one or more questions.&lt;br /&gt;
**** The choices are missing for one or more questions.&lt;br /&gt;
**** The correct answer(s) have not been provided.&lt;br /&gt;
** Student reviewers can take the quizzes on the work they have reviewed/they need to review&lt;br /&gt;
*** They need to request the artifact to review first. If this artifact has a quiz associated, they can take the quiz in the round which quiz-taking is allowed.&lt;br /&gt;
*** They can click “take quiz” then request quizzes to take.&lt;br /&gt;
*** They can fill in their choices on the quizzes.&lt;br /&gt;
*** After taking the quizzes, and submitting, they will see their grade on the “Take quizzes” page&lt;br /&gt;
*** On the “take quizzes” page, they can see their question-by-question scores for finished quizzes by clicking “view”&lt;br /&gt;
** Instructor can view the quiz questions and quiz scores on the tree display by clicking “view quiz questions” icon.&lt;br /&gt;
&lt;br /&gt;
= Scope =&lt;br /&gt;
This project can be divided into major work items:&lt;br /&gt;
&lt;br /&gt;
# Instructors is able to create and manage an assignment's quiz feature.&lt;br /&gt;
# Instructors can view quiz questions and scores from the tree view.&lt;br /&gt;
# Students can create quizzes and edit them.&lt;br /&gt;
# Students can take quizzes on assignments they have reviewed.&lt;br /&gt;
# Refactor questionnaires_controller#valid_quiz&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Quiz test will be added to spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Additionally, refactoring on questionnaires_controller may include the creation of the valid? method in app/models/quiz_question.rb.&lt;br /&gt;
&lt;br /&gt;
=Design=&lt;br /&gt;
Design for the refactoring will be driven by object oriented principles and test-driven-development.&lt;br /&gt;
&lt;br /&gt;
==QuizQuestion==&lt;br /&gt;
Implement a &amp;lt;code&amp;gt;validate&amp;lt;/code&amp;gt; method that validates a quiz question for correctness including&lt;br /&gt;
* Has text&lt;br /&gt;
* Has type&lt;br /&gt;
* Has all options&lt;br /&gt;
* Has a correct answer&lt;br /&gt;
** If radio only one correct answer&lt;br /&gt;
** If checkbox at least one correct anser&lt;br /&gt;
&lt;br /&gt;
==QuizQuestionnaire==&lt;br /&gt;
Implement a &amp;lt;code&amp;gt;validate&amp;lt;/code&amp;gt; method that validates a quiz and all of its questions for correctness including&lt;br /&gt;
* Has name&lt;br /&gt;
&lt;br /&gt;
==QuestionnaireController==&lt;br /&gt;
Refactor the &amp;lt;code&amp;gt;valid_quiz&amp;lt;/code&amp;gt; method to construct a new quiz object with submitted questions. This quiz object will be validated using &amp;lt;code&amp;gt;quiz.validate&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
Implement unit test cases for each of the methods listed above.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101586</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101586"/>
		<updated>2016-04-01T20:05:01Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by questionnaires_controller#valid_quiz. This method is rather long, involved, and does not take advantage of object-oriented practices. We will refactor the method to construct a quiz question object and then call valid? to check if the question is valid. This is an improvement over the current code which checks all questions manually.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the correct behavior is present.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
The purpose of this assignment is to enhance readability, DRYness, and maintainability of Expertiza code through refactoring and functional testing.&lt;br /&gt;
&lt;br /&gt;
== What is wrong with it ==&lt;br /&gt;
The valid_quiz method in questionnaires_controller needs to be refactored. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid.&lt;br /&gt;
&lt;br /&gt;
== What needs to be done ==&lt;br /&gt;
Student-generated quizzes is the feature that students use for writing quizzes for the Wikipedia contribution assignment. In this project, you need to do refactoring and create functional tests for this feature:&lt;br /&gt;
* Refactoring:&lt;br /&gt;
** Refactor the valid_quiz method in questionnaires_controller. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid. &lt;br /&gt;
* Testing:&lt;br /&gt;
** The instructor can set up an assignment which supports quizzing feature by&lt;br /&gt;
*** Checking the “has quiz” box&lt;br /&gt;
*** Setting the # of question for each set of quiz&lt;br /&gt;
*** Setting in which deadline can student reviewers take the quizzes&lt;br /&gt;
** Student authors can create quizzes and edit them:&lt;br /&gt;
*** They can create quizzes on the “Your work” page&lt;br /&gt;
*** They can edit the quiz questions.&lt;br /&gt;
*** They can view the quiz questions.&lt;br /&gt;
*** If the quiz question has something missing, the system will flash an error message, either:&lt;br /&gt;
**** The name of quiz is missing.&lt;br /&gt;
**** The question text is missing for one or more questions.&lt;br /&gt;
**** The choices are missing for one or more questions.&lt;br /&gt;
**** The correct answer(s) have not been provided.&lt;br /&gt;
** Student reviewers can take the quizzes on the work they have reviewed/they need to review&lt;br /&gt;
*** They need to request the artifact to review first. If this artifact has a quiz associated, they can take the quiz in the round which quiz-taking is allowed.&lt;br /&gt;
*** They can click “take quiz” then request quizzes to take.&lt;br /&gt;
*** They can fill in their choices on the quizzes.&lt;br /&gt;
*** After taking the quizzes, and submitting, they will see their grade on the “Take quizzes” page&lt;br /&gt;
*** On the “take quizzes” page, they can see their question-by-question scores for finished quizzes by clicking “view”&lt;br /&gt;
** Instructor can view the quiz questions and quiz scores on the tree display by clicking “view quiz questions” icon.&lt;br /&gt;
&lt;br /&gt;
= Scope =&lt;br /&gt;
This project can be divided into major work items:&lt;br /&gt;
&lt;br /&gt;
# Instructors is able to create and manage an assignment's quiz feature.&lt;br /&gt;
# Instructors can view quiz questions and scores from the tree view.&lt;br /&gt;
# Students can create quizzes and edit them.&lt;br /&gt;
# Students can take quizzes on assignments they have reviewed.&lt;br /&gt;
# Refactor questionnaires_controller#valid_quiz&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Quiz test will be added to spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Additionally, refactoring on questionnaires_controller may include the creation of the valid? method in app/models/quiz_question.rb.&lt;br /&gt;
&lt;br /&gt;
=Design=&lt;br /&gt;
Design for the refactoring will be driven by object oriented principles and test-driven-development.&lt;br /&gt;
&lt;br /&gt;
==QuizQuestion==&lt;br /&gt;
Implement a &amp;lt;code&amp;gt;validate&amp;lt;/code&amp;gt; method that validates a quiz question for correctness including&lt;br /&gt;
* Has text&lt;br /&gt;
* Has type&lt;br /&gt;
* Has all options&lt;br /&gt;
* Has a correct answer&lt;br /&gt;
** If radio only one correct answer&lt;br /&gt;
** If checkbox at least one correct anser&lt;br /&gt;
&lt;br /&gt;
==QuizQuestionnaire==&lt;br /&gt;
Implement a &amp;lt;code&amp;gt;validate&amp;gt;&amp;lt;/code&amp;gt; method that validate a quiz and all of its questions for correctness including&lt;br /&gt;
* Has name&lt;br /&gt;
&lt;br /&gt;
==QuestionnaireController==&lt;br /&gt;
Refactor the &amp;lt;code&amp;gt;valid_quiz&amp;lt;/code&amp;gt; method to construct a new quiz object with submitted questions. This quiz object will be validated using &amp;lt;code&amp;gt;quiz.validate&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
Implement unit test cases for each of the methods listed above.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101450</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101450"/>
		<updated>2016-03-28T22:31:35Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by questionnaires_controller#valid_quiz. This method is rather long, involved, and does not take advantage of object-oriented practices. We will refactor the method to construct a quiz question object and then call valid? to check if the question is valid. This is an improvement over the current code which checks all questions manually.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the correct behavior is present.&lt;br /&gt;
&lt;br /&gt;
A full description of the assignment may be found [https://docs.google.com/document/d/13oRmKemlwRzXG1ItcI2zTx4r3gAAfvmuobZjxiy0oVo/edit#heading=h.su78b3gdq1a7 here]&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
The purpose of this assignment is to enhance readability, DRYness, and maintainability of Expertiza code through refactoring and functional testing.&lt;br /&gt;
&lt;br /&gt;
== What is wrong with it ==&lt;br /&gt;
The valid_quiz method in questionnaires_controller needs to be refactored. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid.&lt;br /&gt;
&lt;br /&gt;
== What needs to be done ==&lt;br /&gt;
Student-generated quizzes is the feature that students use for writing quizzes for the Wikipedia contribution assignment. In this project, you need to do refactoring and create functional tests for this feature:&lt;br /&gt;
* Refactoring:&lt;br /&gt;
** Refactor the valid_quiz method in questionnaires_controller. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid. &lt;br /&gt;
* Testing:&lt;br /&gt;
** The instructor can set up an assignment which supports quizzing feature by&lt;br /&gt;
*** Checking the “has quiz” box&lt;br /&gt;
*** Setting the # of question for each set of quiz&lt;br /&gt;
*** Setting in which deadline can student reviewers take the quizzes&lt;br /&gt;
** Student authors can create quizzes and edit them:&lt;br /&gt;
*** They can create quizzes on the “Your work” page&lt;br /&gt;
*** They can edit the quiz questions.&lt;br /&gt;
*** They can view the quiz questions.&lt;br /&gt;
*** If the quiz question has something missing, the system will flash an error message, either:&lt;br /&gt;
**** The name of quiz is missing.&lt;br /&gt;
**** The question text is missing for one or more questions.&lt;br /&gt;
**** The choices are missing for one or more questions.&lt;br /&gt;
**** The correct answer(s) have not been provided.&lt;br /&gt;
** Student reviewers can take the quizzes on the work they have reviewed/they need to review&lt;br /&gt;
*** They need to request the artifact to review first. If this artifact has a quiz associated, they can take the quiz in the round which quiz-taking is allowed.&lt;br /&gt;
*** They can click “take quiz” then request quizzes to take.&lt;br /&gt;
*** They can fill in their choices on the quizzes.&lt;br /&gt;
*** After taking the quizzes, and submitting, they will see their grade on the “Take quizzes” page&lt;br /&gt;
*** On the “take quizzes” page, they can see their question-by-question scores for finished quizzes by clicking “view”&lt;br /&gt;
** Instructor can view the quiz questions and quiz scores on the tree display by clicking “view quiz questions” icon.&lt;br /&gt;
&lt;br /&gt;
= Scope =&lt;br /&gt;
This project can be divided into major work items:&lt;br /&gt;
&lt;br /&gt;
# Instructors is able to create and manage an assignment's quiz feature.&lt;br /&gt;
# Instructors can view quiz questions and scores from the tree view.&lt;br /&gt;
# Students can create quizzes and edit them.&lt;br /&gt;
# Students can take quizzes on assignments they have reviewed.&lt;br /&gt;
# Refactor questionnaires_controller#valid_quiz&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Quiz test will be added to spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Additionally, refactoring on questionnaires_controller may include the creation of the valid? method in app/models/quiz_question.rb.&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
Design for the refactoring will be driven by object oriented principles and test-driven-development.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101442</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101442"/>
		<updated>2016-03-28T22:18:25Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by questionnaires_controller#valid_quiz. This method is rather long, involved, and does not take advantage of object-oriented practices. We will refactor the method to construct a quiz question object and then call valid? to check if the question is valid. This is an improvement over the current code which checks all questions manually.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the correct behavior is present.&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
The purpose of this assignment is to enhance readability, DRYness, and maintainability of Expertiza code through refactoring and functional testing.&lt;br /&gt;
&lt;br /&gt;
== What is wrong with it ==&lt;br /&gt;
The valid_quiz method in questionnaires_controller needs to be refactored. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid.&lt;br /&gt;
&lt;br /&gt;
== What needs to be done ==&lt;br /&gt;
Student-generated quizzes is the feature that students use for writing quizzes for the Wikipedia contribution assignment. In this project, you need to do refactoring and create functional tests for this feature:&lt;br /&gt;
* Refactoring:&lt;br /&gt;
** Refactor the valid_quiz method in questionnaires_controller. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid. &lt;br /&gt;
* Testing:&lt;br /&gt;
** The instructor can set up an assignment which supports quizzing feature by&lt;br /&gt;
*** Checking the “has quiz” box&lt;br /&gt;
*** Setting the # of question for each set of quiz&lt;br /&gt;
*** Setting in which deadline can student reviewers take the quizzes&lt;br /&gt;
** Student authors can create quizzes and edit them:&lt;br /&gt;
*** They can create quizzes on the “Your work” page&lt;br /&gt;
*** They can edit the quiz questions.&lt;br /&gt;
*** They can view the quiz questions.&lt;br /&gt;
*** If the quiz question has something missing, the system will flash an error message, either:&lt;br /&gt;
**** The name of quiz is missing.&lt;br /&gt;
**** The question text is missing for one or more questions.&lt;br /&gt;
**** The choices are missing for one or more questions.&lt;br /&gt;
**** The correct answer(s) have not been provided.&lt;br /&gt;
** Student reviewers can take the quizzes on the work they have reviewed/they need to review&lt;br /&gt;
*** They need to request the artifact to review first. If this artifact has a quiz associated, they can take the quiz in the round which quiz-taking is allowed.&lt;br /&gt;
*** They can click “take quiz” then request quizzes to take.&lt;br /&gt;
*** They can fill in their choices on the quizzes.&lt;br /&gt;
*** After taking the quizzes, and submitting, they will see their grade on the “Take quizzes” page&lt;br /&gt;
*** On the “take quizzes” page, they can see their question-by-question scores for finished quizzes by clicking “view”&lt;br /&gt;
** Instructor can view the quiz questions and quiz scores on the tree display by clicking “view quiz questions” icon.&lt;br /&gt;
&lt;br /&gt;
= Scope =&lt;br /&gt;
This project can be divided into major work items:&lt;br /&gt;
&lt;br /&gt;
# Instructors is able to create and manage an assignment's quiz feature.&lt;br /&gt;
# Instructors can view quiz questions and scores from the tree view.&lt;br /&gt;
# Students can create quizzes and edit them.&lt;br /&gt;
# Students can take quizzes on assignments they have reviewed.&lt;br /&gt;
# Refactor questionnaires_controller#valid_quiz&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Quiz test will be added to spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Additionally, refactoring on questionnaires_controller may include the creation of the valid? method in app/models/quiz_question.rb.&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
Design for the refactoring will be driven by object oriented principles and test-driven-development.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101441</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101441"/>
		<updated>2016-03-28T22:13:44Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by questionnaires_controller#valid_quiz. This method is rather long, involved, and does not take advantage of object-oriented practices. We will refactor the method to construct a quiz question object and then call valid? to check if the question is valid. This is an improvement over the current code which checks all questions manually.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the correct behavior is present.&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
The purpose of this assignment is to enhance readability, DRYness, and maintainability of Expertiza code through refactoring and functional testing.&lt;br /&gt;
&lt;br /&gt;
== What is wrong with it ==&lt;br /&gt;
The valid_quiz method in questionnaires_controller needs to be refactored. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid.&lt;br /&gt;
&lt;br /&gt;
== What needs to be done ==&lt;br /&gt;
Student-generated quizzes is the feature that students use for writing quizzes for the Wikipedia contribution assignment. In this project, you need to do refactoring and create functional tests for this feature:&lt;br /&gt;
* Refactoring:&lt;br /&gt;
** Refactor the valid_quiz method in questionnaires_controller. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid. &lt;br /&gt;
* Testing:&lt;br /&gt;
** The instructor can set up an assignment which supports quizzing feature by&lt;br /&gt;
*** Checking the “has quiz” box&lt;br /&gt;
*** Setting the # of question for each set of quiz&lt;br /&gt;
*** Setting in which deadline can student reviewers take the quizzes&lt;br /&gt;
** Student authors can create quizzes and edit them:&lt;br /&gt;
*** They can create quizzes on the “Your work” page&lt;br /&gt;
*** They can edit the quiz questions.&lt;br /&gt;
*** They can view the quiz questions.&lt;br /&gt;
*** If the quiz question has something missing, the system will flash an error message, either:&lt;br /&gt;
**** The name of quiz is missing.&lt;br /&gt;
**** The question text is missing for one or more questions.&lt;br /&gt;
**** The choices are missing for one or more questions.&lt;br /&gt;
**** The correct answer(s) have not been provided.&lt;br /&gt;
** Student reviewers can take the quizzes on the work they have reviewed/they need to review&lt;br /&gt;
*** They need to request the artifact to review first. If this artifact has a quiz associated, they can take the quiz in the round which quiz-taking is allowed.&lt;br /&gt;
*** They can click “take quiz” then request quizzes to take.&lt;br /&gt;
*** They can fill in their choices on the quizzes.&lt;br /&gt;
*** After taking the quizzes, and submitting, they will see their grade on the “Take quizzes” page&lt;br /&gt;
*** On the “take quizzes” page, they can see their question-by-question scores for finished quizzes by clicking “view”&lt;br /&gt;
** Instructor can view the quiz questions and quiz scores on the tree display by clicking “view quiz questions” icon.&lt;br /&gt;
&lt;br /&gt;
= Scope =&lt;br /&gt;
This project can be divided into major work items:&lt;br /&gt;
&lt;br /&gt;
# Instructors is able to create and manage an assignment's quiz feature.&lt;br /&gt;
# Instructors can view quiz questions and scores from the tree view.&lt;br /&gt;
# Students can create quizzes and edit them.&lt;br /&gt;
# Students can take quizzes on assignments they have reviewed.&lt;br /&gt;
# Refactor questionnaires_controller#valid_quiz&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Quiz test will be added to spec/features/quiz_spec.rb and will make use of&lt;br /&gt;
* rspec&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium&lt;br /&gt;
&lt;br /&gt;
Additionally, refactoring on questionnaires_controller may include the creation of the valid? method in app/models/quiz_question.rb.&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
design&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101440</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101440"/>
		<updated>2016-03-28T22:10:29Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Scope */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by questionnaires_controller#valid_quiz. This method is rather long, involved, and does not take advantage of object-oriented practices. We will refactor the method to construct a quiz question object and then call valid? to check if the question is valid. This is an improvement over the current code which checks all questions manually.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the correct behavior is present.&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
The purpose of this assignment is to enhance readability, DRYness, and maintainability of Expertiza code through refactoring and functional testing.&lt;br /&gt;
&lt;br /&gt;
== What is wrong with it ==&lt;br /&gt;
The valid_quiz method in questionnaires_controller needs to be refactored. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid.&lt;br /&gt;
&lt;br /&gt;
== What needs to be done ==&lt;br /&gt;
Student-generated quizzes is the feature that students use for writing quizzes for the Wikipedia contribution assignment. In this project, you need to do refactoring and create functional tests for this feature:&lt;br /&gt;
* Refactoring:&lt;br /&gt;
** Refactor the valid_quiz method in questionnaires_controller. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid. &lt;br /&gt;
* Testing:&lt;br /&gt;
** The instructor can set up an assignment which supports quizzing feature by&lt;br /&gt;
*** Checking the “has quiz” box&lt;br /&gt;
*** Setting the # of question for each set of quiz&lt;br /&gt;
*** Setting in which deadline can student reviewers take the quizzes&lt;br /&gt;
** Student authors can create quizzes and edit them:&lt;br /&gt;
*** They can create quizzes on the “Your work” page&lt;br /&gt;
*** They can edit the quiz questions.&lt;br /&gt;
*** They can view the quiz questions.&lt;br /&gt;
*** If the quiz question has something missing, the system will flash an error message, either:&lt;br /&gt;
**** The name of quiz is missing.&lt;br /&gt;
**** The question text is missing for one or more questions.&lt;br /&gt;
**** The choices are missing for one or more questions.&lt;br /&gt;
**** The correct answer(s) have not been provided.&lt;br /&gt;
** Student reviewers can take the quizzes on the work they have reviewed/they need to review&lt;br /&gt;
*** They need to request the artifact to review first. If this artifact has a quiz associated, they can take the quiz in the round which quiz-taking is allowed.&lt;br /&gt;
*** They can click “take quiz” then request quizzes to take.&lt;br /&gt;
*** They can fill in their choices on the quizzes.&lt;br /&gt;
*** After taking the quizzes, and submitting, they will see their grade on the “Take quizzes” page&lt;br /&gt;
*** On the “take quizzes” page, they can see their question-by-question scores for finished quizzes by clicking “view”&lt;br /&gt;
** Instructor can view the quiz questions and quiz scores on the tree display by clicking “view quiz questions” icon.&lt;br /&gt;
&lt;br /&gt;
= Scope =&lt;br /&gt;
This project can be divided into major work items:&lt;br /&gt;
&lt;br /&gt;
# Instructors is able to create and manage an assignment's quiz feature.&lt;br /&gt;
# Instructors can view quiz questions and scores from the tree view.&lt;br /&gt;
# Students can create quizzes and edit them.&lt;br /&gt;
# Students can take quizzes on assignments they have reviewed.&lt;br /&gt;
# Refactor questionnaires_controller#valid_quiz&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
implementation details&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
design&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101439</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101439"/>
		<updated>2016-03-28T22:07:29Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by questionnaires_controller#valid_quiz. This method is rather long, involved, and does not take advantage of object-oriented practices. We will refactor the method to construct a quiz question object and then call valid? to check if the question is valid. This is an improvement over the current code which checks all questions manually.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the correct behavior is present.&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
The purpose of this assignment is to enhance readability, DRYness, and maintainability of Expertiza code through refactoring and functional testing.&lt;br /&gt;
&lt;br /&gt;
== What is wrong with it ==&lt;br /&gt;
The valid_quiz method in questionnaires_controller needs to be refactored. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid.&lt;br /&gt;
&lt;br /&gt;
== What needs to be done ==&lt;br /&gt;
Student-generated quizzes is the feature that students use for writing quizzes for the Wikipedia contribution assignment. In this project, you need to do refactoring and create functional tests for this feature:&lt;br /&gt;
* Refactoring:&lt;br /&gt;
** Refactor the valid_quiz method in questionnaires_controller. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid. &lt;br /&gt;
* Testing:&lt;br /&gt;
** The instructor can set up an assignment which supports quizzing feature by&lt;br /&gt;
*** Checking the “has quiz” box&lt;br /&gt;
*** Setting the # of question for each set of quiz&lt;br /&gt;
*** Setting in which deadline can student reviewers take the quizzes&lt;br /&gt;
** Student authors can create quizzes and edit them:&lt;br /&gt;
*** They can create quizzes on the “Your work” page&lt;br /&gt;
*** They can edit the quiz questions.&lt;br /&gt;
*** They can view the quiz questions.&lt;br /&gt;
*** If the quiz question has something missing, the system will flash an error message, either:&lt;br /&gt;
**** The name of quiz is missing.&lt;br /&gt;
**** The question text is missing for one or more questions.&lt;br /&gt;
**** The choices are missing for one or more questions.&lt;br /&gt;
**** The correct answer(s) have not been provided.&lt;br /&gt;
** Student reviewers can take the quizzes on the work they have reviewed/they need to review&lt;br /&gt;
*** They need to request the artifact to review first. If this artifact has a quiz associated, they can take the quiz in the round which quiz-taking is allowed.&lt;br /&gt;
*** They can click “take quiz” then request quizzes to take.&lt;br /&gt;
*** They can fill in their choices on the quizzes.&lt;br /&gt;
*** After taking the quizzes, and submitting, they will see their grade on the “Take quizzes” page&lt;br /&gt;
*** On the “take quizzes” page, they can see their question-by-question scores for finished quizzes by clicking “view”&lt;br /&gt;
** Instructor can view the quiz questions and quiz scores on the tree display by clicking “view quiz questions” icon.&lt;br /&gt;
&lt;br /&gt;
= Scope =&lt;br /&gt;
This project can be divided into major work items:&lt;br /&gt;
#thing 1&lt;br /&gt;
#thing 2&lt;br /&gt;
#thing 3&lt;br /&gt;
#thing 4&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
implementation details&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
design&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101438</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101438"/>
		<updated>2016-03-28T22:06:43Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
The Expertiza quiz feature is in need of refactoring. Currently, quizzes are checked by questionnaires_controller#valid_quiz. This method is rather long, involved, and does not take advantage of object-oriented practices. We will refactor the method to construct a quiz question object and then call valid? to check if the question is valid. This is an improvement over the current code which checks all questions manually.&lt;br /&gt;
&lt;br /&gt;
In addition to this refactoring we will implement integration testing on the quiz feature to verify that the correct behavior is present.&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
* questionnaires_controller.rb&lt;br /&gt;
* spec/features/quiz_spec.rb&lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
The purpose of this assignment is to enhance readability, DRYness, and maintainability of Expertiza code through refactoring and functional testing.&lt;br /&gt;
&lt;br /&gt;
== What is wrong with it ==&lt;br /&gt;
The valid_quiz method in questionnaires_controller needs to be refactored. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid.&lt;br /&gt;
&lt;br /&gt;
== What needs to be done ==&lt;br /&gt;
Student-generated quizzes is the feature that students use for writing quizzes for the Wikipedia contribution assignment. In this project, you need to do refactoring and create functional tests for this feature:&lt;br /&gt;
* Refactoring:&lt;br /&gt;
** Refactor the valid_quiz method in questionnaires_controller. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid. &lt;br /&gt;
* Testing:&lt;br /&gt;
** The instructor can set up an assignment which supports quizzing feature by&lt;br /&gt;
*** Checking the “has quiz” box&lt;br /&gt;
*** Setting the # of question for each set of quiz&lt;br /&gt;
*** Setting in which deadline can student reviewers take the quizzes&lt;br /&gt;
** Student authors can create quizzes and edit them:&lt;br /&gt;
*** They can create quizzes on the “Your work” page&lt;br /&gt;
*** They can edit the quiz questions.&lt;br /&gt;
*** They can view the quiz questions.&lt;br /&gt;
*** If the quiz question has something missing, the system will flash an error message, either:&lt;br /&gt;
**** The name of quiz is missing.&lt;br /&gt;
**** The question text is missing for one or more questions.&lt;br /&gt;
**** The choices are missing for one or more questions.&lt;br /&gt;
**** The correct answer(s) have not been provided.&lt;br /&gt;
** Student reviewers can take the quizzes on the work they have reviewed/they need to review&lt;br /&gt;
*** They need to request the artifact to review first. If this artifact has a quiz associated, they can take the quiz in the round which quiz-taking is allowed.&lt;br /&gt;
*** They can click “take quiz” then request quizzes to take.&lt;br /&gt;
*** They can fill in their choices on the quizzes.&lt;br /&gt;
*** After taking the quizzes, and submitting, they will see their grade on the “Take quizzes” page&lt;br /&gt;
*** On the “take quizzes” page, they can see their question-by-question scores for finished quizzes by clicking “view”&lt;br /&gt;
** Instructor can view the quiz questions and quiz scores on the tree display by clicking “view quiz questions” icon.&lt;br /&gt;
&lt;br /&gt;
= Scope =&lt;br /&gt;
This project can be divided into major work items:&lt;br /&gt;
#thing 1&lt;br /&gt;
#thing 2&lt;br /&gt;
#thing 3&lt;br /&gt;
#thing 4&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
implementation details&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
design&lt;br /&gt;
&lt;br /&gt;
= Use Cases =&lt;br /&gt;
use cases&lt;br /&gt;
&lt;br /&gt;
= Accomplishments =&lt;br /&gt;
&lt;br /&gt;
Video demo of our work can be found at https://www.youtube.com/&amp;lt;br&amp;gt;&lt;br /&gt;
GitHub repository containing the refactoring changes can be found at https://github.com/&amp;lt;br&amp;gt;&lt;br /&gt;
Link to the pull request to Expertiza is https://github.com/expertiza/expertiza/pull/&lt;br /&gt;
&lt;br /&gt;
= Future Work =&lt;br /&gt;
things to do in the future&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101437</id>
		<title>User:Mxu</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Mxu&amp;diff=101437"/>
		<updated>2016-03-28T21:57:52Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Introduction to Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===CSC/ECE 517 Spring 2016 E1621: Refactor and test the quizzing feature===&lt;br /&gt;
&lt;br /&gt;
= Introduction to Expertiza =&lt;br /&gt;
Expertiza&amp;lt;ref&amp;gt;https://github.com/expertiza/expertiza&amp;lt;/ref&amp;gt; is a project developed using Ruby on Rails&amp;lt;ref&amp;gt;http://guides.rubyonrails.org/getting_started.html&amp;lt;/ref&amp;gt;. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an [https://en.wikipedia.org/wiki/Open_source open source] application and the code can be cloned from [https://github.com/expertiza/expertiza GitHub]. This application provides an efficient way to manage assignments, grades and reviews.&lt;br /&gt;
&lt;br /&gt;
= Problem Statement =&lt;br /&gt;
&lt;br /&gt;
== Classes involved ==&lt;br /&gt;
*'''questionnaires_controller.rb''' &lt;br /&gt;
our own files in /specs/ folder. &lt;br /&gt;
&lt;br /&gt;
== What it does ==&lt;br /&gt;
It does stuff&lt;br /&gt;
&lt;br /&gt;
== What is wrong with it ==&lt;br /&gt;
The valid_quiz method in questionnaires_controller needs to be refactored. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid.&lt;br /&gt;
&lt;br /&gt;
== What needs to be done ==&lt;br /&gt;
Student-generated quizzes is the feature that students use for writing quizzes for the Wikipedia contribution assignment. In this project, you need to do refactoring and create functional tests for this feature:&lt;br /&gt;
*Refactoring:&lt;br /&gt;
**Refactor the valid_quiz method in questionnaires_controller. This method should not check the questions one by one, instead, it should create the quiz_question objects and quiz_choice objects, then call “quiz_question.valid?” to check whether the question is valid. &lt;br /&gt;
*Testing:&lt;br /&gt;
**The instructor can set up an assignment which supports quizzing feature by&lt;br /&gt;
***Checking the “has quiz” box&lt;br /&gt;
***Setting the # of question for each set of quiz&lt;br /&gt;
***Setting in which deadline can student reviewers take the quizzes&lt;br /&gt;
**Student authors can create quizzes and edit them:&lt;br /&gt;
***They can create quizzes on the “Your work” page&lt;br /&gt;
***They can edit the quiz questions.&lt;br /&gt;
***They can view the quiz questions.&lt;br /&gt;
***If the quiz question has something missing, the system will flash an error message, either:&lt;br /&gt;
****The name of quiz is missing.&lt;br /&gt;
****The question text is missing for one or more questions.&lt;br /&gt;
****The choices are missing for one or more questions.&lt;br /&gt;
****The correct answer(s) have not been provided.&lt;br /&gt;
**Student reviewers can take the quizzes on the work they have reviewed/they need to review&lt;br /&gt;
***They need to request the artifact to review first. If this artifact has a quiz associated, they can take the quiz in the round which quiz-taking is allowed.&lt;br /&gt;
***They can click “take quiz” then request quizzes to take.&lt;br /&gt;
***They can fill in their choices on the quizzes.&lt;br /&gt;
***After taking the quizzes, and submitting, they will see their grade on the “Take quizzes” page&lt;br /&gt;
***On the “take quizzes” page, they can see their question-by-question scores for finished quizzes by clicking “view”&lt;br /&gt;
**Instructor can view the quiz questions and quiz scores on the tree display by clicking “view quiz questions” icon.&lt;br /&gt;
&lt;br /&gt;
= Scope =&lt;br /&gt;
This project can be divided into major work items:&lt;br /&gt;
#thing 1&lt;br /&gt;
#thing 2&lt;br /&gt;
#thing 3&lt;br /&gt;
#thing 4&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
implementation details&lt;br /&gt;
&lt;br /&gt;
= Design =&lt;br /&gt;
design&lt;br /&gt;
&lt;br /&gt;
= Use Cases =&lt;br /&gt;
use cases&lt;br /&gt;
&lt;br /&gt;
= Accomplishments =&lt;br /&gt;
&lt;br /&gt;
Video demo of our work can be found at https://www.youtube.com/&amp;lt;br&amp;gt;&lt;br /&gt;
GitHub repository containing the refactoring changes can be found at https://github.com/&amp;lt;br&amp;gt;&lt;br /&gt;
Link to the pull request to Expertiza is https://github.com/expertiza/expertiza/pull/&lt;br /&gt;
&lt;br /&gt;
= Future Work =&lt;br /&gt;
things to do in the future&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100975</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100975"/>
		<updated>2016-03-21T12:20:44Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Test Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside by running in a  browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in calibration on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
* rspec-rails&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium-webdriver&lt;br /&gt;
* factory_girl_rails&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
====factory girl====&lt;br /&gt;
Factory Girl is a factory gem meant for use in testing. It allows for easy and highly configurable on-the-fly model creation that allows tests to request a new instance of a model template and optionally override any of the defaults.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
The following scenarios were considered when writing tests for the calibration use case:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor creates a calibrated assignment&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to add a new assignment&lt;br /&gt;
:While creating the assignment, the instructor selects to turn calibration on&lt;br /&gt;
:After creating the assignment the instructor sees a calibration tab on the assignment page&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor edits the calibration configuration&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to edit an existing assignment&lt;br /&gt;
:The instructor clicks on the calibration tab and sees it is populated with submitted artifacts&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An expert submits a review for calibration&lt;br /&gt;
:An expert has been added to an assignment to provide the expert review&lt;br /&gt;
:The expert authenticates to Expertiza and begins the expert review&lt;br /&gt;
:The expert finishes and submits the review&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Student Calibration&lt;br /&gt;
:A student has submitted a response for the assignment and it is currently in the review phase&lt;br /&gt;
:The student authenticates to Expertiza and chooses to view calibration for the assignment&lt;br /&gt;
:The student sees their own answers compared to the expert review.&lt;br /&gt;
:Answers that match are marked green, and answers that differ are marked red.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Instructor Calibration&lt;br /&gt;
:It is currently the review phase for an assignment&lt;br /&gt;
:An instructor authenticates to Expertiza and chooses to view calibration&lt;br /&gt;
:The instructor can see the percentages relating to student responses for the assignment&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the tests exists in two locations&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/factories/factories.rb Factory]&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/features/calibration_spec.rb CalibrationSpec]&lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
Our specs follow the standard RSpec describe/it syntax. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
describe 'Some Feature' do&lt;br /&gt;
:before :each do&lt;br /&gt;
&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should do x' do&lt;br /&gt;
::expect(true).to be(true)&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should not do y' do&lt;br /&gt;
::expect(true).to be(false)&lt;br /&gt;
:end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone https://github.com/EricHorton/expertiza&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create and then prepare the test database&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:test:prepare&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/calibration_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:calibration-tests.png|Calibration Tests]]&lt;br /&gt;
 &lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* All test cases are green, which means there are no currently failing tests.&lt;br /&gt;
* Test cases are run through the Selenium driver on Firefox for javascript support. Because they are full acceptance tests they are slower than regular unit tests, but still beat evaluating the feature by hand.&lt;br /&gt;
* Tests are independent and repeatable. Database changes are made within a transaction that is rolled back after tests complete.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/EricHorton/expertiza GitHub Fork]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calibration-tests.png&amp;diff=100974</id>
		<title>File:Calibration-tests.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calibration-tests.png&amp;diff=100974"/>
		<updated>2016-03-21T12:20:34Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: uploaded a new version of &amp;amp;quot;File:Calibration-tests.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calibration-tests.png&amp;diff=100973</id>
		<title>File:Calibration-tests.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calibration-tests.png&amp;diff=100973"/>
		<updated>2016-03-21T12:17:44Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100972</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100972"/>
		<updated>2016-03-21T11:38:50Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Flow of the calibration function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside by running in a  browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in calibration on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
* rspec-rails&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium-webdriver&lt;br /&gt;
* factory_girl_rails&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
====factory girl====&lt;br /&gt;
Factory Girl is a factory gem meant for use in testing. It allows for easy and highly configurable on-the-fly model creation that allows tests to request a new instance of a model template and optionally override any of the defaults.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
The following scenarios were considered when writing tests for the calibration use case:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor creates a calibrated assignment&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to add a new assignment&lt;br /&gt;
:While creating the assignment, the instructor selects to turn calibration on&lt;br /&gt;
:After creating the assignment the instructor sees a calibration tab on the assignment page&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor edits the calibration configuration&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to edit an existing assignment&lt;br /&gt;
:The instructor clicks on the calibration tab and sees it is populated with submitted artifacts&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An expert submits a review for calibration&lt;br /&gt;
:An expert has been added to an assignment to provide the expert review&lt;br /&gt;
:The expert authenticates to Expertiza and begins the expert review&lt;br /&gt;
:The expert finishes and submits the review&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Student Calibration&lt;br /&gt;
:A student has submitted a response for the assignment and it is currently in the review phase&lt;br /&gt;
:The student authenticates to Expertiza and chooses to view calibration for the assignment&lt;br /&gt;
:The student sees their own answers compared to the expert review.&lt;br /&gt;
:Answers that match are marked green, and answers that differ are marked red.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Instructor Calibration&lt;br /&gt;
:It is currently the review phase for an assignment&lt;br /&gt;
:An instructor authenticates to Expertiza and chooses to view calibration&lt;br /&gt;
:The instructor can see the percentages relating to student responses for the assignment&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the tests exists in two locations&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/factories/factories.rb Factory]&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/features/calibration_spec.rb CalibrationSpec]&lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
Our specs follow the standard RSpec describe/it syntax. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
describe 'Some Feature' do&lt;br /&gt;
:before :each do&lt;br /&gt;
&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should do x' do&lt;br /&gt;
::expect(true).to be(true)&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should not do y' do&lt;br /&gt;
::expect(true).to be(false)&lt;br /&gt;
:end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone https://github.com/EricHorton/expertiza&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create and then prepare the test database&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:test:prepare&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/calibration_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* All test cases are green, which means there are no currently failing tests.&lt;br /&gt;
* Test cases are run through the Selenium driver on Firefox for javascript support. Because they are full acceptance tests they are slower than regular unit tests, but still beat evaluating the feature by hand.&lt;br /&gt;
* Tests are independent and repeatable. Database changes are made within a transaction that is rolled back after tests complete.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/EricHorton/expertiza GitHub Fork]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100971</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100971"/>
		<updated>2016-03-21T11:38:16Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Motivation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside by running in a  browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
* rspec-rails&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium-webdriver&lt;br /&gt;
* factory_girl_rails&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
====factory girl====&lt;br /&gt;
Factory Girl is a factory gem meant for use in testing. It allows for easy and highly configurable on-the-fly model creation that allows tests to request a new instance of a model template and optionally override any of the defaults.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
The following scenarios were considered when writing tests for the calibration use case:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor creates a calibrated assignment&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to add a new assignment&lt;br /&gt;
:While creating the assignment, the instructor selects to turn calibration on&lt;br /&gt;
:After creating the assignment the instructor sees a calibration tab on the assignment page&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor edits the calibration configuration&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to edit an existing assignment&lt;br /&gt;
:The instructor clicks on the calibration tab and sees it is populated with submitted artifacts&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An expert submits a review for calibration&lt;br /&gt;
:An expert has been added to an assignment to provide the expert review&lt;br /&gt;
:The expert authenticates to Expertiza and begins the expert review&lt;br /&gt;
:The expert finishes and submits the review&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Student Calibration&lt;br /&gt;
:A student has submitted a response for the assignment and it is currently in the review phase&lt;br /&gt;
:The student authenticates to Expertiza and chooses to view calibration for the assignment&lt;br /&gt;
:The student sees their own answers compared to the expert review.&lt;br /&gt;
:Answers that match are marked green, and answers that differ are marked red.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Instructor Calibration&lt;br /&gt;
:It is currently the review phase for an assignment&lt;br /&gt;
:An instructor authenticates to Expertiza and chooses to view calibration&lt;br /&gt;
:The instructor can see the percentages relating to student responses for the assignment&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the tests exists in two locations&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/factories/factories.rb Factory]&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/features/calibration_spec.rb CalibrationSpec]&lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
Our specs follow the standard RSpec describe/it syntax. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
describe 'Some Feature' do&lt;br /&gt;
:before :each do&lt;br /&gt;
&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should do x' do&lt;br /&gt;
::expect(true).to be(true)&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should not do y' do&lt;br /&gt;
::expect(true).to be(false)&lt;br /&gt;
:end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone https://github.com/EricHorton/expertiza&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create and then prepare the test database&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:test:prepare&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/calibration_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* All test cases are green, which means there are no currently failing tests.&lt;br /&gt;
* Test cases are run through the Selenium driver on Firefox for javascript support. Because they are full acceptance tests they are slower than regular unit tests, but still beat evaluating the feature by hand.&lt;br /&gt;
* Tests are independent and repeatable. Database changes are made within a transaction that is rolled back after tests complete.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/EricHorton/expertiza GitHub Fork]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100970</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100970"/>
		<updated>2016-03-19T02:22:26Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: Pointing project resources to github fork.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside either by running in a  headless browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
* rspec-rails&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium-webdriver&lt;br /&gt;
* factory_girl_rails&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
====factory girl====&lt;br /&gt;
Factory Girl is a factory gem meant for use in testing. It allows for easy and highly configurable on-the-fly model creation that allows tests to request a new instance of a model template and optionally override any of the defaults.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
The following scenarios were considered when writing tests for the calibration use case:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor creates a calibrated assignment&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to add a new assignment&lt;br /&gt;
:While creating the assignment, the instructor selects to turn calibration on&lt;br /&gt;
:After creating the assignment the instructor sees a calibration tab on the assignment page&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor edits the calibration configuration&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to edit an existing assignment&lt;br /&gt;
:The instructor clicks on the calibration tab and sees it is populated with submitted artifacts&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An expert submits a review for calibration&lt;br /&gt;
:An expert has been added to an assignment to provide the expert review&lt;br /&gt;
:The expert authenticates to Expertiza and begins the expert review&lt;br /&gt;
:The expert finishes and submits the review&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Student Calibration&lt;br /&gt;
:A student has submitted a response for the assignment and it is currently in the review phase&lt;br /&gt;
:The student authenticates to Expertiza and chooses to view calibration for the assignment&lt;br /&gt;
:The student sees their own answers compared to the expert review.&lt;br /&gt;
:Answers that match are marked green, and answers that differ are marked red.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Instructor Calibration&lt;br /&gt;
:It is currently the review phase for an assignment&lt;br /&gt;
:An instructor authenticates to Expertiza and chooses to view calibration&lt;br /&gt;
:The instructor can see the percentages relating to student responses for the assignment&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the tests exists in two locations&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/factories/factories.rb Factory]&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/features/calibration_spec.rb CalibrationSpec]&lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
Our specs follow the standard RSpec describe/it syntax. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
describe 'Some Feature' do&lt;br /&gt;
:before :each do&lt;br /&gt;
&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should do x' do&lt;br /&gt;
::expect(true).to be(true)&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should not do y' do&lt;br /&gt;
::expect(true).to be(false)&lt;br /&gt;
:end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone https://github.com/EricHorton/expertiza&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create and then prepare the test database&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:test:prepare&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/calibration_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* All test cases are green, which means there are no currently failing tests.&lt;br /&gt;
* Test cases are run through the Selenium driver on Firefox for javascript support. Because they are full acceptance tests they are slower than regular unit tests, but still beat evaluating the feature by hand.&lt;br /&gt;
* Tests are independent and repeatable. Database changes are made within a transaction that is rolled back after tests complete.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/EricHorton/expertiza GitHub Fork]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100969</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100969"/>
		<updated>2016-03-19T02:19:41Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: Filling in test analysis for our tests.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside either by running in a  headless browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
* rspec-rails&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium-webdriver&lt;br /&gt;
* factory_girl_rails&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
====factory girl====&lt;br /&gt;
Factory Girl is a factory gem meant for use in testing. It allows for easy and highly configurable on-the-fly model creation that allows tests to request a new instance of a model template and optionally override any of the defaults.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
The following scenarios were considered when writing tests for the calibration use case:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor creates a calibrated assignment&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to add a new assignment&lt;br /&gt;
:While creating the assignment, the instructor selects to turn calibration on&lt;br /&gt;
:After creating the assignment the instructor sees a calibration tab on the assignment page&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor edits the calibration configuration&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to edit an existing assignment&lt;br /&gt;
:The instructor clicks on the calibration tab and sees it is populated with submitted artifacts&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An expert submits a review for calibration&lt;br /&gt;
:An expert has been added to an assignment to provide the expert review&lt;br /&gt;
:The expert authenticates to Expertiza and begins the expert review&lt;br /&gt;
:The expert finishes and submits the review&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Student Calibration&lt;br /&gt;
:A student has submitted a response for the assignment and it is currently in the review phase&lt;br /&gt;
:The student authenticates to Expertiza and chooses to view calibration for the assignment&lt;br /&gt;
:The student sees their own answers compared to the expert review.&lt;br /&gt;
:Answers that match are marked green, and answers that differ are marked red.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Instructor Calibration&lt;br /&gt;
:It is currently the review phase for an assignment&lt;br /&gt;
:An instructor authenticates to Expertiza and chooses to view calibration&lt;br /&gt;
:The instructor can see the percentages relating to student responses for the assignment&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the tests exists in two locations&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/factories/factories.rb Factory]&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/features/calibration_spec.rb CalibrationSpec]&lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
Our specs follow the standard RSpec describe/it syntax. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
describe 'Some Feature' do&lt;br /&gt;
:before :each do&lt;br /&gt;
&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should do x' do&lt;br /&gt;
::expect(true).to be(true)&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should not do y' do&lt;br /&gt;
::expect(true).to be(false)&lt;br /&gt;
:end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone https://github.com/EricHorton/expertiza&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create and then prepare the test database&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:test:prepare&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/calibration_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* All test cases are green, which means there are no currently failing tests.&lt;br /&gt;
* Test cases are run through the Selenium driver on Firefox for javascript support. Because they are full acceptance tests they are slower than regular unit tests, but still beat evaluating the feature by hand.&lt;br /&gt;
* Tests are independent and repeatable. Database changes are made within a transaction that is rolled back after tests complete.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/shrenujgandhi/expertiza GitHub Link]&lt;br /&gt;
# [https://youtu.be/_58l0VPy04M YouTube Demo]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100968</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100968"/>
		<updated>2016-03-19T02:09:33Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: Editing for calibration tests.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside either by running in a  headless browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
* rspec-rails&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium-webdriver&lt;br /&gt;
* factory_girl_rails&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
====factory girl====&lt;br /&gt;
Factory Girl is a factory gem meant for use in testing. It allows for easy and highly configurable on-the-fly model creation that allows tests to request a new instance of a model template and optionally override any of the defaults.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
The following scenarios were considered when writing tests for the calibration use case:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor creates a calibrated assignment&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to add a new assignment&lt;br /&gt;
:While creating the assignment, the instructor selects to turn calibration on&lt;br /&gt;
:After creating the assignment the instructor sees a calibration tab on the assignment page&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor edits the calibration configuration&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to edit an existing assignment&lt;br /&gt;
:The instructor clicks on the calibration tab and sees it is populated with submitted artifacts&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An expert submits a review for calibration&lt;br /&gt;
:An expert has been added to an assignment to provide the expert review&lt;br /&gt;
:The expert authenticates to Expertiza and begins the expert review&lt;br /&gt;
:The expert finishes and submits the review&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Student Calibration&lt;br /&gt;
:A student has submitted a response for the assignment and it is currently in the review phase&lt;br /&gt;
:The student authenticates to Expertiza and chooses to view calibration for the assignment&lt;br /&gt;
:The student sees their own answers compared to the expert review.&lt;br /&gt;
:Answers that match are marked green, and answers that differ are marked red.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Instructor Calibration&lt;br /&gt;
:It is currently the review phase for an assignment&lt;br /&gt;
:An instructor authenticates to Expertiza and chooses to view calibration&lt;br /&gt;
:The instructor can see the percentages relating to student responses for the assignment&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the tests exists in two locations&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/factories/factories.rb Factory]&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/features/calibration_spec.rb CalibrationSpec]&lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
Our specs follow the standard RSpec describe/it syntax. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
describe 'Some Feature' do&lt;br /&gt;
:before :each do&lt;br /&gt;
&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should do x' do&lt;br /&gt;
::expect(true).to be(true)&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should not do y' do&lt;br /&gt;
::expect(true).to be(false)&lt;br /&gt;
:end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone https://github.com/EricHorton/expertiza&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create and then prepare the test database&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:test:prepare&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/calibration_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* ''7 examples, 0 failures'' imply that there are 7 test scenarios and none of them failed.&lt;br /&gt;
* The tests take around 35 seconds to run, which implies that they are fast.&lt;br /&gt;
* They are also repeatable as the assignments that are created in the ''before all'' block are also deleted in the ''after all'' block.&lt;br /&gt;
* They are also self-verifying as all the results are in green, which mean that all the cases passed.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/shrenujgandhi/expertiza GitHub Link]&lt;br /&gt;
# [https://youtu.be/_58l0VPy04M YouTube Demo]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100967</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100967"/>
		<updated>2016-03-19T02:06:33Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: Simplifying code structure description. Linking to project files.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside either by running in a  headless browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
* rspec-rails&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium-webdriver&lt;br /&gt;
* factory_girl_rails&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
====factory girl====&lt;br /&gt;
Factory Girl is a factory gem meant for use in testing. It allows for easy and highly configurable on-the-fly model creation that allows tests to request a new instance of a model template and optionally override any of the defaults.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
The following scenarios were considered when writing tests for the calibration use case:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor creates a calibrated assignment&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to add a new assignment&lt;br /&gt;
:While creating the assignment, the instructor selects to turn calibration on&lt;br /&gt;
:After creating the assignment the instructor sees a calibration tab on the assignment page&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor edits the calibration configuration&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to edit an existing assignment&lt;br /&gt;
:The instructor clicks on the calibration tab and sees it is populated with submitted artifacts&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An expert submits a review for calibration&lt;br /&gt;
:An expert has been added to an assignment to provide the expert review&lt;br /&gt;
:The expert authenticates to Expertiza and begins the expert review&lt;br /&gt;
:The expert finishes and submits the review&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Student Calibration&lt;br /&gt;
:A student has submitted a response for the assignment and it is currently in the review phase&lt;br /&gt;
:The student authenticates to Expertiza and chooses to view calibration for the assignment&lt;br /&gt;
:The student sees their own answers compared to the expert review.&lt;br /&gt;
:Answers that match are marked green, and answers that differ are marked red.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Instructor Calibration&lt;br /&gt;
:It is currently the review phase for an assignment&lt;br /&gt;
:An instructor authenticates to Expertiza and chooses to view calibration&lt;br /&gt;
:The instructor can see the percentages relating to student responses for the assignment&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the tests exists in two locations&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/factories/factories.rb Factory]&lt;br /&gt;
* [https://github.com/EricHorton/expertiza/blob/master/spec/features/calibration_spec.rb CalibrationSpec]&lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
Our specs follow the standard RSpec describe/it syntax. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
describe 'Some Feature' do&lt;br /&gt;
:before :each do&lt;br /&gt;
&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should do x' do&lt;br /&gt;
::expect(true).to be(true)&lt;br /&gt;
:end&lt;br /&gt;
&lt;br /&gt;
:it 'should not do y' do&lt;br /&gt;
::expect(true).to be(false)&lt;br /&gt;
:end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir review&lt;br /&gt;
$ cd review&lt;br /&gt;
$ git clone https://github.com/shrenujgandhi/expertiza.git&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't have a database with student and instructor entries then download the dump from https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uESEkzSWpJRnhGbmc/view. Extract its contents.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:create:all&lt;br /&gt;
$ cd Downloads/&lt;br /&gt;
$ mysql -u root -p expertiza_development &amp;lt; expertiza_scrubbed_2015_08_14.sql&lt;br /&gt;
password:&lt;br /&gt;
&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:migrate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/student_submission_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* ''7 examples, 0 failures'' imply that there are 7 test scenarios and none of them failed.&lt;br /&gt;
* The tests take around 35 seconds to run, which implies that they are fast.&lt;br /&gt;
* They are also repeatable as the assignments that are created in the ''before all'' block are also deleted in the ''after all'' block.&lt;br /&gt;
* They are also self-verifying as all the results are in green, which mean that all the cases passed.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/shrenujgandhi/expertiza GitHub Link]&lt;br /&gt;
# [https://youtu.be/_58l0VPy04M YouTube Demo]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100966</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100966"/>
		<updated>2016-03-19T01:55:58Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Test Scenarios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside either by running in a  headless browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
* rspec-rails&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium-webdriver&lt;br /&gt;
* factory_girl_rails&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
====factory girl====&lt;br /&gt;
Factory Girl is a factory gem meant for use in testing. It allows for easy and highly configurable on-the-fly model creation that allows tests to request a new instance of a model template and optionally override any of the defaults.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
The following scenarios were considered when writing tests for the calibration use case:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor creates a calibrated assignment&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to add a new assignment&lt;br /&gt;
:While creating the assignment, the instructor selects to turn calibration on&lt;br /&gt;
:After creating the assignment the instructor sees a calibration tab on the assignment page&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An instructor edits the calibration configuration&lt;br /&gt;
:An instructor authenticates to expertiza&lt;br /&gt;
:They select to edit an existing assignment&lt;br /&gt;
:The instructor clicks on the calibration tab and sees it is populated with submitted artifacts&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
An expert submits a review for calibration&lt;br /&gt;
:An expert has been added to an assignment to provide the expert review&lt;br /&gt;
:The expert authenticates to Expertiza and begins the expert review&lt;br /&gt;
:The expert finishes and submits the review&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Student Calibration&lt;br /&gt;
:A student has submitted a response for the assignment and it is currently in the review phase&lt;br /&gt;
:The student authenticates to Expertiza and chooses to view calibration for the assignment&lt;br /&gt;
:The student sees their own answers compared to the expert review.&lt;br /&gt;
:Answers that match are marked green, and answers that differ are marked red.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Instructor Calibration&lt;br /&gt;
:It is currently the review phase for an assignment&lt;br /&gt;
:An instructor authenticates to Expertiza and chooses to view calibration&lt;br /&gt;
:The instructor can see the percentages relating to student responses for the assignment&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the feature test consist in two files:&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/assignment_setup.rb assignment_setup.rb] which contains method for creating assignments using controller calls.&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/features/student_submission_spec.rb student_assignment_submission.rb] which contain calls to assignment_setup, scenarios to test assignment submission and commands to delete the created assignments. &lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;require&amp;lt;/b&amp;gt; files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RSpec.feature 'assignment submission when student' do&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::create assignments for submission&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:each) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::capybara steps to login&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;after(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::delete assignments created&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;scenario 'submits only valid link to ongoing assignment' do&amp;lt;/b&amp;gt;&lt;br /&gt;
::mock steps using capybara&lt;br /&gt;
::make assertions&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Sample Scenario====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
require 'spec_helper'&lt;br /&gt;
require 'assignment_setup'&lt;br /&gt;
&lt;br /&gt;
RSpec.feature 'assignment submission when student' do&lt;br /&gt;
&lt;br /&gt;
  active_assignment=&amp;quot;FeatureTest&amp;quot;&lt;br /&gt;
  expired_assignment=&amp;quot;LibraryRailsApp&amp;quot;&lt;br /&gt;
  d = Date.parse(Time.now.to_s)&lt;br /&gt;
  due_date1=(d &amp;gt;&amp;gt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
  due_date2=(d &amp;lt;&amp;lt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  # Before all block runs once before all the scenarios are tested&lt;br /&gt;
  before(:all) do&lt;br /&gt;
    # Create active/ongoing assignment&lt;br /&gt;
    create_assignment(active_assignment, due_date1)&lt;br /&gt;
&lt;br /&gt;
    # Create expired/finished assignment&lt;br /&gt;
    create_assignment(expired_assignment, due_date2)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Before each block runs before every scenario&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    # Login as a student before each scenario&lt;br /&gt;
    visit root_path&lt;br /&gt;
    fill_in 'User Name', :with =&amp;gt; 'student13'&lt;br /&gt;
    fill_in 'Password', :with =&amp;gt; 'password'&lt;br /&gt;
    click_on 'SIGN IN'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # After all block runs after all the scenarios are tested&lt;br /&gt;
  after(:all)do&lt;br /&gt;
    # Delete active/ongoing assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(active_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
&lt;br /&gt;
    # Delete expired/finished assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(expired_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Scenario to check whether student is able to submit valid link to an ongoing assignment&lt;br /&gt;
  scenario 'submits only valid link to ongoing assignment' do&lt;br /&gt;
    click_on active_assignment&lt;br /&gt;
    click_on 'Your work'&lt;br /&gt;
    fill_in 'submission', :with =&amp;gt; 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
    click_on 'Upload link'&lt;br /&gt;
    expect(page).to have_content 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir review&lt;br /&gt;
$ cd review&lt;br /&gt;
$ git clone https://github.com/shrenujgandhi/expertiza.git&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't have a database with student and instructor entries then download the dump from https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uESEkzSWpJRnhGbmc/view. Extract its contents.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:create:all&lt;br /&gt;
$ cd Downloads/&lt;br /&gt;
$ mysql -u root -p expertiza_development &amp;lt; expertiza_scrubbed_2015_08_14.sql&lt;br /&gt;
password:&lt;br /&gt;
&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:migrate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/student_submission_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* ''7 examples, 0 failures'' imply that there are 7 test scenarios and none of them failed.&lt;br /&gt;
* The tests take around 35 seconds to run, which implies that they are fast.&lt;br /&gt;
* They are also repeatable as the assignments that are created in the ''before all'' block are also deleted in the ''after all'' block.&lt;br /&gt;
* They are also self-verifying as all the results are in green, which mean that all the cases passed.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/shrenujgandhi/expertiza GitHub Link]&lt;br /&gt;
# [https://youtu.be/_58l0VPy04M YouTube Demo]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100965</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100965"/>
		<updated>2016-03-19T01:33:40Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: /* Gems involved */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside either by running in a  headless browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
* rspec-rails&lt;br /&gt;
* capybara&lt;br /&gt;
* selenium-webdriver&lt;br /&gt;
* factory_girl_rails&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
====factory girl====&lt;br /&gt;
Factory Girl is a factory gem meant for use in testing. It allows for easy and highly configurable on-the-fly model creation that allows tests to request a new instance of a model template and optionally override any of the defaults.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
Based on the steps involved in manual submission of the assignment, the following test scenarios are considered:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to login&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have text content &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to submit valid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit invalid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;http://&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should display flash message with text &amp;lt;b&amp;gt;URI is not valid&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload valid link and a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit valid link to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Page should not have &amp;lt;b&amp;gt;Upload link&amp;lt;/b&amp;gt; button&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able upload file to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the feature test consist in two files:&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/assignment_setup.rb assignment_setup.rb] which contains method for creating assignments using controller calls.&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/features/student_submission_spec.rb student_assignment_submission.rb] which contain calls to assignment_setup, scenarios to test assignment submission and commands to delete the created assignments. &lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;require&amp;lt;/b&amp;gt; files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RSpec.feature 'assignment submission when student' do&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::create assignments for submission&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:each) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::capybara steps to login&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;after(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::delete assignments created&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;scenario 'submits only valid link to ongoing assignment' do&amp;lt;/b&amp;gt;&lt;br /&gt;
::mock steps using capybara&lt;br /&gt;
::make assertions&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Sample Scenario====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
require 'spec_helper'&lt;br /&gt;
require 'assignment_setup'&lt;br /&gt;
&lt;br /&gt;
RSpec.feature 'assignment submission when student' do&lt;br /&gt;
&lt;br /&gt;
  active_assignment=&amp;quot;FeatureTest&amp;quot;&lt;br /&gt;
  expired_assignment=&amp;quot;LibraryRailsApp&amp;quot;&lt;br /&gt;
  d = Date.parse(Time.now.to_s)&lt;br /&gt;
  due_date1=(d &amp;gt;&amp;gt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
  due_date2=(d &amp;lt;&amp;lt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  # Before all block runs once before all the scenarios are tested&lt;br /&gt;
  before(:all) do&lt;br /&gt;
    # Create active/ongoing assignment&lt;br /&gt;
    create_assignment(active_assignment, due_date1)&lt;br /&gt;
&lt;br /&gt;
    # Create expired/finished assignment&lt;br /&gt;
    create_assignment(expired_assignment, due_date2)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Before each block runs before every scenario&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    # Login as a student before each scenario&lt;br /&gt;
    visit root_path&lt;br /&gt;
    fill_in 'User Name', :with =&amp;gt; 'student13'&lt;br /&gt;
    fill_in 'Password', :with =&amp;gt; 'password'&lt;br /&gt;
    click_on 'SIGN IN'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # After all block runs after all the scenarios are tested&lt;br /&gt;
  after(:all)do&lt;br /&gt;
    # Delete active/ongoing assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(active_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
&lt;br /&gt;
    # Delete expired/finished assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(expired_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Scenario to check whether student is able to submit valid link to an ongoing assignment&lt;br /&gt;
  scenario 'submits only valid link to ongoing assignment' do&lt;br /&gt;
    click_on active_assignment&lt;br /&gt;
    click_on 'Your work'&lt;br /&gt;
    fill_in 'submission', :with =&amp;gt; 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
    click_on 'Upload link'&lt;br /&gt;
    expect(page).to have_content 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir review&lt;br /&gt;
$ cd review&lt;br /&gt;
$ git clone https://github.com/shrenujgandhi/expertiza.git&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't have a database with student and instructor entries then download the dump from https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uESEkzSWpJRnhGbmc/view. Extract its contents.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:create:all&lt;br /&gt;
$ cd Downloads/&lt;br /&gt;
$ mysql -u root -p expertiza_development &amp;lt; expertiza_scrubbed_2015_08_14.sql&lt;br /&gt;
password:&lt;br /&gt;
&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:migrate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/student_submission_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* ''7 examples, 0 failures'' imply that there are 7 test scenarios and none of them failed.&lt;br /&gt;
* The tests take around 35 seconds to run, which implies that they are fast.&lt;br /&gt;
* They are also repeatable as the assignments that are created in the ''before all'' block are also deleted in the ''after all'' block.&lt;br /&gt;
* They are also self-verifying as all the results are in green, which mean that all the cases passed.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/shrenujgandhi/expertiza GitHub Link]&lt;br /&gt;
# [https://youtu.be/_58l0VPy04M YouTube Demo]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100964</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100964"/>
		<updated>2016-03-19T01:22:38Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: Adding link to calibration documentation and mentioning assignment submitters.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside either by running in a  headless browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
A more detailed description of the calibration may be found [https://docs.google.com/document/d/1LcicJCUY0GHN1qzwRQPL9A1Nv89sVtNtxlADOzVQeBk/edit#heading=h.g4vilf87e3f0 here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase.&lt;br /&gt;
# Add a submitter to the assignment. This submitter will add documents to be reviewed. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on “Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
The gems used in feature testing are '''rspec-rails''', '''capybara''' and '''selenium'''.&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
Based on the steps involved in manual submission of the assignment, the following test scenarios are considered:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to login&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have text content &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to submit valid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit invalid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;http://&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should display flash message with text &amp;lt;b&amp;gt;URI is not valid&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload valid link and a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit valid link to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Page should not have &amp;lt;b&amp;gt;Upload link&amp;lt;/b&amp;gt; button&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able upload file to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the feature test consist in two files:&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/assignment_setup.rb assignment_setup.rb] which contains method for creating assignments using controller calls.&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/features/student_submission_spec.rb student_assignment_submission.rb] which contain calls to assignment_setup, scenarios to test assignment submission and commands to delete the created assignments. &lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;require&amp;lt;/b&amp;gt; files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RSpec.feature 'assignment submission when student' do&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::create assignments for submission&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:each) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::capybara steps to login&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;after(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::delete assignments created&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;scenario 'submits only valid link to ongoing assignment' do&amp;lt;/b&amp;gt;&lt;br /&gt;
::mock steps using capybara&lt;br /&gt;
::make assertions&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Sample Scenario====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
require 'spec_helper'&lt;br /&gt;
require 'assignment_setup'&lt;br /&gt;
&lt;br /&gt;
RSpec.feature 'assignment submission when student' do&lt;br /&gt;
&lt;br /&gt;
  active_assignment=&amp;quot;FeatureTest&amp;quot;&lt;br /&gt;
  expired_assignment=&amp;quot;LibraryRailsApp&amp;quot;&lt;br /&gt;
  d = Date.parse(Time.now.to_s)&lt;br /&gt;
  due_date1=(d &amp;gt;&amp;gt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
  due_date2=(d &amp;lt;&amp;lt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  # Before all block runs once before all the scenarios are tested&lt;br /&gt;
  before(:all) do&lt;br /&gt;
    # Create active/ongoing assignment&lt;br /&gt;
    create_assignment(active_assignment, due_date1)&lt;br /&gt;
&lt;br /&gt;
    # Create expired/finished assignment&lt;br /&gt;
    create_assignment(expired_assignment, due_date2)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Before each block runs before every scenario&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    # Login as a student before each scenario&lt;br /&gt;
    visit root_path&lt;br /&gt;
    fill_in 'User Name', :with =&amp;gt; 'student13'&lt;br /&gt;
    fill_in 'Password', :with =&amp;gt; 'password'&lt;br /&gt;
    click_on 'SIGN IN'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # After all block runs after all the scenarios are tested&lt;br /&gt;
  after(:all)do&lt;br /&gt;
    # Delete active/ongoing assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(active_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
&lt;br /&gt;
    # Delete expired/finished assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(expired_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Scenario to check whether student is able to submit valid link to an ongoing assignment&lt;br /&gt;
  scenario 'submits only valid link to ongoing assignment' do&lt;br /&gt;
    click_on active_assignment&lt;br /&gt;
    click_on 'Your work'&lt;br /&gt;
    fill_in 'submission', :with =&amp;gt; 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
    click_on 'Upload link'&lt;br /&gt;
    expect(page).to have_content 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir review&lt;br /&gt;
$ cd review&lt;br /&gt;
$ git clone https://github.com/shrenujgandhi/expertiza.git&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't have a database with student and instructor entries then download the dump from https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uESEkzSWpJRnhGbmc/view. Extract its contents.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:create:all&lt;br /&gt;
$ cd Downloads/&lt;br /&gt;
$ mysql -u root -p expertiza_development &amp;lt; expertiza_scrubbed_2015_08_14.sql&lt;br /&gt;
password:&lt;br /&gt;
&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:migrate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/student_submission_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* ''7 examples, 0 failures'' imply that there are 7 test scenarios and none of them failed.&lt;br /&gt;
* The tests take around 35 seconds to run, which implies that they are fast.&lt;br /&gt;
* They are also repeatable as the assignments that are created in the ''before all'' block are also deleted in the ''after all'' block.&lt;br /&gt;
* They are also self-verifying as all the results are in green, which mean that all the cases passed.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/shrenujgandhi/expertiza GitHub Link]&lt;br /&gt;
# [https://youtu.be/_58l0VPy04M YouTube Demo]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100963</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100963"/>
		<updated>2016-03-19T01:13:51Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: Rewriting motivation to discuss the need for automated acceptance testing.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
The moment a line of code is written it becomes legacy code in need of support. Test cases are used not only to ensure that code is operating properly, but also to ensure that it continues to do so after having been modified. An important aspect of this is acceptance testing to verify that the project meets customer requirements. Rather than performing these tests by hand, it is easier to combine an automated testing system like RSpec with a driver like Capybara which allows testing of an application's functionality from the outside either by running in a  headless browser.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on“Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
The gems used in feature testing are '''rspec-rails''', '''capybara''' and '''selenium'''.&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
Based on the steps involved in manual submission of the assignment, the following test scenarios are considered:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to login&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have text content &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to submit valid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit invalid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;http://&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should display flash message with text &amp;lt;b&amp;gt;URI is not valid&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload valid link and a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit valid link to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Page should not have &amp;lt;b&amp;gt;Upload link&amp;lt;/b&amp;gt; button&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able upload file to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the feature test consist in two files:&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/assignment_setup.rb assignment_setup.rb] which contains method for creating assignments using controller calls.&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/features/student_submission_spec.rb student_assignment_submission.rb] which contain calls to assignment_setup, scenarios to test assignment submission and commands to delete the created assignments. &lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;require&amp;lt;/b&amp;gt; files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RSpec.feature 'assignment submission when student' do&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::create assignments for submission&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:each) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::capybara steps to login&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;after(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::delete assignments created&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;scenario 'submits only valid link to ongoing assignment' do&amp;lt;/b&amp;gt;&lt;br /&gt;
::mock steps using capybara&lt;br /&gt;
::make assertions&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Sample Scenario====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
require 'spec_helper'&lt;br /&gt;
require 'assignment_setup'&lt;br /&gt;
&lt;br /&gt;
RSpec.feature 'assignment submission when student' do&lt;br /&gt;
&lt;br /&gt;
  active_assignment=&amp;quot;FeatureTest&amp;quot;&lt;br /&gt;
  expired_assignment=&amp;quot;LibraryRailsApp&amp;quot;&lt;br /&gt;
  d = Date.parse(Time.now.to_s)&lt;br /&gt;
  due_date1=(d &amp;gt;&amp;gt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
  due_date2=(d &amp;lt;&amp;lt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  # Before all block runs once before all the scenarios are tested&lt;br /&gt;
  before(:all) do&lt;br /&gt;
    # Create active/ongoing assignment&lt;br /&gt;
    create_assignment(active_assignment, due_date1)&lt;br /&gt;
&lt;br /&gt;
    # Create expired/finished assignment&lt;br /&gt;
    create_assignment(expired_assignment, due_date2)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Before each block runs before every scenario&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    # Login as a student before each scenario&lt;br /&gt;
    visit root_path&lt;br /&gt;
    fill_in 'User Name', :with =&amp;gt; 'student13'&lt;br /&gt;
    fill_in 'Password', :with =&amp;gt; 'password'&lt;br /&gt;
    click_on 'SIGN IN'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # After all block runs after all the scenarios are tested&lt;br /&gt;
  after(:all)do&lt;br /&gt;
    # Delete active/ongoing assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(active_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
&lt;br /&gt;
    # Delete expired/finished assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(expired_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Scenario to check whether student is able to submit valid link to an ongoing assignment&lt;br /&gt;
  scenario 'submits only valid link to ongoing assignment' do&lt;br /&gt;
    click_on active_assignment&lt;br /&gt;
    click_on 'Your work'&lt;br /&gt;
    fill_in 'submission', :with =&amp;gt; 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
    click_on 'Upload link'&lt;br /&gt;
    expect(page).to have_content 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir review&lt;br /&gt;
$ cd review&lt;br /&gt;
$ git clone https://github.com/shrenujgandhi/expertiza.git&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't have a database with student and instructor entries then download the dump from https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uESEkzSWpJRnhGbmc/view. Extract its contents.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:create:all&lt;br /&gt;
$ cd Downloads/&lt;br /&gt;
$ mysql -u root -p expertiza_development &amp;lt; expertiza_scrubbed_2015_08_14.sql&lt;br /&gt;
password:&lt;br /&gt;
&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:migrate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/student_submission_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* ''7 examples, 0 failures'' imply that there are 7 test scenarios and none of them failed.&lt;br /&gt;
* The tests take around 35 seconds to run, which implies that they are fast.&lt;br /&gt;
* They are also repeatable as the assignments that are created in the ''before all'' block are also deleted in the ''after all'' block.&lt;br /&gt;
* They are also self-verifying as all the results are in green, which mean that all the cases passed.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/shrenujgandhi/expertiza GitHub Link]&lt;br /&gt;
# [https://youtu.be/_58l0VPy04M YouTube Demo]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100962</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100962"/>
		<updated>2016-03-19T00:56:35Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: Expanding the problem statement.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
Expertiza has a feature called Calibration that can be turned on for an assignment. When this feature is enabled an expert, typically the instructor, can provide an expert review for the assignment artifacts. After students finish their own reviews they may compare their responses to the expert review. The instructor may also view calibration results to view the scores for the entire class.&lt;br /&gt;
&lt;br /&gt;
While this is a preexisting feature within Expertiza, there currently exist no tests for it. The goal of this project is to fully test the entire flow of the calibration feature using the '''RSpec''' and '''Capybara''' frameworks.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
Once the application is built, it is necessary to test its functionality. More importantly, it is essential to test the functionality from users perspective. '''Feature spec''' allows testing of your application's functionality from the outside either by simulating a browser or by headless browser simulation. By manually clicking on the interface, the tests can discover bugs in the system and so has ours.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on“Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
The gems used in feature testing are '''rspec-rails''', '''capybara''' and '''selenium'''.&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
Based on the steps involved in manual submission of the assignment, the following test scenarios are considered:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to login&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have text content &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to submit valid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit invalid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;http://&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should display flash message with text &amp;lt;b&amp;gt;URI is not valid&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload valid link and a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit valid link to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Page should not have &amp;lt;b&amp;gt;Upload link&amp;lt;/b&amp;gt; button&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able upload file to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the feature test consist in two files:&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/assignment_setup.rb assignment_setup.rb] which contains method for creating assignments using controller calls.&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/features/student_submission_spec.rb student_assignment_submission.rb] which contain calls to assignment_setup, scenarios to test assignment submission and commands to delete the created assignments. &lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;require&amp;lt;/b&amp;gt; files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RSpec.feature 'assignment submission when student' do&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::create assignments for submission&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:each) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::capybara steps to login&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;after(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::delete assignments created&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;scenario 'submits only valid link to ongoing assignment' do&amp;lt;/b&amp;gt;&lt;br /&gt;
::mock steps using capybara&lt;br /&gt;
::make assertions&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Sample Scenario====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
require 'spec_helper'&lt;br /&gt;
require 'assignment_setup'&lt;br /&gt;
&lt;br /&gt;
RSpec.feature 'assignment submission when student' do&lt;br /&gt;
&lt;br /&gt;
  active_assignment=&amp;quot;FeatureTest&amp;quot;&lt;br /&gt;
  expired_assignment=&amp;quot;LibraryRailsApp&amp;quot;&lt;br /&gt;
  d = Date.parse(Time.now.to_s)&lt;br /&gt;
  due_date1=(d &amp;gt;&amp;gt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
  due_date2=(d &amp;lt;&amp;lt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  # Before all block runs once before all the scenarios are tested&lt;br /&gt;
  before(:all) do&lt;br /&gt;
    # Create active/ongoing assignment&lt;br /&gt;
    create_assignment(active_assignment, due_date1)&lt;br /&gt;
&lt;br /&gt;
    # Create expired/finished assignment&lt;br /&gt;
    create_assignment(expired_assignment, due_date2)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Before each block runs before every scenario&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    # Login as a student before each scenario&lt;br /&gt;
    visit root_path&lt;br /&gt;
    fill_in 'User Name', :with =&amp;gt; 'student13'&lt;br /&gt;
    fill_in 'Password', :with =&amp;gt; 'password'&lt;br /&gt;
    click_on 'SIGN IN'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # After all block runs after all the scenarios are tested&lt;br /&gt;
  after(:all)do&lt;br /&gt;
    # Delete active/ongoing assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(active_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
&lt;br /&gt;
    # Delete expired/finished assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(expired_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Scenario to check whether student is able to submit valid link to an ongoing assignment&lt;br /&gt;
  scenario 'submits only valid link to ongoing assignment' do&lt;br /&gt;
    click_on active_assignment&lt;br /&gt;
    click_on 'Your work'&lt;br /&gt;
    fill_in 'submission', :with =&amp;gt; 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
    click_on 'Upload link'&lt;br /&gt;
    expect(page).to have_content 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir review&lt;br /&gt;
$ cd review&lt;br /&gt;
$ git clone https://github.com/shrenujgandhi/expertiza.git&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't have a database with student and instructor entries then download the dump from https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uESEkzSWpJRnhGbmc/view. Extract its contents.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:create:all&lt;br /&gt;
$ cd Downloads/&lt;br /&gt;
$ mysql -u root -p expertiza_development &amp;lt; expertiza_scrubbed_2015_08_14.sql&lt;br /&gt;
password:&lt;br /&gt;
&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:migrate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/student_submission_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* ''7 examples, 0 failures'' imply that there are 7 test scenarios and none of them failed.&lt;br /&gt;
* The tests take around 35 seconds to run, which implies that they are fast.&lt;br /&gt;
* They are also repeatable as the assignments that are created in the ''before all'' block are also deleted in the ''after all'' block.&lt;br /&gt;
* They are also self-verifying as all the results are in green, which mean that all the cases passed.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/shrenujgandhi/expertiza GitHub Link]&lt;br /&gt;
# [https://youtu.be/_58l0VPy04M YouTube Demo]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100961</id>
		<title>User:Ewhorton</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Ewhorton&amp;diff=100961"/>
		<updated>2016-03-19T00:45:07Z</updated>

		<summary type="html">&lt;p&gt;Ewhorton: Expanding the introduction to provide a more in depth explanation.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Expertiza''' is a web 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. &amp;lt;ref&amp;gt;[https://github.com/expertiza/expertiza Expertiza on GitHub]&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Our contribution to this project is a suite of functional tests for the assignment calibration function. These tests are designed to provide integration, regression, and acceptance testing by using automation technologies.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The instructor does expert reviews first, then after students review calibration assignments and submit peer review results, they can check the expert review. Instructor can check &amp;quot;calibration results&amp;quot; to check the calibration results of the whole class. Currently, there is no feature test for calibration function. The goal is to understand the flow of the calibration function by mock this flow in the '''Feature Tests''' using '''RSpec''' and '''Capybara''' framework.&lt;br /&gt;
&lt;br /&gt;
===Motivation===&lt;br /&gt;
Once the application is built, it is necessary to test its functionality. More importantly, it is essential to test the functionality from users perspective. '''Feature spec''' allows testing of your application's functionality from the outside either by simulating a browser or by headless browser simulation. By manually clicking on the interface, the tests can discover bugs in the system and so has ours.&lt;br /&gt;
&lt;br /&gt;
===Flow of the calibration function===&lt;br /&gt;
Before analyzing code, one must familiarize themselves with the steps involved in assignment submission by student on Expertiza. The steps involved are:&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on &amp;quot;New public assignment&amp;quot;&lt;br /&gt;
# Input all the information needed, check the “Calibrated peer-review for training?” box, click on Create&lt;br /&gt;
# Select the review rubric in “Rubrics” tab&lt;br /&gt;
# Go to “Due dates” tab, make sure that this assignment is currently in Review phase, also, make the submission allowed in review phase. &lt;br /&gt;
# Go to the list of assignments, click “edit” icon of the assignment&lt;br /&gt;
# Go to the “Calibration” tab, click on the &amp;quot;Begin&amp;quot; link next to the student artifact for the expert review, and click “Submit Review”&lt;br /&gt;
# Go to “Review strategy” tab, select Instructor-Selected as review strategy, then select the radio button “Set number of reviews done by each student” and input the number of reviews&lt;br /&gt;
# Login with valid student username and password who is a reviewer for the assignment&lt;br /&gt;
# Click on the assignment&lt;br /&gt;
# Click on“Other’s work”&lt;br /&gt;
# After clicking “Begin”, Expertiza will display peer-review page&lt;br /&gt;
# Click “Submit Review”&lt;br /&gt;
# Click “Show calibration results” to see expert review&lt;br /&gt;
# Login with valid instructor username and password&lt;br /&gt;
# Click on &amp;quot;Assignment&amp;quot;&lt;br /&gt;
# Click on the “view review report” to see the calibration report&lt;br /&gt;
&lt;br /&gt;
== Creating the Tests==&lt;br /&gt;
&lt;br /&gt;
===Gems involved===&lt;br /&gt;
The gems used in feature testing are '''rspec-rails''', '''capybara''' and '''selenium'''.&lt;br /&gt;
&lt;br /&gt;
====rspec-rails====&lt;br /&gt;
Rspec-rails is a testing framework for Rails 3.x and 4.x. It supports testing of models, controllers, requests, features, views and routes. It does this by accepting test scenarios called specs.&amp;lt;ref&amp;gt;[https://github.com/rspec/rspec-rails rpsce-rails on GitHub]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====capybara====&lt;br /&gt;
Capybara helps you test web applications by simulating how a real user would interact with your application. It comes with built in Rack::Test and Selenium support. WebKit is supported through an external gem.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara capybara on GitHub]&amp;lt;/ref&amp;gt; To control the environments in which the scenarios are run, it provides before and after hooks.&amp;lt;ref&amp;gt;[https://www.relishapp.com/rspec/rspec-core/v/2-2/docs/hooks/before-and-after-hooks Before and after hooks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*before(:each) blocks are run before each scenario in the group&lt;br /&gt;
*before(:all) blocks are run once before all of the scenarios in the group&lt;br /&gt;
*after(:each) blocks are run after each scenario in the group &lt;br /&gt;
*after(:all) blocks are run once after all of the scenarios in the group&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====selenium====&lt;br /&gt;
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It is the default javascript webdriver for Capybara.&lt;br /&gt;
&lt;br /&gt;
===Test Scenarios===&lt;br /&gt;
Based on the steps involved in manual submission of the assignment, the following test scenarios are considered:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to login&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have text content &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to submit valid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit invalid link to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;http://&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should display flash message with text &amp;lt;b&amp;gt;URI is not valid&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able to upload valid link and a file to an ongoing assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;OnGoing Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should have link &amp;lt;b&amp;gt;&amp;lt;nowiki&amp;gt;http://www.csc.ncsu.edu/faculty/efg/517/f15/assignments&amp;lt;/nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;users_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is not able submit valid link to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Page should not have &amp;lt;b&amp;gt;Upload link&amp;lt;/b&amp;gt; button&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:20px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
Scenario to check whether student is able upload file to a finished assignment&amp;lt;br&amp;gt;&lt;br /&gt;
:Login with &amp;lt;b&amp;gt;student13&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;password&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Sign In&amp;lt;/b&amp;gt; button&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Finished Assignment&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Click on &amp;lt;b&amp;gt;Your work&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Upload file &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
:Updated page should contain filename &amp;lt;b&amp;gt;student_submission_spec.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code=== &lt;br /&gt;
Code for the feature test consist in two files:&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/assignment_setup.rb assignment_setup.rb] which contains method for creating assignments using controller calls.&lt;br /&gt;
* [https://github.com/shrenujgandhi/expertiza/blob/master/spec/features/student_submission_spec.rb student_assignment_submission.rb] which contain calls to assignment_setup, scenarios to test assignment submission and commands to delete the created assignments. &lt;br /&gt;
&lt;br /&gt;
====Structure====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;require&amp;lt;/b&amp;gt; files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;RSpec.feature 'assignment submission when student' do&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::create assignments for submission&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;before(:each) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::capybara steps to login&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;after(:all) do&amp;lt;/b&amp;gt;&lt;br /&gt;
::delete assignments created&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;b&amp;gt;scenario 'submits only valid link to ongoing assignment' do&amp;lt;/b&amp;gt;&lt;br /&gt;
::mock steps using capybara&lt;br /&gt;
::make assertions&lt;br /&gt;
:&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
:....&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;end&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Sample Scenario====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
require 'spec_helper'&lt;br /&gt;
require 'assignment_setup'&lt;br /&gt;
&lt;br /&gt;
RSpec.feature 'assignment submission when student' do&lt;br /&gt;
&lt;br /&gt;
  active_assignment=&amp;quot;FeatureTest&amp;quot;&lt;br /&gt;
  expired_assignment=&amp;quot;LibraryRailsApp&amp;quot;&lt;br /&gt;
  d = Date.parse(Time.now.to_s)&lt;br /&gt;
  due_date1=(d &amp;gt;&amp;gt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
  due_date2=(d &amp;lt;&amp;lt; 1).strftime(&amp;quot;%Y-%m-%d %H:%M:00&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  # Before all block runs once before all the scenarios are tested&lt;br /&gt;
  before(:all) do&lt;br /&gt;
    # Create active/ongoing assignment&lt;br /&gt;
    create_assignment(active_assignment, due_date1)&lt;br /&gt;
&lt;br /&gt;
    # Create expired/finished assignment&lt;br /&gt;
    create_assignment(expired_assignment, due_date2)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Before each block runs before every scenario&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    # Login as a student before each scenario&lt;br /&gt;
    visit root_path&lt;br /&gt;
    fill_in 'User Name', :with =&amp;gt; 'student13'&lt;br /&gt;
    fill_in 'Password', :with =&amp;gt; 'password'&lt;br /&gt;
    click_on 'SIGN IN'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # After all block runs after all the scenarios are tested&lt;br /&gt;
  after(:all)do&lt;br /&gt;
    # Delete active/ongoing assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(active_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
&lt;br /&gt;
    # Delete expired/finished assignment created by the test&lt;br /&gt;
    assignment = Assignment.find_by_name(expired_assignment)&lt;br /&gt;
    assignment.delete&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # Scenario to check whether student is able to submit valid link to an ongoing assignment&lt;br /&gt;
  scenario 'submits only valid link to ongoing assignment' do&lt;br /&gt;
    click_on active_assignment&lt;br /&gt;
    click_on 'Your work'&lt;br /&gt;
    fill_in 'submission', :with =&amp;gt; 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
    click_on 'Upload link'&lt;br /&gt;
    expect(page).to have_content 'http://www.csc.ncsu.edu/faculty/efg/517/f15/schedule'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Running  the tests==&lt;br /&gt;
&lt;br /&gt;
The following are steps required to run the test&lt;br /&gt;
&lt;br /&gt;
* Clone the repository in a new directory&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir review&lt;br /&gt;
$ cd review&lt;br /&gt;
$ git clone https://github.com/shrenujgandhi/expertiza.git&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't have a database with student and instructor entries then download the dump from https://drive.google.com/a/ncsu.edu/file/d/0B2vDvVjH76uESEkzSWpJRnhGbmc/view. Extract its contents.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:create:all&lt;br /&gt;
$ cd Downloads/&lt;br /&gt;
$ mysql -u root -p expertiza_development &amp;lt; expertiza_scrubbed_2015_08_14.sql&lt;br /&gt;
password:&lt;br /&gt;
&lt;br /&gt;
$ cd expertiza&lt;br /&gt;
$ rake db:migrate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Type the command to run tests for assignment submission&lt;br /&gt;
&amp;lt;pre style=&amp;quot;font-size:12.5px; width:750px; margin-top:10px; border:1px solid lightgrey; background:ivory; color:black; padding-left:15px; padding-top:15px; padding-bottom:15px;&amp;quot;&amp;gt;&lt;br /&gt;
rspec spec/features/student_submission_spec.rb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Results==&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows the result of the rspec command.&lt;br /&gt;
&lt;br /&gt;
[[File:test_result_temp2_expertiza.jpg|Feature Test Result]]&lt;br /&gt;
&lt;br /&gt;
=== Test Analysis ===&lt;br /&gt;
&lt;br /&gt;
* ''7 examples, 0 failures'' imply that there are 7 test scenarios and none of them failed.&lt;br /&gt;
* The tests take around 35 seconds to run, which implies that they are fast.&lt;br /&gt;
* They are also repeatable as the assignments that are created in the ''before all'' block are also deleted in the ''after all'' block.&lt;br /&gt;
* They are also self-verifying as all the results are in green, which mean that all the cases passed.&lt;br /&gt;
&lt;br /&gt;
==Project Resources==&lt;br /&gt;
# [https://github.com/shrenujgandhi/expertiza GitHub Link]&lt;br /&gt;
# [https://youtu.be/_58l0VPy04M YouTube Demo]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
* [http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza Documentation]&lt;/div&gt;</summary>
		<author><name>Ewhorton</name></author>
	</entry>
</feed>