<?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=Adhaval</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=Adhaval"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Adhaval"/>
	<updated>2026-05-13T03:05:13Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121509</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121509"/>
		<updated>2018-12-12T17:36:13Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: /* Pre-requisites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. &lt;br /&gt;
&lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we get the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Latest_Prash_screenshot.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Pre-requisites===&lt;br /&gt;
Following are the necessary steps needed to be set up in order to have the feature running :&lt;br /&gt;
# Browser: Google Chrome&lt;br /&gt;
# Cores plug-in (link in references)&lt;br /&gt;
&lt;br /&gt;
Before the JSON response is displayed, certain fields are first filtered out or formatted. For instance, the field &amp;quot;text&amp;quot; is filtered out as it is redundant to display it again. The field &amp;quot;sentiment_tone&amp;quot; is formatted with the help of another font color JSON depending on its value.&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            //Response JSON fields are filtered and then displayed&lt;br /&gt;
            &lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
                //Add the response to the API result box&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
                        if(x == &amp;quot;text&amp;quot;){&lt;br /&gt;
                                continue;&lt;br /&gt;
                        }&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
	      console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:E1878Final.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks outside the textbox&lt;br /&gt;
           No suggestions are displayed&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered positive text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered negative text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en Plug-In: Cores]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121207</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121207"/>
		<updated>2018-12-07T21:57:35Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: /* Test plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. &lt;br /&gt;
&lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we get the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Pre-requisites===&lt;br /&gt;
Following are the necessary steps needed to be set up in order to have the feature running :&lt;br /&gt;
# Browser: Google Chrome&lt;br /&gt;
# Cores plug-in (link in references)&lt;br /&gt;
&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:E1878Final.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks outside the textbox&lt;br /&gt;
           No suggestions are displayed&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered positive text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered negative text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en Plug-In: Cores]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121206</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121206"/>
		<updated>2018-12-07T21:55:40Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: /* Expected State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. &lt;br /&gt;
&lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we get the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Pre-requisites===&lt;br /&gt;
Following are the necessary steps needed to be set up in order to have the feature running :&lt;br /&gt;
# Browser: Google Chrome&lt;br /&gt;
# Cores plug-in (link in references)&lt;br /&gt;
&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:E1878Final.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks outside the textbox&lt;br /&gt;
           No suggestions are displayed&lt;br /&gt;
&lt;br /&gt;
         &lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered positive text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered negative text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en Plug-In: Cores]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121205</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121205"/>
		<updated>2018-12-07T21:53:21Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: /* Suggestion detection algorithm */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. &lt;br /&gt;
&lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we get the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Pre-requisites===&lt;br /&gt;
Following are the necessary steps needed to be set up in order to have the feature running :&lt;br /&gt;
# Browser: Google Chrome&lt;br /&gt;
# Cores plug-in (link in references)&lt;br /&gt;
&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:E1878Final.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks outside the textbox&lt;br /&gt;
           No suggestions are displayed&lt;br /&gt;
&lt;br /&gt;
         &lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered positive text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered negative text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en Plug-In: Cores]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121203</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121203"/>
		<updated>2018-12-07T21:51:01Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: /* Test plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Pre-requisites===&lt;br /&gt;
Following are the necessary steps needed to be set up in order to have the feature running :&lt;br /&gt;
# Browser: Google Chrome&lt;br /&gt;
# Cores plug-in (link in references)&lt;br /&gt;
&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:E1878Final.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks outside the textbox&lt;br /&gt;
           No suggestions are displayed&lt;br /&gt;
&lt;br /&gt;
         &lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered positive text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered negative text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en Plug-In: Cores]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121201</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=121201"/>
		<updated>2018-12-07T21:48:37Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: /* Test plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Pre-requisites===&lt;br /&gt;
Following are the necessary steps needed to be set up in order to have the feature running :&lt;br /&gt;
# Browser: Google Chrome&lt;br /&gt;
# Cores plug-in (link in references)&lt;br /&gt;
&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:E1878Final.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks outside the textbox&lt;br /&gt;
           No suggestions are displayed&lt;br /&gt;
           &lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered positive text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered negative text and suggestions in the review segment&lt;br /&gt;
           When the Student clicks outside the text box for the segment&lt;br /&gt;
           Then a table will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en Plug-In: Cores]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120959</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120959"/>
		<updated>2018-12-04T22:46:33Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Pre-requisites===&lt;br /&gt;
Following are the necessary steps needed to be set up in order to have the feature running :&lt;br /&gt;
# Browser: Google Chrome&lt;br /&gt;
# Cores plug-in (link in references)&lt;br /&gt;
&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:E1878Final.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[http://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en Plug-In: Cores]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120958</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120958"/>
		<updated>2018-12-04T22:45:36Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===Pre-requisites===&lt;br /&gt;
Following are the necessary steps needed to be set up in order to have the feature running :&lt;br /&gt;
# Browser: Google Chrome&lt;br /&gt;
# Cores plug-in (link in references)&lt;br /&gt;
&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:E1878Final.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120957</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120957"/>
		<updated>2018-12-04T22:39:31Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: Integrate Suggestion Detection Algorithm&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:E1878Final.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1878Final.jpg&amp;diff=120956</id>
		<title>File:E1878Final.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1878Final.jpg&amp;diff=120956"/>
		<updated>2018-12-04T22:37:34Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120955</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120955"/>
		<updated>2018-12-04T22:36:25Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:Implementation_E1878.png]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120954</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120954"/>
		<updated>2018-12-04T22:32:23Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Screenshot with integrated API==&lt;br /&gt;
[[File:Implementation.png]]&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Implementation.jpg&amp;diff=120953</id>
		<title>File:Implementation.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Implementation.jpg&amp;diff=120953"/>
		<updated>2018-12-04T22:27:23Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120951</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120951"/>
		<updated>2018-12-04T22:17:09Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(APIresultbox);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(APIresultbox);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120950</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120950"/>
		<updated>2018-12-04T22:12:27Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(txt);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(txt);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120949</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120949"/>
		<updated>2018-12-04T22:08:32Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;)&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(txt);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(txt);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120948</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120948"/>
		<updated>2018-12-04T22:05:55Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;){&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			}&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(txt);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(txt);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120946</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=120946"/>
		<updated>2018-12-04T21:58:25Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains the integration of the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. &lt;br /&gt;
'''Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.''' As stated in the Problem statement, we will be getting the response from the REST endpoints as given and integrate it with Expertiza. The suggestion detection algorithm from which we are getting the metrics is added in the &amp;quot;References&amp;quot; section in case more details are needed on it. '''According to the problem statement, we will be considering the &amp;quot;Suggestion Detection Algorithm&amp;quot; to be a black box, which take a json with text as input and returns a json with few metrics as given below.'''&lt;br /&gt;
&lt;br /&gt;
''Input JSON to &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
  { &amp;quot;text&amp;quot; : &amp;quot;This is an excellent project. Keep up the great work&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Output JSON the &amp;quot;Suggestion Detection Algorithm&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
   {&amp;quot;sentiment_score&amp;quot;: 0.9,&lt;br /&gt;
  &amp;quot;sentiment_tone&amp;quot;: &amp;quot;Positive&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions&amp;quot;: &amp;quot;absent&amp;quot;,&lt;br /&gt;
  &amp;quot;suggestions_chances&amp;quot;: 10.17,&lt;br /&gt;
  &amp;quot;text&amp;quot;: &amp;quot;This is an excellent project. Keep up the great work&amp;quot;,&lt;br /&gt;
   &amp;quot;total_volume&amp;quot;: 10,&lt;br /&gt;
   &amp;quot;volume_without_stopwords&amp;quot;: 6}&lt;br /&gt;
&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we call this web service with the student’s review as the input. We then tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the web service. &lt;br /&gt;
#We evaluate how much time this API is taking. We don’t want the system to be terribly slow.&lt;br /&gt;
&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
==Design document==&lt;br /&gt;
&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
In its current state, the student directly writes their review in  segmented text boxes under instructor specified questions with no further checks about the relevance of the review they have written as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
&lt;br /&gt;
====Expected State====&lt;br /&gt;
We plan to implement buttons next to each text box so that the student can check their review for volume, sentiment, suggestion, praise and criticism metrics. The rationale for including buttons right next to each text box, is so that the student gets to test only the written matter that they wish to check, and not the entirety of their review.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UML Diagrams====&lt;br /&gt;
We are not modifying any models / adding any logic that requires an UML diagram. Most of our changes are on HTML. Our logic to be implemented is pre-processing the review and sending it as JSON to the Suggestion Detection API, getting the JSON response from API, post-processing the metrics to output the Suggestion Analysis.&lt;br /&gt;
&lt;br /&gt;
The overall flow of the logic is explained as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Flowchart_Prashanthi.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Following is the code snippet of our implementation :&lt;br /&gt;
&lt;br /&gt;
//Suggestion detection API call&lt;br /&gt;
      tinyMCE.on('AddEditor', function(e) {&lt;br /&gt;
      e.editor.on('blur', function (e) {&lt;br /&gt;
        ed = e.target;&lt;br /&gt;
        if (ed.id.includes(&amp;quot;comments&amp;quot;)){&lt;br /&gt;
          json_review = JSON.stringify({ &amp;quot;text&amp;quot;: ed.getContent({format : 'text'}) })&lt;br /&gt;
          &lt;br /&gt;
          $.ajax({&lt;br /&gt;
            url: &amp;quot;https://peer-reviews-nlp.herokuapp.com/all&amp;quot;,&lt;br /&gt;
            type: &amp;quot;POST&amp;quot;,&lt;br /&gt;
            crossDomain: true,&lt;br /&gt;
            contentHeader: &amp;quot;application/javascript&amp;quot;,&lt;br /&gt;
            contentType: &amp;quot;application/json&amp;quot;,&lt;br /&gt;
            data: json_review,&lt;br /&gt;
            dataType: &amp;quot;json&amp;quot;,&lt;br /&gt;
            success: function (response) {&lt;br /&gt;
	    	console.log(&amp;quot;success&amp;quot;);&lt;br /&gt;
		var APIresultbox =&amp;quot;&amp;quot;;&lt;br /&gt;
		var colors = {&amp;quot;Negative&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:red;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Positive&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:green;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Neutral&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;, &lt;br /&gt;
				&amp;quot;Mixed&amp;quot;: &amp;quot;:&amp;lt;/b&amp;gt; &amp;lt;font style=\&amp;quot;color:saddlebrown;\&amp;quot;&amp;gt;&amp;quot;};&lt;br /&gt;
		APIresultbox += &amp;quot;&amp;lt;table border='1'&amp;gt;&amp;quot;&lt;br /&gt;
        	for (x in response) {&lt;br /&gt;
			if (x == &amp;quot;sentiment_tone&amp;quot;){&lt;br /&gt;
				APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + colors[response[x]] + response[x] + &amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
			}&lt;br /&gt;
			else&lt;br /&gt;
           			APIresultbox += &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt; &amp;quot; + x + &amp;quot;:&amp;lt;/b&amp;gt; &amp;quot; +response[x] + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
		&lt;br /&gt;
       		}&lt;br /&gt;
	//API result box&lt;br /&gt;
        APIresultbox += &amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
	console.log(APIresultbox);&lt;br /&gt;
              console.log(response);&lt;br /&gt;
             if(ed.id.includes(&amp;quot;responses&amp;quot;))&lt;br /&gt;
                  $('#' + ed.id.replace(&amp;quot;responses&amp;quot;, &amp;quot;analysis&amp;quot;)).html(txt);&lt;br /&gt;
              else if(ed.id.includes('review_comments'))&lt;br /&gt;
                 $('#review_comments_analysis').html(txt);&lt;br /&gt;
            },&lt;br /&gt;
            error: function (xhr, status) {&lt;br /&gt;
		console.log(status)&lt;br /&gt;
              $('#save_progress').html('Unable to reach suggestion detection service at the moment')&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      });&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===Test plan===&lt;br /&gt;
&lt;br /&gt;
Test: ViewSuggestionMetricsForReviewSegment&lt;br /&gt;
 Feature: As a Student,&lt;br /&gt;
          I want to view a popup displaying the suggestion metrics for the segment of the review I am writing&lt;br /&gt;
          So that I can use it to improve the relevance of the review segment provided&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Empty Review Segment&lt;br /&gt;
           Given the Student has not entered any text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show that the user has not entered any text for suggestion metrics analysis.&lt;br /&gt;
&lt;br /&gt;
 Scenario: Display Suggestion Metrics on Review Segment with Text&lt;br /&gt;
           Given the Student has entered any form of text in the review segment&lt;br /&gt;
           When the Student clicks the Analyze button for the segment&lt;br /&gt;
           Then a popup will show the user the results of the suggestion metrics analysis&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119816</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119816"/>
		<updated>2018-11-13T23:16:29Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains how we are planning to integrate the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we would like to call this web service with the student’s review as the input. We would then want to tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the webservice. &lt;br /&gt;
#We would also like to evaluate how much time this API is taking and if possible work a way out to improve it. We don’t want the system to be terribly slow.&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
# app/views/submitted_content/_self_review.html.erb&lt;br /&gt;
==Design document==&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
[[File:Before.jpg]]&lt;br /&gt;
====Expected State====&lt;br /&gt;
[[File:After.jpg]]&lt;br /&gt;
===Test plan===&lt;br /&gt;
====Current State====&lt;br /&gt;
====Expected State====&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:After.jpg&amp;diff=119815</id>
		<title>File:After.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:After.jpg&amp;diff=119815"/>
		<updated>2018-11-13T23:15:26Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Before.jpg&amp;diff=119814</id>
		<title>File:Before.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Before.jpg&amp;diff=119814"/>
		<updated>2018-11-13T23:14:33Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: uploaded a new version of &amp;amp;quot;File:Before.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119807</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119807"/>
		<updated>2018-11-13T23:02:09Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains how we are planning to integrate the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we would like to call this web service with the student’s review as the input. We would then want to tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the webservice. &lt;br /&gt;
#We would also like to evaluate how much time this API is taking and if possible work a way out to improve it. We don’t want the system to be terribly slow.&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
# app/views/submitted_content/_self_review.html.erb&lt;br /&gt;
==Design document==&lt;br /&gt;
==Wireframes==&lt;br /&gt;
====Current State====&lt;br /&gt;
[[File:Wireframe_before.jpg]]&lt;br /&gt;
====Expected State====&lt;br /&gt;
===Test plan===&lt;br /&gt;
====Current State====&lt;br /&gt;
====Expected State====&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Wireframe_before.jpg&amp;diff=119791</id>
		<title>File:Wireframe before.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Wireframe_before.jpg&amp;diff=119791"/>
		<updated>2018-11-13T22:46:08Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119777</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119777"/>
		<updated>2018-11-13T22:25:00Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains how we are planning to integrate the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we would like to call this web service with the student’s review as the input. We would then want to tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the webservice. &lt;br /&gt;
#We would also like to evaluate how much time this API is taking and if possible work a way out to improve it. We don’t want the system to be terribly slow.&lt;br /&gt;
==Files modified==&lt;br /&gt;
# app/views/response/response.html.erb&lt;br /&gt;
# app/views/submitted_content/_self_review.html.erb&lt;br /&gt;
==Design document==&lt;br /&gt;
==Wireframes===&lt;br /&gt;
===Test plan===&lt;br /&gt;
====Current State====&lt;br /&gt;
====Expected State====&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119491</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119491"/>
		<updated>2018-11-12T21:15:35Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains how we are planning to integrate the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we would like to call this web service with the student’s review as the input. We would then want to tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the webservice. &lt;br /&gt;
#We would also like to evaluate how much time this API is taking and if possible work a way out to improve it. We don’t want the system to be terribly slow.&lt;br /&gt;
==Files modified==&lt;br /&gt;
==Design document==&lt;br /&gt;
===UML===&lt;br /&gt;
===Wireframes===&lt;br /&gt;
===Test plan===&lt;br /&gt;
====Current State====&lt;br /&gt;
====Expected tests====&lt;br /&gt;
==References==&lt;br /&gt;
#[http://peer-reviews-nlp.herokuapp.com/ NLP Project for suggestions algorithm]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119488</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119488"/>
		<updated>2018-11-12T21:11:51Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1878 Integrate suggestion detection algorithm in Expertiza Project. This Wiki page explains how we are planning to integrate the suggestion detection algorithm in Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
 Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. In the same time, we hope students could also gain knowledge from the reviews received thus improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. Currently, we have a few classifiers that could catch useful components of review comments, such as if it contains suggestions, etc. These classifiers are already ported into web services that we’d like to be integrated into Expertiza.&lt;br /&gt;
====Problem statement====&lt;br /&gt;
#When a student submits a review, we would like to call this web service with the student’s review as the input. We would then want to tell the student whether their reviews contain suggestions or not, so they can make improvements based on the results of the webservice. &lt;br /&gt;
#We would also like to evaluate how much time this API is taking and if possible work a way out to improve it. We don’t want the system to be terribly slow.&lt;br /&gt;
==Files modified==&lt;br /&gt;
==Design document==&lt;br /&gt;
===UML===&lt;br /&gt;
===Wireframes===&lt;br /&gt;
===Test plan===&lt;br /&gt;
====Current State====&lt;br /&gt;
====Expected tests====&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119482</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119482"/>
		<updated>2018-11-12T21:05:48Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Team===&lt;br /&gt;
# Ameya Dhavalikar&lt;br /&gt;
# Komal Kangutkar&lt;br /&gt;
# Prashanthi Kanniappan Murthy&lt;br /&gt;
# Vibhav Nandavaram Abbai Srivaths&lt;br /&gt;
===Background information===&lt;br /&gt;
====Expertiza====&lt;br /&gt;
====Suggestion detection algorithm====&lt;br /&gt;
====Problem statement====&lt;br /&gt;
==Files modified==&lt;br /&gt;
==Design document==&lt;br /&gt;
===UML===&lt;br /&gt;
===Wireframes===&lt;br /&gt;
===Test plan===&lt;br /&gt;
====Current State====&lt;br /&gt;
====Expected tests====&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119476</id>
		<title>CSC/ECE 517 Fall 2018/E1878 Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018/E1878_Integrate_Suggestion_Detection_Algorithm&amp;diff=119476"/>
		<updated>2018-11-12T20:58:25Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: Created page with &amp;quot;==Introduction== ===Team=== ===Background information=== ==Files modified== ==Design document== ===UML=== ===Wireframes=== ===Test plan===&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Team===&lt;br /&gt;
===Background information===&lt;br /&gt;
==Files modified==&lt;br /&gt;
==Design document==&lt;br /&gt;
===UML===&lt;br /&gt;
===Wireframes===&lt;br /&gt;
===Test plan===&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118468</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118468"/>
		<updated>2018-11-03T02:08:40Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: /* Coverage Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
We have used factories and created the mock objects that we need to execute the tests. Menu model require several other mock objects to be created namely Node(this is a subclass in the menu class), menu_item, site_controller, controller_action,etc.&lt;br /&gt;
&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which&lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1 In this scenario, the by_name hash does not contain the given node name. The expectation is that nil is returned.&lt;br /&gt;
&lt;br /&gt;
    2.2 In this scenario, the by_name hash contains the given node name. The expectation is that the menu item for the given name is selected.&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
        In this scenario, the expectation is that the name of the currently selected element is returned.&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1 In this scenario, @selected hash contains menu_id. The expectation is that true is returned.&lt;br /&gt;
&lt;br /&gt;
    6.2 In this scenario, @selected hash does not contain menu_id. The expectation is that false is returned.&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
        In this scenario, the expectation is that a list of menu items is returned based on the contents in the crumbs array.&lt;br /&gt;
&lt;br /&gt;
==Test Results and Coverage==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
[[File:Rspec Test Passing.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Coverage Results===&lt;br /&gt;
[[File:Coverage.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://www.youtube.com/watch?v=ymmKTPwBOQQ Link to screencast]&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118467</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118467"/>
		<updated>2018-11-03T02:07:43Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
We have used factories and created the mock objects that we need to execute the tests. Menu model require several other mock objects to be created namely Node(this is a subclass in the menu class), menu_item, site_controller, controller_action,etc.&lt;br /&gt;
&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which&lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1 In this scenario, the by_name hash does not contain the given node name. The expectation is that nil is returned.&lt;br /&gt;
&lt;br /&gt;
    2.2 In this scenario, the by_name hash contains the given node name. The expectation is that the menu item for the given name is selected.&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
        In this scenario, the expectation is that the name of the currently selected element is returned.&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1 In this scenario, @selected hash contains menu_id. The expectation is that true is returned.&lt;br /&gt;
&lt;br /&gt;
    6.2 In this scenario, @selected hash does not contain menu_id. The expectation is that false is returned.&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
        In this scenario, the expectation is that a list of menu items is returned based on the contents in the crumbs array.&lt;br /&gt;
&lt;br /&gt;
==Test Results and Coverage==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
[[File:Rspec Test Passing.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Coverage Results===&lt;br /&gt;
[[File:Coverage.jpg]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=ymmKTPwBOQQ Link to screencast] &lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118466</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118466"/>
		<updated>2018-11-03T02:07:25Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.example.com link title]CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
We have used factories and created the mock objects that we need to execute the tests. Menu model require several other mock objects to be created namely Node(this is a subclass in the menu class), menu_item, site_controller, controller_action,etc.&lt;br /&gt;
&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which&lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1 In this scenario, the by_name hash does not contain the given node name. The expectation is that nil is returned.&lt;br /&gt;
&lt;br /&gt;
    2.2 In this scenario, the by_name hash contains the given node name. The expectation is that the menu item for the given name is selected.&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
        In this scenario, the expectation is that the name of the currently selected element is returned.&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1 In this scenario, @selected hash contains menu_id. The expectation is that true is returned.&lt;br /&gt;
&lt;br /&gt;
    6.2 In this scenario, @selected hash does not contain menu_id. The expectation is that false is returned.&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
        In this scenario, the expectation is that a list of menu items is returned based on the contents in the crumbs array.&lt;br /&gt;
&lt;br /&gt;
==Test Results and Coverage==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
[[File:Rspec Test Passing.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Coverage Results===&lt;br /&gt;
[[File:Coverage.jpg]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=ymmKTPwBOQQ Link to screencast] &lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118461</id>
		<title>File:Coverage.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118461"/>
		<updated>2018-11-03T02:01:25Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: uploaded a new version of &amp;amp;quot;File:Coverage.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118459</id>
		<title>File:Coverage.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118459"/>
		<updated>2018-11-03T02:00:03Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: uploaded a new version of &amp;amp;quot;File:Coverage.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118457</id>
		<title>File:Coverage.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118457"/>
		<updated>2018-11-03T01:57:47Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: uploaded a new version of &amp;amp;quot;File:Coverage.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118454</id>
		<title>File:Coverage.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118454"/>
		<updated>2018-11-03T01:55:21Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: uploaded a new version of &amp;amp;quot;File:Coverage.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118453</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118453"/>
		<updated>2018-11-03T01:53:24Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also, several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1 In this scenario, the by_name hash does not contain the given node name. The expectation is that nil is returned.&lt;br /&gt;
&lt;br /&gt;
    2.2 In this scenario, the by_name hash contains the given node name. The expectation is that the menu item for the given name is selected.&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
        In this scenario, the expectation is that the name of the currently selected element is returned.&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1 In this scenario, @selected hash contains menu_id. The expectation is that true is returned.&lt;br /&gt;
&lt;br /&gt;
    6.2 In this scenario, @selected hash does not contain menu_id. The expectation is that false is returned.&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
        In this scenario, the expectation is that a list of menu items is returned based on the contents in the crumbs array.&lt;br /&gt;
&lt;br /&gt;
==Test Results and Coverage==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
[[File:Rspec Test Passing.JPG]]&lt;br /&gt;
&lt;br /&gt;
===Coverage Results===&lt;br /&gt;
[[File:Coverage.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118452</id>
		<title>File:Coverage.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.jpg&amp;diff=118452"/>
		<updated>2018-11-03T01:52:05Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: uploaded a new version of &amp;amp;quot;File:Coverage.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118423</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118423"/>
		<updated>2018-11-03T01:18:29Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also, several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1 In this scenario, the by_name hash does not contain the given node name. The expectation is that nil is returned.&lt;br /&gt;
&lt;br /&gt;
    2.2 In this scenario, the by_name hash contains the given node name. The expectation is that the menu item for the given name is selected.&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
        In this scenario, the expectation is that the name of the currently selected element is returned.&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1 In this scenario, @selected hash contains menu_id. The expectation is that true is returned.&lt;br /&gt;
&lt;br /&gt;
    6.2 In this scenario, @selected hash does not contain menu_id. The expectation is that false is returned.&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
        In this scenario, the expectation is that a list of menu items is returned based on the contents in the crumbs array.&lt;br /&gt;
&lt;br /&gt;
==Test Results and Coverage==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
[[File:Rspec Test Passing.JPG]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118422</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118422"/>
		<updated>2018-11-03T01:15:41Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also, several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1 In this scenario, the by_name hash does not contain the given node name. The expectation is that nil is returned.&lt;br /&gt;
&lt;br /&gt;
    2.2 In this scenario, the by_name hash contains the given node name. The expectation is that the menu item for the given name is selected.&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
        In this scenario, the expectation is that the name of the currently selected element is returned.&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1 In this scenario, @selected hash contains menu_id. The expectation is that true is returned.&lt;br /&gt;
&lt;br /&gt;
    6.2 In this scenario, @selected hash does not contain menu_id. The expectation is that false is returned.&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
        In this scenario, the expectation is that a list of menu items is returned based on the contents in the crumbs array.&lt;br /&gt;
&lt;br /&gt;
==Test Results and Coverage==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
[[File:Rspec Test Passing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118420</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118420"/>
		<updated>2018-11-03T01:14:46Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also, several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1 In this scenario, the by_name hash does not contain the given node name. The expectation is that nil is returned.&lt;br /&gt;
&lt;br /&gt;
    2.2 In this scenario, the by_name hash contains the given node name. The expectation is that the menu item for the given name is selected.&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
        In this scenario, the expectation is that the name of the currently selected element is returned.&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1 In this scenario, @selected hash contains menu_id. The expectation is that true is returned.&lt;br /&gt;
&lt;br /&gt;
    6.2 In this scenario, @selected hash does not contain menu_id. The expectation is that false is returned.&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
        In this scenario, the expectation is that a list of menu items is returned based on the contents in the crumbs array.&lt;br /&gt;
&lt;br /&gt;
==Test Results and Coverage==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
[[File:Rspec test passing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118418</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118418"/>
		<updated>2018-11-03T01:12:56Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also, several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1 In this scenario, the by_name hash does not contain the given node name. The expectation is that nil is returned.&lt;br /&gt;
&lt;br /&gt;
    2.2 In this scenario, the by_name hash contains the given node name. The expectation is that the menu item for the given name is selected.&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
        In this scenario, the expectation is that the name of the currently selected element is returned.&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1 In this scenario, @selected hash contains menu_id. The expectation is that true is returned.&lt;br /&gt;
&lt;br /&gt;
    6.2 In this scenario, @selected hash does not contain menu_id. The expectation is that false is returned.&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
        In this scenario, the expectation is that a list of menu items is returned based on the contents in the crumbs array.&lt;br /&gt;
&lt;br /&gt;
==Test Results and Coverage==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
[[File:Rspec_test_passing.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec_Test_Passing.JPG&amp;diff=118417</id>
		<title>File:Rspec Test Passing.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec_Test_Passing.JPG&amp;diff=118417"/>
		<updated>2018-11-03T01:11:03Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118016</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118016"/>
		<updated>2018-11-02T15:54:18Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also, several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1 In this scenario, the by_name hash does not contain the given node name. The expectation is that nil is returned.&lt;br /&gt;
&lt;br /&gt;
    2.2 In this scenario, the by_name hash contains the given node name. The expectation is that the menu item for the given name is selected.&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
        In this scenario, the expectation is that the name of the currently selected element is returned.&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1 In this scenario, @selected hash contains menu_id. The expectation is that true is returned.&lt;br /&gt;
&lt;br /&gt;
    6.2 In this scenario, @selected hash does not contain menu_id. The expectation is that false is returned.&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
        In this scenario, the expectation is that a list of menu items is returned based on the contents in the crumbs array.&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118011</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118011"/>
		<updated>2018-11-02T15:46:22Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also, several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1 In this scenario, the menu items are nil or empty. The expectation is that the later initialization is terminated and nil is returned.&lt;br /&gt;
&lt;br /&gt;
    1.2 In this scenario, the menu items are not nil or empty and the parent id of the node is nil. The expectation is that a hash of menu items &lt;br /&gt;
        is built by name and id and the current node is made a child node of the root node.&lt;br /&gt;
&lt;br /&gt;
    1.3 In this scenario, the menu items are not nil or empty and the parent id of the node is not nil. The expectation is that a hash of menu &lt;br /&gt;
        items is built by name and id and the current node is made a child node of its parent node.&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1&lt;br /&gt;
&lt;br /&gt;
    2.2&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
        In this scenario, the menu item id is passed as a parameter to the method. The expectation is that the menu item is returned by id.&lt;br /&gt;
&lt;br /&gt;
4. get_menu&lt;br /&gt;
        In this scenario, the menu level is passed as a parameter to the method. The expectation is that an array of all the child nodes at that &lt;br /&gt;
        given level is returned.&lt;br /&gt;
&lt;br /&gt;
5. selected&lt;br /&gt;
&lt;br /&gt;
6. selected?&lt;br /&gt;
    6.1&lt;br /&gt;
&lt;br /&gt;
    6.2&lt;br /&gt;
&lt;br /&gt;
7. crumbs&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118003</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=118003"/>
		<updated>2018-11-02T15:37:31Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also, several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
&lt;br /&gt;
# initialize&lt;br /&gt;
    1.1&lt;br /&gt;
&lt;br /&gt;
    1.2&lt;br /&gt;
&lt;br /&gt;
    1.3&lt;br /&gt;
&lt;br /&gt;
2. select&lt;br /&gt;
    2.1&lt;br /&gt;
&lt;br /&gt;
    2.2&lt;br /&gt;
&lt;br /&gt;
3. get_item&lt;br /&gt;
4. get_menu&lt;br /&gt;
5. selected&lt;br /&gt;
6. selected?&lt;br /&gt;
7. crumbs&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117987</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117987"/>
		<updated>2018-11-02T15:12:57Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also, several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
3. site_controller&lt;br /&gt;
   3.1 In this scenario, the site_controller variable is nil. In this case, the expectation is that the site_controller is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
 &lt;br /&gt;
   3.2 In this scenario, the site_controller variable is not nil. In this case, the expectation is that the site_controller variable is returned.   &lt;br /&gt;
&lt;br /&gt;
4. controller_action&lt;br /&gt;
   4.1 In this scenario, the controller_action variable is nil. In this case, the expectation is that the controller_action is found by the &lt;br /&gt;
       id and returned.&lt;br /&gt;
&lt;br /&gt;
   4.2 In this scenario, the controller_action variable is not nil. In this case, the expectation is that the controller_action variable is &lt;br /&gt;
       returned.&lt;br /&gt;
&lt;br /&gt;
5. content_page&lt;br /&gt;
       In this scenario, the content_page variable is nil. In this case, the expectation is that the content_page variable is found by id and &lt;br /&gt;
       returned.&lt;br /&gt;
       &lt;br /&gt;
6. add_child&lt;br /&gt;
       In this scenario, a node is added to the @children list. The expectation is that the current node is added to the @children list and the &lt;br /&gt;
       total number of children are returned.&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
# initialize&lt;br /&gt;
# select&lt;br /&gt;
# get_item&lt;br /&gt;
# get_menu&lt;br /&gt;
# selected&lt;br /&gt;
# selected?&lt;br /&gt;
# crumbs&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117982</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117982"/>
		<updated>2018-11-02T14:58:10Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
&lt;br /&gt;
1. initialize&lt;br /&gt;
       In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which &lt;br /&gt;
       the expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
&lt;br /&gt;
2. setup&lt;br /&gt;
   2.1 In this scenario, the controller_action attribute of the menu item is nil. In this case, the expectation is that the content page path of &lt;br /&gt;
       the current menu item is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.2 In this scenario, the controller_action attribute of the menu item is not nil. In this case, the expectation is that the URL of  &lt;br /&gt;
       controller_action is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
   2.3 In this scenario, the controller_action attribute of the menu item is unavailable. In this case, the expectation is that a customised path &lt;br /&gt;
       is assigned to the URL variable.&lt;br /&gt;
&lt;br /&gt;
# site_controller&lt;br /&gt;
# controller_action&lt;br /&gt;
# content_page&lt;br /&gt;
# add_child&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
# initialize&lt;br /&gt;
# select&lt;br /&gt;
# get_item&lt;br /&gt;
# get_menu&lt;br /&gt;
# selected&lt;br /&gt;
# selected?&lt;br /&gt;
# crumbs&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117975</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117975"/>
		<updated>2018-11-02T14:46:28Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
# initialize&lt;br /&gt;
  In this method, we check whether the parent attribute of the node instance passed is set to nil. We have therefore written a test in which the &lt;br /&gt;
  expectation of the test is that the parent attribute of the node instance is Nil. &lt;br /&gt;
# setup&lt;br /&gt;
# site_controller&lt;br /&gt;
# controller_action&lt;br /&gt;
# content_page&lt;br /&gt;
# add_child&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
# initialize&lt;br /&gt;
# select&lt;br /&gt;
# get_item&lt;br /&gt;
# get_menu&lt;br /&gt;
# selected&lt;br /&gt;
# selected?&lt;br /&gt;
# crumbs&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117965</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117965"/>
		<updated>2018-11-02T14:37:49Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of 21 testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
Node class&lt;br /&gt;
# initialize&lt;br /&gt;
# setup&lt;br /&gt;
# site_controller&lt;br /&gt;
# controller_action&lt;br /&gt;
# content_page&lt;br /&gt;
# add_child&lt;br /&gt;
&lt;br /&gt;
Menu class&lt;br /&gt;
# initialize&lt;br /&gt;
# select&lt;br /&gt;
# get_item&lt;br /&gt;
# get_menu&lt;br /&gt;
# selected&lt;br /&gt;
# selected?&lt;br /&gt;
# crumbs&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an HTML page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117958</id>
		<title>E1853 Menu Model Testing</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1853_Menu_Model_Testing&amp;diff=117958"/>
		<updated>2018-11-02T10:09:00Z</updated>

		<summary type="html">&lt;p&gt;Adhaval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC-517 Fall 2018 - E1853 Testing the Menu Model in Expertiza Project.&lt;br /&gt;
This Wiki page explains how tests were performed for the Menu Model of the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
===Expertiza===&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an Open Source project based on the [http://rubyonrails.org/ Ruby on Rails] framework, supported by National Science Foundation. It is the software to create reusable learning objects through peer review. It is a project where students can submit and peer review learning objects(articles, code, websites, etc). The users of this software include students and professors. Expertiza is used by select professors and students in North Carolina State University, for example. It supports team projects, reviews of projects/teammates, submission URLs, Wiki pages and certain document types. Instructors can create projects and the students can bid for the projects. The students can be assigned teams for a particular project or they may form their own team with fellow classmates.&lt;br /&gt;
===Test Driven Development===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Test-driven_development/ Test Driven Development] is a software development process that relies on the repetition of a very short development cycle, requirements are turned into very specific [http://en.wikipedia.org/wiki/Test_case/ test cases], then the software is improved to pass the new test cases only. This is opposed to software development that allows software to be added that is not proven to meet requirements.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,but more recently has created more general interest in its own right.&lt;br /&gt;
&lt;br /&gt;
The TDD sequence can be can be summarized in following steps:&lt;br /&gt;
# Add a Test      &lt;br /&gt;
# Run all tests and see if the new test fails      &lt;br /&gt;
# Write the code      &lt;br /&gt;
# Run tests      &lt;br /&gt;
# Refactor code      &lt;br /&gt;
# Repeat&lt;br /&gt;
&lt;br /&gt;
Advantages of using TDD:&lt;br /&gt;
*Narrowing Problem Focus&lt;br /&gt;
*Tidier Code&lt;br /&gt;
*Not worrying about dependencies&lt;br /&gt;
*Easier refactoring&lt;br /&gt;
*Better Test coverage and fewer bugs&lt;br /&gt;
&lt;br /&gt;
===Unit Testing===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Unit_testing Unit Testing] is a software testing method by which individual units of source code are tested to catch errors early in the development process. For a model it involves testing the interface and on how it responds to commands and queries from outside. Model testing is bounded to the functionality of only the model under test and doesn't test how its collaborating models get affected based on this query.&lt;br /&gt;
&lt;br /&gt;
Unit Testing provides several benefits which can be summarized in the below points.&lt;br /&gt;
&lt;br /&gt;
1. Finds problems early:&lt;br /&gt;
Unit testing finds problems early in the development cycle. This includes both bugs in the programmer's implementation and flaws or missing parts of the specification for the unit.&lt;br /&gt;
In test-driven development (TDD), which is frequently used in both extreme programming and scrum, unit tests are created before the code itself is written. When the tests pass, that code is considered complete.&lt;br /&gt;
&lt;br /&gt;
2. Facilitates change:&lt;br /&gt;
Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract.&lt;br /&gt;
&lt;br /&gt;
3. Simplifies Integration:&lt;br /&gt;
Unit testing may reduce uncertainty in the units themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts, integration testing becomes much easier.&lt;br /&gt;
&lt;br /&gt;
4. Documentation:&lt;br /&gt;
Developers looking to learn what functionality is provided by a unit, and how to use it, can look at the unit tests to gain a basic understanding of the unit's interface's API.&lt;br /&gt;
&lt;br /&gt;
5. Design:&lt;br /&gt;
When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test is passing, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The goal of the project is to test the Menu.rb, i.e. the Menu model by writing unit tests, which are written using [http://rspec.info/ Rspec]. The unit tests are to be written such that the path coverage of menu.rb is greater than 90% and achieve the highest possible branch coverage.&lt;br /&gt;
&lt;br /&gt;
===Files Involved===&lt;br /&gt;
The following files were involved:&lt;br /&gt;
# app/models/menu.rb (already existing)&lt;br /&gt;
# spec/models/menu_spec.rb(created as part of this project)&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
The members involved in the project include :&lt;br /&gt;
# Ameya Dhavalikar(student)&lt;br /&gt;
# Hasham Mukhtar(student)&lt;br /&gt;
# Mingkang Zhuang(student)&lt;br /&gt;
# Zhewei Hu(mentor)&lt;br /&gt;
&lt;br /&gt;
==Plan of Work - Test Plan==&lt;br /&gt;
The goal is to test the menu model file. For this, we create a corresponding menu_spec.rb file where we write the tests.&lt;br /&gt;
&lt;br /&gt;
For this purposes different sub-tasks involved:&lt;br /&gt;
&lt;br /&gt;
1. Setting up the Expertiza environment &lt;br /&gt;
&lt;br /&gt;
2. Understand the functionality of model file in menu.rb &lt;br /&gt;
&lt;br /&gt;
3. Understand the linked data attributes being used, like menu_items, controller_actions, content_page, permissions_id, etc.&lt;br /&gt;
&lt;br /&gt;
4. Creating dummy entries for testing different functionalities. &lt;br /&gt;
&lt;br /&gt;
5. Writing testing conditions for different functions and cross-checking with the expected outputs.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
=== Expertiza Environment Setup ===&lt;br /&gt;
The steps that we followed to set up the Expertiza environment are as follows:&lt;br /&gt;
# Install Virtual Box software from Oracle in the local machine.&lt;br /&gt;
# Download the Ubuntu image and import the image file into the Virtualbox environment.&lt;br /&gt;
# Execute the following set up commands in the terminal to set up the application in the local machine.&lt;br /&gt;
&lt;br /&gt;
Setup commands:&lt;br /&gt;
*sudo su&lt;br /&gt;
*gem install bundler&lt;br /&gt;
*exit&lt;br /&gt;
*git clone [Forked Expertiza repository url]&lt;br /&gt;
*cd expertiza&lt;br /&gt;
*bash setup.sh&lt;br /&gt;
(change config/database.yml, there is no MySQL password by default)&lt;br /&gt;
*bundle install&lt;br /&gt;
*rails server&lt;br /&gt;
&lt;br /&gt;
After successfully setting up the environment, LogIn to the Expertiza application using necessary credentials.&lt;br /&gt;
&lt;br /&gt;
To navigate to the menu.rb file: &lt;br /&gt;
&lt;br /&gt;
1. Open terminal inside the virtual environment.&lt;br /&gt;
&lt;br /&gt;
2. Navigate to the model folder of the application by typing the following command in the terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;cd/expertiza/spec/models&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Functionality of Menu model===&lt;br /&gt;
Menu is a model which gives the functionality to the top menu bar in the Expertiza website. It controls the display of the tabs based pn the user. It links the menu items associated with each tab in the menu using a tree.  It directs how these tabs are displayed with regards to different users which have different permission attributes.&lt;br /&gt;
A super admin has the permission to edit the menu bar, by adding or deleting menu item blocks from it. Upon adding each item, he gets to position it either in the main menu bar or into different subcategories.&lt;br /&gt;
&lt;br /&gt;
===Sample Views===&lt;br /&gt;
The following Menu is displayed for the Student role :&lt;br /&gt;
&lt;br /&gt;
[[File:Menu Student View.png]]&lt;br /&gt;
&lt;br /&gt;
===Test entries creation===&lt;br /&gt;
Mock/dummy objects are needed to be created for any unit testing criteria. These objects are loaded newly and deleted after every testing condition. &lt;br /&gt;
&lt;br /&gt;
Several methods exist for creating such objects, whose parameters need to be designed to satisfy the conditions under test. Using factories command pattern is one such method where few of the attributes are filled in with predefined values when created. &lt;br /&gt;
&lt;br /&gt;
For testing menu, we created required entries into the database using &amp;quot;Menu.new()&amp;quot; method, giving different values for each of the test inputs to cover the required testing conditions.&lt;br /&gt;
&lt;br /&gt;
  before(:each) do&lt;br /&gt;
&lt;br /&gt;
    @test1.save&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
The above is an example entry used for creating objects.  such test objects were created with entries giving combinations of &lt;br /&gt;
&lt;br /&gt;
Before each test, all the objects are created, which is done using &amp;quot;before(:each)&amp;quot; key word.&lt;br /&gt;
Also several objects of 'ControllerAction' and 'ContentPage' had to be created for testing one of the methods which acted based on those values.&lt;br /&gt;
===Conditions tested in Menu===&lt;br /&gt;
A total of  testing conditions were required to be performed for testing all the functions in menu model file.&lt;br /&gt;
&lt;br /&gt;
The conditions that needed to be tested are as below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
A screenshot of the tests passing is shown here:&lt;br /&gt;
&lt;br /&gt;
==Conclusion and Learning Outcomes==&lt;br /&gt;
After writing the test cases we used SimpleCov to measure the C0 coverage of our rails application. SimpleCov was already installed earlier.&lt;br /&gt;
After running rake spec to run the test cases, SimpleCov creates a directory called coverage in our rails application folder.&lt;br /&gt;
This folder called coverage contains an index.html file which when opened in a browser renders an html page which gives the C0 coverage of each of the files in the Controllers, Models, Helpers in the app directory.&lt;br /&gt;
&lt;br /&gt;
These are the learning outcomes after performing this project:&lt;br /&gt;
# Writing tests using the Test Driven Development approach.&lt;br /&gt;
# Writing unit tests for models and controllers in RSpec.&lt;br /&gt;
# Understanding the functionality of an already developed application. In our case, before writing the test cases for the menu.rb we had the understand how different models interacted with each other and how each action by different users would make changes in the database schema.&lt;br /&gt;
# An understanding of how different tables are structures in the schema in large applications.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://github.com/AmeyaDhavalikar/expertiza Forked Repository from GitHub]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;</summary>
		<author><name>Adhaval</name></author>
	</entry>
</feed>