<?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=Tmpandi2</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=Tmpandi2"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Tmpandi2"/>
	<updated>2026-05-19T05:33:02Z</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_2019_-_E1995._Tests_for_email_functionality&amp;diff=131112</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131112"/>
		<updated>2019-12-07T06:29:47Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Outcome */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system facilitates sending emails to students and instructors on occurrence of various events or helps in taking actions on the events that occur..&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to be  reviewed.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 1: Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' Create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
#Click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' User requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
#Select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
#Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
#Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
*User creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor creates new user by filling sign-up form &lt;br /&gt;
[[File:Instructor create.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Email count should be zero when user requests new account with an invalid email&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Email count should be one when user requests new account with a valid email&lt;br /&gt;
[[File:User request2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Import CSV to add participants to assignment&lt;br /&gt;
[[File:User request3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Import CSV from manage users&lt;br /&gt;
[[File:User request4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;Scenario 2: Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Flowchart:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
#No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Capybara Tests ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
#After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
If the email id is not associated with any existing account, then email count will be zero&lt;br /&gt;
&lt;br /&gt;
[[File:Reset negative.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
If the email id is associated with an existing account, then email count will be one&lt;br /&gt;
&lt;br /&gt;
[[File:Reset positive.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 3. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; Scenario 4. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Capybara Tests  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method calls the email function to notify the reviewee&lt;br /&gt;
[[File:Reviewee2.PNG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131110</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131110"/>
		<updated>2019-12-07T06:28:54Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system facilitates sending emails to students and instructors on occurrence of various events or helps in taking actions on the events that occur..&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to be  reviewed.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 1: Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' Create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
#Click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' User requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
#Select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
#Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
#Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
*User creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor creates new user by filling sign-up form &lt;br /&gt;
[[File:Instructor create.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Email count should be zero when user requests new account with an invalid email&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Email count should be one when user requests new account with a valid email&lt;br /&gt;
[[File:User request2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Import CSV to add participants to assignment&lt;br /&gt;
[[File:User request3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Import CSV from manage users&lt;br /&gt;
[[File:User request4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;Scenario 2: Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Flowchart:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
#No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Capybara Tests ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
#After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
If the email id is not associated with any existing account, then email count will be zero&lt;br /&gt;
&lt;br /&gt;
[[File:Reset negative.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
If the email id is associated with an existing account, then email count will be one&lt;br /&gt;
&lt;br /&gt;
[[File:Reset positive.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 3. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; Scenario 4. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method calls the email function to notify the reviewee&lt;br /&gt;
[[File:Reviewee2.PNG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131108</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131108"/>
		<updated>2019-12-07T06:26:23Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Scenario 2: Resetting Password */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system facilitates sending emails to students and instructors on occurrence of various events or helps in taking actions on the events that occur..&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to be  reviewed.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 1: Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' Create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
#Click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' User requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
#Select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
#Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
#Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
*User creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor creates new user by filling sign-up form &lt;br /&gt;
[[File:Instructor create.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Email count should be zero when user requests new account with an invalid email&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Email count should be one when user requests new account with a valid email&lt;br /&gt;
[[File:User request2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Import CSV to add participants to assignment&lt;br /&gt;
[[File:User request3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Import CSV from manage users&lt;br /&gt;
[[File:User request4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;Scenario 2: Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Flowchart:'''&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
#No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Capybara Tests ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
#After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
If the email id is not associated with any existing account, then email count will be zero&lt;br /&gt;
&lt;br /&gt;
[[File:Reset negative.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
If the email id is associated with an existing account, then email count will be one&lt;br /&gt;
&lt;br /&gt;
[[File:Reset positive.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 3. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; Scenario 4. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewee2.PNG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131101</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131101"/>
		<updated>2019-12-07T06:12:19Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /*  IV. Reviewer gets mail when authors resubmit work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system facilitates sending emails to students and instructors on occurrence of various events or helps in taking actions on the events that occur..&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to be  reviewed.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 1: Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' Create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
#Click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' User requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
#Select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
#Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
#Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
*User creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor creates new user by filling sign-up form &lt;br /&gt;
[[File:Instructor create.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Email count should be zero when user requests new account with an invalid email&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Email count should be one when user requests new account with a valid email&lt;br /&gt;
[[File:User request2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Import CSV to add participants to assignment&lt;br /&gt;
[[File:User request3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Import CSV from manage users&lt;br /&gt;
[[File:User request4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;Scenario 2: Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
#No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Capybara Tests ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
#After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 3. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; Scenario 4. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131100</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131100"/>
		<updated>2019-12-07T06:09:28Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* III. Authors get mail on receiving review */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system facilitates sending emails to students and instructors on occurrence of various events or helps in taking actions on the events that occur..&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to be  reviewed.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 1: Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' Create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
#Click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' User requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
#Select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
#Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
#Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
*User creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor creates new user by filling sign-up form &lt;br /&gt;
[[File:Instructor create.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Email count should be zero when user requests new account with an invalid email&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Email count should be one when user requests new account with a valid email&lt;br /&gt;
[[File:User request2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Import CSV to add participants to assignment&lt;br /&gt;
[[File:User request3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Import CSV from manage users&lt;br /&gt;
[[File:User request4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;Scenario 2: Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
#No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Capybara Tests ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
#After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 3. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; IV. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131099</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131099"/>
		<updated>2019-12-07T06:07:58Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* II. Resetting Password */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system facilitates sending emails to students and instructors on occurrence of various events or helps in taking actions on the events that occur..&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to be  reviewed.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 1: Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' Create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
#Click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' User requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
#Select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
#Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
#Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
*User creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor creates new user by filling sign-up form &lt;br /&gt;
[[File:Instructor create.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Email count should be zero when user requests new account with an invalid email&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Email count should be one when user requests new account with a valid email&lt;br /&gt;
[[File:User request2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Import CSV to add participants to assignment&lt;br /&gt;
[[File:User request3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Import CSV from manage users&lt;br /&gt;
[[File:User request4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;Scenario 2: Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
#No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Capybara Tests ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
#After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;III. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; IV. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131091</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131091"/>
		<updated>2019-12-07T05:49:40Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* I. Creating a new user Account */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system facilitates sending emails to students and instructors on occurrence of various events or helps in taking actions on the events that occur..&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to be  reviewed.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Scenario 1: Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;font size = '3'&amp;gt;User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' Create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
#Click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*&amp;lt;font size = '2'&amp;gt;''' User requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
Super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
#Click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
#Select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
#Click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
#Visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
#Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
#Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
#Click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
*User creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Instructor create.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:New_user_assignment.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:New_user_import_file.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;II. Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;III. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; IV. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131072</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131072"/>
		<updated>2019-12-07T05:22:25Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Approach Chosen and Why? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system facilitates sending emails to students and instructors on occurrence of various events or helps in taking actions on the events that occur..&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to be  reviewed.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;I. Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;1. By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;2. By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;3. By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;4. User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''I. create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''II. user requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
user creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Instructor create.PNG|center|border]]&lt;br /&gt;
user creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&lt;br /&gt;
user creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_assignment.JPG|center|border]]&lt;br /&gt;
[[File:New_user_import_file.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;II. Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;III. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; IV. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131069</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131069"/>
		<updated>2019-12-07T05:21:36Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Problem Statement and Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system facilitates sending emails to students and instructors on occurrence of various events or helps in taking actions on the events that occur..&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to be  reviewed.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;I. Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;1. By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;2. By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;3. By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;4. User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''I. create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''II. user requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
user creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
user creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&lt;br /&gt;
user creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_assignment.JPG|center|border]]&lt;br /&gt;
[[File:New_user_import_file.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;II. Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;III. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; IV. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131065</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131065"/>
		<updated>2019-12-07T05:11:30Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;I. Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;1. By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;2. By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;3. By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;4. User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''I. create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''II. user requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
user creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
user creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&lt;br /&gt;
user creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_assignment.JPG|center|border]]&lt;br /&gt;
[[File:New_user_import_file.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;II. Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;III. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; IV. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131064</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131064"/>
		<updated>2019-12-07T05:11:05Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Expertiza Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
'''We have implemented tests for the following scenarios:'''&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;I. Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;1. By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;2. By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;3. By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;4. User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''I. create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''II. user requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
user creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
user creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&lt;br /&gt;
user creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_assignment.JPG|center|border]]&lt;br /&gt;
[[File:New_user_import_file.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;II. Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;III. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; IV. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131045</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=131045"/>
		<updated>2019-12-07T04:56:11Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Author Review */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;1. By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;2. By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;3. By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;4. User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of the email functionality when a new user is created&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;I. create user through instructor filling up the form:&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;II. user requests a new account and account is created upon approval from superadmin&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
user creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
user creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&lt;br /&gt;
user creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_assignment.JPG|center|border]]&lt;br /&gt;
[[File:New_user_import_file.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Authors get mail on receiving review ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== Reviewer gets mail when authors resubmit work ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130978</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130978"/>
		<updated>2019-12-07T04:21:08Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Author Review */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Authors get mail on receiving review ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Reviewer gets mail when authors resubmit work ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested &amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;1. By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;2. By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;3. By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;4. User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
#Create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
# Author receiving email&lt;br /&gt;
#&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130734</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130734"/>
		<updated>2019-12-07T02:10:03Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Outcome */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
#Create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130733</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130733"/>
		<updated>2019-12-07T02:09:21Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Outcome */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130729</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130729"/>
		<updated>2019-12-07T02:07:56Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Cases Tested */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130720</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130720"/>
		<updated>2019-12-07T02:04:39Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Resetting Password */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
#User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
No e-mail should be sent&lt;br /&gt;
&lt;br /&gt;
#User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130717</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130717"/>
		<updated>2019-12-07T02:03:20Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Cases Tested */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
#User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
No e-mail should be sent&lt;br /&gt;
&lt;br /&gt;
#User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130716</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130716"/>
		<updated>2019-12-07T02:02:39Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Cases Tested */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
#user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
No e-mail should be sent&lt;br /&gt;
&lt;br /&gt;
#. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130709</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130709"/>
		<updated>2019-12-07T01:55:50Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Scenario 4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130705</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130705"/>
		<updated>2019-12-07T01:54:58Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130691</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130691"/>
		<updated>2019-12-07T01:47:48Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130684</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130684"/>
		<updated>2019-12-07T01:40:25Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130548</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130548"/>
		<updated>2019-12-07T00:32:24Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Cases Tested */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case (i) and case (ii) mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&amp;lt;br&amp;gt;&lt;br /&gt;
2.&amp;lt;br&amp;gt;&lt;br /&gt;
3.&amp;lt;br&amp;gt;&lt;br /&gt;
4.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130547</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130547"/>
		<updated>2019-12-07T00:31:40Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Cases Tested */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in case i and case ii mentioned above &amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
#no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
# email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&amp;lt;br&amp;gt;&lt;br /&gt;
2.&amp;lt;br&amp;gt;&lt;br /&gt;
3.&amp;lt;br&amp;gt;&lt;br /&gt;
4.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130545</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130545"/>
		<updated>2019-12-07T00:28:08Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Scenario 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Creating a new user Account===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented in 3 different 'scenario blocks'&amp;lt;br&amp;gt;&lt;br /&gt;
#instructor filling up the form&lt;br /&gt;
#User requests account&lt;br /&gt;
# by importing CSV file from user page &lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in scenario i and scenario ii &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&amp;lt;br&amp;gt;&lt;br /&gt;
2.&amp;lt;br&amp;gt;&lt;br /&gt;
3.&amp;lt;br&amp;gt;&lt;br /&gt;
4.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130502</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130502"/>
		<updated>2019-12-07T00:04:11Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 3===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented in 3 different 'scenario blocks'&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in scenario i and scenario ii &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&amp;lt;br&amp;gt;&lt;br /&gt;
2.&amp;lt;br&amp;gt;&lt;br /&gt;
3.&amp;lt;br&amp;gt;&lt;br /&gt;
4.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130498</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130498"/>
		<updated>2019-12-07T00:01:54Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Proposed Approach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 3===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented in 3 different 'scenario blocks'&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in scenario i and scenario ii &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&amp;lt;br&amp;gt;&lt;br /&gt;
2.&amp;lt;br&amp;gt;&lt;br /&gt;
3.&amp;lt;br&amp;gt;&lt;br /&gt;
4.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub&lt;br /&gt;
&lt;br /&gt;
GitHub Pull Request&lt;br /&gt;
&lt;br /&gt;
demo link&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130472</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130472"/>
		<updated>2019-12-06T23:45:37Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Approach Chosen and Why? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of these five scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when put to production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 3===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in scenario i and scenario ii &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&amp;lt;br&amp;gt;&lt;br /&gt;
2.&amp;lt;br&amp;gt;&lt;br /&gt;
3.&amp;lt;br&amp;gt;&lt;br /&gt;
4.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub&lt;br /&gt;
&lt;br /&gt;
GitHub Pull Request&lt;br /&gt;
&lt;br /&gt;
demo link&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130471</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130471"/>
		<updated>2019-12-06T23:44:35Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Approach Chosen and Why? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of these five scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when put to production. We have chosen to bring about this robustness of test i by writing unit test and functional tests using RSpec and Capybara. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 3===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in scenario i and scenario ii &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario ii:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&amp;lt;br&amp;gt;&lt;br /&gt;
2.&amp;lt;br&amp;gt;&lt;br /&gt;
3.&amp;lt;br&amp;gt;&lt;br /&gt;
4.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub&lt;br /&gt;
&lt;br /&gt;
GitHub Pull Request&lt;br /&gt;
&lt;br /&gt;
demo link&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130380</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130380"/>
		<updated>2019-12-06T23:06:51Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 4===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in scenario i and scenario ii &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&lt;br /&gt;
2.&lt;br /&gt;
3.&lt;br /&gt;
4.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Developed By ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub&lt;br /&gt;
&lt;br /&gt;
GitHub Pull Request&lt;br /&gt;
&lt;br /&gt;
demo link&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
'''Automated Testing using Rspec'''&lt;br /&gt;
&lt;br /&gt;
Listed below are a few scenarios we have identified so far, which need to be tested for correct functioning&lt;br /&gt;
&lt;br /&gt;
====Scenario 1: Deadline reminder emails ====&lt;br /&gt;
&lt;br /&gt;
The system continuously monitors upcoming deadlines of assignments. &lt;br /&gt;
If an assignment is configured such that an email reminder must be sent for an approaching deadline, then an email must be sent to all participants of that assignment as scheduled by the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#mail_worker.rb&lt;br /&gt;
#background_email_reminder.rake&lt;br /&gt;
&lt;br /&gt;
Following tests will be performed to verify whether the functionality is working as desired.&lt;br /&gt;
*Check if email notification is being sent to all the participants on the assignment. This can be verified by confirming that the count of emails sent out is equal to the total number of student participants on that assignment&lt;br /&gt;
*Check if the deadline type is correct and relevant&lt;br /&gt;
&lt;br /&gt;
====Scenario 2: Author(s) get emailed when a reviewer has reviewed their work====&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
====Scenario 3: Reviewer gets notified when an author has submitted/resubmitted work ====&lt;br /&gt;
&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever the team or students resubmits their work, all the reviewers assigned to them should get notified. That means number of mails delivered should be equals to the number of reviews assigned to their work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Scenario 4: User gets an account creation notification upon account creation with that email id====&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/mailers/mailer.rb&lt;br /&gt;
#app/helper/mailer_helper.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
#app/models/assignment_participant.rb&lt;br /&gt;
#app/controllers/user_controller.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters must be tested&lt;br /&gt;
*Check if the email is being sent to the same user whose account has been newly created&lt;br /&gt;
*Verify that only one email is being sent for each corresponding new account&lt;br /&gt;
&lt;br /&gt;
====Scenario 5: User gets password reset link, on request for new password====&lt;br /&gt;
&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Following tests can be performed to verify whether the functionality is working as desired.&lt;br /&gt;
When a new user is created :&lt;br /&gt;
 	 &lt;br /&gt;
* Expect mail to be generated and sent to the mail id of the user&lt;br /&gt;
 	 &lt;br /&gt;
* Expect the subject of mail to be &amp;quot;Expertiza password reset&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The link in email body with token generated in send_password can be checked&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''== &lt;br /&gt;
===='''Fixes:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
--the additional fixes--&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===='''Tests:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
The Capybara tests were written to model the interactions of the user on each of the specific scenarios.  Rspec scripts were written to test if the mail has been sent&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== User account creation (Scenario 4) Implementation =====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user through all methods &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====='' '''Password Reset (Scenario 5) Implementation''':''=====&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130379</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130379"/>
		<updated>2019-12-06T23:06:28Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Our Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 4===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in scenario i and scenario ii &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&lt;br /&gt;
2.&lt;br /&gt;
3.&lt;br /&gt;
4.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
-&lt;br /&gt;
-&lt;br /&gt;
-&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub&lt;br /&gt;
&lt;br /&gt;
GitHub Pull Request&lt;br /&gt;
&lt;br /&gt;
demo link&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
'''Automated Testing using Rspec'''&lt;br /&gt;
&lt;br /&gt;
Listed below are a few scenarios we have identified so far, which need to be tested for correct functioning&lt;br /&gt;
&lt;br /&gt;
====Scenario 1: Deadline reminder emails ====&lt;br /&gt;
&lt;br /&gt;
The system continuously monitors upcoming deadlines of assignments. &lt;br /&gt;
If an assignment is configured such that an email reminder must be sent for an approaching deadline, then an email must be sent to all participants of that assignment as scheduled by the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#mail_worker.rb&lt;br /&gt;
#background_email_reminder.rake&lt;br /&gt;
&lt;br /&gt;
Following tests will be performed to verify whether the functionality is working as desired.&lt;br /&gt;
*Check if email notification is being sent to all the participants on the assignment. This can be verified by confirming that the count of emails sent out is equal to the total number of student participants on that assignment&lt;br /&gt;
*Check if the deadline type is correct and relevant&lt;br /&gt;
&lt;br /&gt;
====Scenario 2: Author(s) get emailed when a reviewer has reviewed their work====&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
====Scenario 3: Reviewer gets notified when an author has submitted/resubmitted work ====&lt;br /&gt;
&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever the team or students resubmits their work, all the reviewers assigned to them should get notified. That means number of mails delivered should be equals to the number of reviews assigned to their work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Scenario 4: User gets an account creation notification upon account creation with that email id====&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/mailers/mailer.rb&lt;br /&gt;
#app/helper/mailer_helper.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
#app/models/assignment_participant.rb&lt;br /&gt;
#app/controllers/user_controller.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters must be tested&lt;br /&gt;
*Check if the email is being sent to the same user whose account has been newly created&lt;br /&gt;
*Verify that only one email is being sent for each corresponding new account&lt;br /&gt;
&lt;br /&gt;
====Scenario 5: User gets password reset link, on request for new password====&lt;br /&gt;
&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Following tests can be performed to verify whether the functionality is working as desired.&lt;br /&gt;
When a new user is created :&lt;br /&gt;
 	 &lt;br /&gt;
* Expect mail to be generated and sent to the mail id of the user&lt;br /&gt;
 	 &lt;br /&gt;
* Expect the subject of mail to be &amp;quot;Expertiza password reset&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The link in email body with token generated in send_password can be checked&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''== &lt;br /&gt;
===='''Fixes:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
--the additional fixes--&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===='''Tests:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
The Capybara tests were written to model the interactions of the user on each of the specific scenarios.  Rspec scripts were written to test if the mail has been sent&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== User account creation (Scenario 4) Implementation =====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user through all methods &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====='' '''Password Reset (Scenario 5) Implementation''':''=====&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130376</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130376"/>
		<updated>2019-12-06T23:05:15Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 4===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user in scenario i and scenario ii &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implemented scenario iii  using rspec unit tests: &amp;lt;br&amp;gt;&lt;br /&gt;
1.&lt;br /&gt;
2.&lt;br /&gt;
3.&lt;br /&gt;
4.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
-&lt;br /&gt;
-&lt;br /&gt;
-&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub&lt;br /&gt;
&lt;br /&gt;
GitHub Pull Request&lt;br /&gt;
&lt;br /&gt;
demo link&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
'''Automated Testing using Rspec'''&lt;br /&gt;
&lt;br /&gt;
Listed below are a few scenarios we have identified so far, which need to be tested for correct functioning&lt;br /&gt;
&lt;br /&gt;
====Scenario 1: Deadline reminder emails ====&lt;br /&gt;
&lt;br /&gt;
The system continuously monitors upcoming deadlines of assignments. &lt;br /&gt;
If an assignment is configured such that an email reminder must be sent for an approaching deadline, then an email must be sent to all participants of that assignment as scheduled by the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#mail_worker.rb&lt;br /&gt;
#background_email_reminder.rake&lt;br /&gt;
&lt;br /&gt;
Following tests will be performed to verify whether the functionality is working as desired.&lt;br /&gt;
*Check if email notification is being sent to all the participants on the assignment. This can be verified by confirming that the count of emails sent out is equal to the total number of student participants on that assignment&lt;br /&gt;
*Check if the deadline type is correct and relevant&lt;br /&gt;
&lt;br /&gt;
====Scenario 2: Author(s) get emailed when a reviewer has reviewed their work====&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
====Scenario 3: Reviewer gets notified when an author has submitted/resubmitted work ====&lt;br /&gt;
&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever the team or students resubmits their work, all the reviewers assigned to them should get notified. That means number of mails delivered should be equals to the number of reviews assigned to their work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Scenario 4: User gets an account creation notification upon account creation with that email id====&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/mailers/mailer.rb&lt;br /&gt;
#app/helper/mailer_helper.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
#app/models/assignment_participant.rb&lt;br /&gt;
#app/controllers/user_controller.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters must be tested&lt;br /&gt;
*Check if the email is being sent to the same user whose account has been newly created&lt;br /&gt;
*Verify that only one email is being sent for each corresponding new account&lt;br /&gt;
&lt;br /&gt;
====Scenario 5: User gets password reset link, on request for new password====&lt;br /&gt;
&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Following tests can be performed to verify whether the functionality is working as desired.&lt;br /&gt;
When a new user is created :&lt;br /&gt;
 	 &lt;br /&gt;
* Expect mail to be generated and sent to the mail id of the user&lt;br /&gt;
 	 &lt;br /&gt;
* Expect the subject of mail to be &amp;quot;Expertiza password reset&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The link in email body with token generated in send_password can be checked&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''== &lt;br /&gt;
===='''Fixes:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
--the additional fixes--&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===='''Tests:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
The Capybara tests were written to model the interactions of the user on each of the specific scenarios.  Rspec scripts were written to test if the mail has been sent&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== User account creation (Scenario 4) Implementation =====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user through all methods &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====='' '''Password Reset (Scenario 5) Implementation''':''=====&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Our Team'''==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130374</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130374"/>
		<updated>2019-12-06T23:04:50Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Background and Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 4===&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-- result x test cases passed image --&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
-&lt;br /&gt;
-&lt;br /&gt;
-&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub&lt;br /&gt;
&lt;br /&gt;
GitHub Pull Request&lt;br /&gt;
&lt;br /&gt;
demo link&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
'''Automated Testing using Rspec'''&lt;br /&gt;
&lt;br /&gt;
Listed below are a few scenarios we have identified so far, which need to be tested for correct functioning&lt;br /&gt;
&lt;br /&gt;
====Scenario 1: Deadline reminder emails ====&lt;br /&gt;
&lt;br /&gt;
The system continuously monitors upcoming deadlines of assignments. &lt;br /&gt;
If an assignment is configured such that an email reminder must be sent for an approaching deadline, then an email must be sent to all participants of that assignment as scheduled by the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#mail_worker.rb&lt;br /&gt;
#background_email_reminder.rake&lt;br /&gt;
&lt;br /&gt;
Following tests will be performed to verify whether the functionality is working as desired.&lt;br /&gt;
*Check if email notification is being sent to all the participants on the assignment. This can be verified by confirming that the count of emails sent out is equal to the total number of student participants on that assignment&lt;br /&gt;
*Check if the deadline type is correct and relevant&lt;br /&gt;
&lt;br /&gt;
====Scenario 2: Author(s) get emailed when a reviewer has reviewed their work====&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
====Scenario 3: Reviewer gets notified when an author has submitted/resubmitted work ====&lt;br /&gt;
&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever the team or students resubmits their work, all the reviewers assigned to them should get notified. That means number of mails delivered should be equals to the number of reviews assigned to their work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Scenario 4: User gets an account creation notification upon account creation with that email id====&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/mailers/mailer.rb&lt;br /&gt;
#app/helper/mailer_helper.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
#app/models/assignment_participant.rb&lt;br /&gt;
#app/controllers/user_controller.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters must be tested&lt;br /&gt;
*Check if the email is being sent to the same user whose account has been newly created&lt;br /&gt;
*Verify that only one email is being sent for each corresponding new account&lt;br /&gt;
&lt;br /&gt;
====Scenario 5: User gets password reset link, on request for new password====&lt;br /&gt;
&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Following tests can be performed to verify whether the functionality is working as desired.&lt;br /&gt;
When a new user is created :&lt;br /&gt;
 	 &lt;br /&gt;
* Expect mail to be generated and sent to the mail id of the user&lt;br /&gt;
 	 &lt;br /&gt;
* Expect the subject of mail to be &amp;quot;Expertiza password reset&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The link in email body with token generated in send_password can be checked&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''== &lt;br /&gt;
===='''Fixes:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
--the additional fixes--&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===='''Tests:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
The Capybara tests were written to model the interactions of the user on each of the specific scenarios.  Rspec scripts were written to test if the mail has been sent&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== User account creation (Scenario 4) Implementation =====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user through all methods &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====='' '''Password Reset (Scenario 5) Implementation''':''=====&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Our Team'''==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130347</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130347"/>
		<updated>2019-12-06T22:54:23Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 4===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub&lt;br /&gt;
&lt;br /&gt;
GitHub Pull Request&lt;br /&gt;
&lt;br /&gt;
demo link&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;br /&gt;
&lt;br /&gt;
=='''Background and Problem Statement'''==&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
The target of this project is to develop a complete test-suite for the emailing functionalities across various modules of this system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
'''Automated Testing using Rspec'''&lt;br /&gt;
&lt;br /&gt;
Listed below are a few scenarios we have identified so far, which need to be tested for correct functioning&lt;br /&gt;
&lt;br /&gt;
====Scenario 1: Deadline reminder emails ====&lt;br /&gt;
&lt;br /&gt;
The system continuously monitors upcoming deadlines of assignments. &lt;br /&gt;
If an assignment is configured such that an email reminder must be sent for an approaching deadline, then an email must be sent to all participants of that assignment as scheduled by the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#mail_worker.rb&lt;br /&gt;
#background_email_reminder.rake&lt;br /&gt;
&lt;br /&gt;
Following tests will be performed to verify whether the functionality is working as desired.&lt;br /&gt;
*Check if email notification is being sent to all the participants on the assignment. This can be verified by confirming that the count of emails sent out is equal to the total number of student participants on that assignment&lt;br /&gt;
*Check if the deadline type is correct and relevant&lt;br /&gt;
&lt;br /&gt;
====Scenario 2: Author(s) get emailed when a reviewer has reviewed their work====&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
====Scenario 3: Reviewer gets notified when an author has submitted/resubmitted work ====&lt;br /&gt;
&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever the team or students resubmits their work, all the reviewers assigned to them should get notified. That means number of mails delivered should be equals to the number of reviews assigned to their work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Scenario 4: User gets an account creation notification upon account creation with that email id====&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/mailers/mailer.rb&lt;br /&gt;
#app/helper/mailer_helper.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
#app/models/assignment_participant.rb&lt;br /&gt;
#app/controllers/user_controller.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters must be tested&lt;br /&gt;
*Check if the email is being sent to the same user whose account has been newly created&lt;br /&gt;
*Verify that only one email is being sent for each corresponding new account&lt;br /&gt;
&lt;br /&gt;
====Scenario 5: User gets password reset link, on request for new password====&lt;br /&gt;
&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Following tests can be performed to verify whether the functionality is working as desired.&lt;br /&gt;
When a new user is created :&lt;br /&gt;
 	 &lt;br /&gt;
* Expect mail to be generated and sent to the mail id of the user&lt;br /&gt;
 	 &lt;br /&gt;
* Expect the subject of mail to be &amp;quot;Expertiza password reset&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The link in email body with token generated in send_password can be checked&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''== &lt;br /&gt;
===='''Fixes:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
--the additional fixes--&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===='''Tests:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
The Capybara tests were written to model the interactions of the user on each of the specific scenarios.  Rspec scripts were written to test if the mail has been sent&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== User account creation (Scenario 4) Implementation =====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user through all methods &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====='' '''Password Reset (Scenario 5) Implementation''':''=====&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Our Team'''==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130343</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130343"/>
		<updated>2019-12-06T22:53:38Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Brief Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 4===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
== References ==&lt;br /&gt;
Expertiza on GitHub&lt;br /&gt;
GitHub Pull Request&lt;br /&gt;
demo link&lt;br /&gt;
&lt;br /&gt;
=='''Background and Problem Statement'''==&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
The target of this project is to develop a complete test-suite for the emailing functionalities across various modules of this system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
'''Automated Testing using Rspec'''&lt;br /&gt;
&lt;br /&gt;
Listed below are a few scenarios we have identified so far, which need to be tested for correct functioning&lt;br /&gt;
&lt;br /&gt;
====Scenario 1: Deadline reminder emails ====&lt;br /&gt;
&lt;br /&gt;
The system continuously monitors upcoming deadlines of assignments. &lt;br /&gt;
If an assignment is configured such that an email reminder must be sent for an approaching deadline, then an email must be sent to all participants of that assignment as scheduled by the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#mail_worker.rb&lt;br /&gt;
#background_email_reminder.rake&lt;br /&gt;
&lt;br /&gt;
Following tests will be performed to verify whether the functionality is working as desired.&lt;br /&gt;
*Check if email notification is being sent to all the participants on the assignment. This can be verified by confirming that the count of emails sent out is equal to the total number of student participants on that assignment&lt;br /&gt;
*Check if the deadline type is correct and relevant&lt;br /&gt;
&lt;br /&gt;
====Scenario 2: Author(s) get emailed when a reviewer has reviewed their work====&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
====Scenario 3: Reviewer gets notified when an author has submitted/resubmitted work ====&lt;br /&gt;
&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever the team or students resubmits their work, all the reviewers assigned to them should get notified. That means number of mails delivered should be equals to the number of reviews assigned to their work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Scenario 4: User gets an account creation notification upon account creation with that email id====&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/mailers/mailer.rb&lt;br /&gt;
#app/helper/mailer_helper.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
#app/models/assignment_participant.rb&lt;br /&gt;
#app/controllers/user_controller.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters must be tested&lt;br /&gt;
*Check if the email is being sent to the same user whose account has been newly created&lt;br /&gt;
*Verify that only one email is being sent for each corresponding new account&lt;br /&gt;
&lt;br /&gt;
====Scenario 5: User gets password reset link, on request for new password====&lt;br /&gt;
&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Following tests can be performed to verify whether the functionality is working as desired.&lt;br /&gt;
When a new user is created :&lt;br /&gt;
 	 &lt;br /&gt;
* Expect mail to be generated and sent to the mail id of the user&lt;br /&gt;
 	 &lt;br /&gt;
* Expect the subject of mail to be &amp;quot;Expertiza password reset&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The link in email body with token generated in send_password can be checked&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''== &lt;br /&gt;
===='''Fixes:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
--the additional fixes--&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===='''Tests:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
The Capybara tests were written to model the interactions of the user on each of the specific scenarios.  Rspec scripts were written to test if the mail has been sent&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== User account creation (Scenario 4) Implementation =====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user through all methods &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====='' '''Password Reset (Scenario 5) Implementation''':''=====&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Our Team'''==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130328</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130328"/>
		<updated>2019-12-06T22:47:58Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 2 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 4===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
== Team ==&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Brief Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Some scenarios where email notifications are sent out are listed below:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background and Problem Statement'''==&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
The target of this project is to develop a complete test-suite for the emailing functionalities across various modules of this system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
'''Automated Testing using Rspec'''&lt;br /&gt;
&lt;br /&gt;
Listed below are a few scenarios we have identified so far, which need to be tested for correct functioning&lt;br /&gt;
&lt;br /&gt;
====Scenario 1: Deadline reminder emails ====&lt;br /&gt;
&lt;br /&gt;
The system continuously monitors upcoming deadlines of assignments. &lt;br /&gt;
If an assignment is configured such that an email reminder must be sent for an approaching deadline, then an email must be sent to all participants of that assignment as scheduled by the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#mail_worker.rb&lt;br /&gt;
#background_email_reminder.rake&lt;br /&gt;
&lt;br /&gt;
Following tests will be performed to verify whether the functionality is working as desired.&lt;br /&gt;
*Check if email notification is being sent to all the participants on the assignment. This can be verified by confirming that the count of emails sent out is equal to the total number of student participants on that assignment&lt;br /&gt;
*Check if the deadline type is correct and relevant&lt;br /&gt;
&lt;br /&gt;
====Scenario 2: Author(s) get emailed when a reviewer has reviewed their work====&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
====Scenario 3: Reviewer gets notified when an author has submitted/resubmitted work ====&lt;br /&gt;
&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever the team or students resubmits their work, all the reviewers assigned to them should get notified. That means number of mails delivered should be equals to the number of reviews assigned to their work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Scenario 4: User gets an account creation notification upon account creation with that email id====&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/mailers/mailer.rb&lt;br /&gt;
#app/helper/mailer_helper.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
#app/models/assignment_participant.rb&lt;br /&gt;
#app/controllers/user_controller.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters must be tested&lt;br /&gt;
*Check if the email is being sent to the same user whose account has been newly created&lt;br /&gt;
*Verify that only one email is being sent for each corresponding new account&lt;br /&gt;
&lt;br /&gt;
====Scenario 5: User gets password reset link, on request for new password====&lt;br /&gt;
&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Following tests can be performed to verify whether the functionality is working as desired.&lt;br /&gt;
When a new user is created :&lt;br /&gt;
 	 &lt;br /&gt;
* Expect mail to be generated and sent to the mail id of the user&lt;br /&gt;
 	 &lt;br /&gt;
* Expect the subject of mail to be &amp;quot;Expertiza password reset&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The link in email body with token generated in send_password can be checked&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''== &lt;br /&gt;
===='''Fixes:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
--the additional fixes--&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===='''Tests:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
The Capybara tests were written to model the interactions of the user on each of the specific scenarios.  Rspec scripts were written to test if the mail has been sent&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== User account creation (Scenario 4) Implementation =====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user through all methods &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====='' '''Password Reset (Scenario 5) Implementation''':''=====&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Our Team'''==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130302</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=130302"/>
		<updated>2019-12-06T22:23:59Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Scenario 1 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
 === Scenario 2 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 4===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
== Fixing out of scope bugs&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
== Team ==&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Brief Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Some scenarios where email notifications are sent out are listed below:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background and Problem Statement'''==&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
The target of this project is to develop a complete test-suite for the emailing functionalities across various modules of this system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
'''Automated Testing using Rspec'''&lt;br /&gt;
&lt;br /&gt;
Listed below are a few scenarios we have identified so far, which need to be tested for correct functioning&lt;br /&gt;
&lt;br /&gt;
====Scenario 1: Deadline reminder emails ====&lt;br /&gt;
&lt;br /&gt;
The system continuously monitors upcoming deadlines of assignments. &lt;br /&gt;
If an assignment is configured such that an email reminder must be sent for an approaching deadline, then an email must be sent to all participants of that assignment as scheduled by the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#mail_worker.rb&lt;br /&gt;
#background_email_reminder.rake&lt;br /&gt;
&lt;br /&gt;
Following tests will be performed to verify whether the functionality is working as desired.&lt;br /&gt;
*Check if email notification is being sent to all the participants on the assignment. This can be verified by confirming that the count of emails sent out is equal to the total number of student participants on that assignment&lt;br /&gt;
*Check if the deadline type is correct and relevant&lt;br /&gt;
&lt;br /&gt;
====Scenario 2: Author(s) get emailed when a reviewer has reviewed their work====&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
====Scenario 3: Reviewer gets notified when an author has submitted/resubmitted work ====&lt;br /&gt;
&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever the team or students resubmits their work, all the reviewers assigned to them should get notified. That means number of mails delivered should be equals to the number of reviews assigned to their work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Scenario 4: User gets an account creation notification upon account creation with that email id====&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/mailers/mailer.rb&lt;br /&gt;
#app/helper/mailer_helper.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
#app/models/assignment_participant.rb&lt;br /&gt;
#app/controllers/user_controller.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters must be tested&lt;br /&gt;
*Check if the email is being sent to the same user whose account has been newly created&lt;br /&gt;
*Verify that only one email is being sent for each corresponding new account&lt;br /&gt;
&lt;br /&gt;
====Scenario 5: User gets password reset link, on request for new password====&lt;br /&gt;
&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Following tests can be performed to verify whether the functionality is working as desired.&lt;br /&gt;
When a new user is created :&lt;br /&gt;
 	 &lt;br /&gt;
* Expect mail to be generated and sent to the mail id of the user&lt;br /&gt;
 	 &lt;br /&gt;
* Expect the subject of mail to be &amp;quot;Expertiza password reset&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The link in email body with token generated in send_password can be checked&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
*  162 issues resolved&lt;br /&gt;
*  42 Files changed&lt;br /&gt;
*  215 additions&lt;br /&gt;
*  163 Deletions&lt;br /&gt;
*  Travis CI build passed&lt;br /&gt;
*  No merge conflicts&lt;br /&gt;
*  coveralls : &lt;br /&gt;
        *  Coverage increased (+10.1%) to 50.97%.&lt;br /&gt;
*  codeclimate bot&lt;br /&gt;
        * Code Climate has analyzed commit 050fa7d and detected 0 issues on this pull request.&lt;br /&gt;
        * The test coverage on the diff in this pull request is 42.3% (50% is the threshold).&lt;br /&gt;
        * This pull request will bring the total coverage in the repository to 29.0% (-21.9% change).&lt;br /&gt;
*  travis-ci&lt;br /&gt;
        * Your changes look good to me! tada&lt;br /&gt;
        * The Travis CI build passed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''== &lt;br /&gt;
===='''Fixes:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
--the additional fixes--&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===='''Tests:'''&amp;lt;br&amp;gt;====&lt;br /&gt;
The Capybara tests were written to model the interactions of the user on each of the specific scenarios.  Rspec scripts were written to test if the mail has been sent&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== User account creation (Scenario 4) Implementation =====&lt;br /&gt;
There are 3 ways in which user can be created, which are implemented as 3 different scenarios&amp;lt;br&amp;gt;&lt;br /&gt;
i) instructor filling up the form&amp;lt;br&amp;gt;ii) User requests account&amp;lt;br&amp;gt;iii) by importing CSV file from user page  :&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following features were checked as part of user creating user through all methods &amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2.  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3.  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We considered the following cases as it blocks while testing specific to scenario 2:&amp;lt;br&amp;gt;&lt;br /&gt;
1. no email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
2. super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
3. email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
4. email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
i) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
ii) create user through instructor filling up the form:&amp;lt;br&amp;gt;&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====='' '''Password Reset (Scenario 5) Implementation''':''=====&lt;br /&gt;
The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
1. Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
2. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
3. Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
4. The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The following cases were considered as 'context blocks' while testing the mailer function when user requests for password:&amp;lt;br&amp;gt;&lt;br /&gt;
1. user enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
2. user enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. after rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Our Team'''==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=129421</id>
		<title>CSC/ECE 517 Fall 2019 - E1995. Tests for email functionality</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1995._Tests_for_email_functionality&amp;diff=129421"/>
		<updated>2019-11-16T01:21:08Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Our Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=='''Brief Introduction'''==&lt;br /&gt;
&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Some scenarios where email notifications are sent out are listed below:&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
#An instructor may configure a setting for an assignment where an email is sent to all the participants to remind them of an upcoming deadline.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Background and Problem Statement'''==&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
The target of this project is to develop a complete test-suite for the emailing functionalities across various modules of this system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Approach'''==&lt;br /&gt;
&lt;br /&gt;
We propose to reach our goal in increments of the steps listed below:&lt;br /&gt;
&lt;br /&gt;
*Identify the various scenarios where email functionality is being called&lt;br /&gt;
*Check if the email functionality is presently working for each scenario&lt;br /&gt;
*Ensure necessary parameters are being passed and received &lt;br /&gt;
*Verify if email is being sent out to correct recipient&lt;br /&gt;
*Check if email is being sent out when expected to (some functionalities require the email to be sent real-time, as a trigger on an action while some require to monitor activity/follow a pre-defined schedule)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On having fair idea of the all of the above, we aim on building test cases that will perform all these checks automatically, in real time and also test how well these work in conjunction with all other parts of the application as a whole.&lt;br /&gt;
&lt;br /&gt;
The proposed test-suite is a combination of unit tests and integration tests that will check the control flow and correctness concerning emails within the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
'''Automated Testing using Rspec'''&lt;br /&gt;
&lt;br /&gt;
Listed below are a few scenarios we have identified so far, which need to be tested for correct functioning&lt;br /&gt;
&lt;br /&gt;
====Scenario 1: Deadline reminder emails ====&lt;br /&gt;
&lt;br /&gt;
The system continuously monitors upcoming deadlines of assignments. &lt;br /&gt;
If an assignment is configured such that an email reminder must be sent for an approaching deadline, then an email must be sent to all participants of that assignment as scheduled by the instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#mail_worker.rb&lt;br /&gt;
#background_email_reminder.rake&lt;br /&gt;
&lt;br /&gt;
Following tests will be performed to verify whether the functionality is working as desired.&lt;br /&gt;
*Check if email notification is being sent to all the participants on the assignment. This can be verified by confirming that the count of emails sent out is equal to the total number of student participants on that assignment&lt;br /&gt;
*Check if the deadline type is correct and relevant&lt;br /&gt;
&lt;br /&gt;
====Scenario 2: Author(s) get emailed when a reviewer has reviewed their work====&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
====Scenario 3: Reviewer gets notified when an author has submitted/resubmitted work ====&lt;br /&gt;
&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever the team or students resubmits their work, all the reviewers assigned to them should get notified. That means number of mails delivered should be equals to the number of reviews assigned to their work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Scenario 4: User gets an account creation notification upon account creation with that email id====&lt;br /&gt;
&lt;br /&gt;
There are many ways to create new user account in Expertiza. Irrespective of the method of creating user, that user should get notified via email whenever an account is created stating this is your username and will also provide randomized password to allow them to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
1. Instructor can add users to the system by filling the sign-up form for user.&lt;br /&gt;
&lt;br /&gt;
2. Instructor can also import CSV file containing the user information to add user to the system.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Instructor can add user as the participant of the assignment by importing details through CSV file. While doing that, if there are any user credentials present in the CSV file but is not registered in the system, then in that case new user account will be created.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. There is also way to request user account without any help of the instructor. In that case, actual account will not be created but the details will be stored in the requested users table. Whenever instructor authorizes the requested user, actual user account will be created, and the user of that account should receive email notification stating your account request has been approved. &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/mailers/mailer.rb&lt;br /&gt;
#app/helper/mailer_helper.rb&lt;br /&gt;
#app/models/user.rb&lt;br /&gt;
#app/models/assignment_participant.rb&lt;br /&gt;
#app/controllers/user_controller.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters must be tested&lt;br /&gt;
*Check if the email is being sent to the same user whose account has been newly created&lt;br /&gt;
*Verify that only one email is being sent for each corresponding new account&lt;br /&gt;
&lt;br /&gt;
====Scenario 5: User gets password reset link, on request for new password====&lt;br /&gt;
&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Following tests can be performed to verify whether the functionality is working as desired.&lt;br /&gt;
When a new user is created :&lt;br /&gt;
 	 &lt;br /&gt;
* Expect mail to be generated and sent to the mail id of the user&lt;br /&gt;
 	 &lt;br /&gt;
* Expect the subject of mail to be &amp;quot;Expertiza password reset&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The link in email body with token generated in send_password can be checked&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Our Team'''==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Quick Links'''==&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127909</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127909"/>
		<updated>2019-11-07T03:20:30Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Bugs that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design and Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for creating a new bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     ....&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    ....&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     ....&lt;br /&gt;
     # validates if the url provided is of a valid format&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     ....&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/models/bookmark_rating.rb&lt;br /&gt;
   &lt;br /&gt;
    # Calculates the rating of a bookmark when review type is a rubric and not a dropdown&lt;br /&gt;
   def average_based_on_rubric(bookmark)&lt;br /&gt;
       if bookmark.nil?&lt;br /&gt;
          0&lt;br /&gt;
       else&lt;br /&gt;
          assignment = SignUpTopic.find(bookmark.topic_id).assignment&lt;br /&gt;
          questions = assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire').flat_map(&amp;amp;:questions)&lt;br /&gt;
          responses = BookmarkRatingResponseMap.where(&lt;br /&gt;
              reviewed_object_id: assignment.id,&lt;br /&gt;
              reviewee_id: bookmark.id&lt;br /&gt;
          ).flat_map {|r| Response.where(map_id: r.id) }&lt;br /&gt;
          scores = Answer.compute_scores(responses, questions)&lt;br /&gt;
          if scores[:avg].nil?&lt;br /&gt;
            0&lt;br /&gt;
           else&lt;br /&gt;
            (scores[:avg] * 5.0 / 100.0).round(2)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
   &lt;br /&gt;
   # fetches the previously added responses to rate a bookmark   &lt;br /&gt;
   def self.get_bookmark_rating_response_map(bookmark, current_user)&lt;br /&gt;
      BookmarkRatingResponseMap.find_by(&lt;br /&gt;
          reviewed_object_id: SignUpTopic.find(bookmark.topic_id).assignment.id,&lt;br /&gt;
          reviewer_id: AssignmentParticipant.find_by(user_id: current_user.id).id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
       ....&lt;br /&gt;
            &amp;lt;td&amp;gt;&amp;lt;a href=&amp;lt;%= &amp;quot;http://#{bookmark.url}&amp;quot;%&amp;gt; target='_blank'&amp;gt;&amp;lt;%=bookmark.title %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;!--Set maximum length of bookmark description and keep description in one line.--&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;%=truncate(bookmark.description, length: 100) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;!--Average rating score--&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings = BookmarkRating.where(bookmark_id: bookmark.id) %&amp;gt;&lt;br /&gt;
        &amp;lt;!--Self rated bookmark should not be counted in average rating.--&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings.to_a.reject! {|bookmark_rating| bookmark_rating.user_id == Bookmark.find(bookmark_rating.bookmark_id).user_id} %&amp;gt;&lt;br /&gt;
        &amp;lt;% sum = 0 %&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings.each do |bookmark_rating| %&amp;gt;&lt;br /&gt;
          &amp;lt;% sum += bookmark_rating.rating %&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
          &amp;lt;% if has_dropdown?(@topic) %&amp;gt;&lt;br /&gt;
            &amp;lt;% if @bookmark_ratings.size &amp;gt; 0 %&amp;gt;&lt;br /&gt;
              &amp;lt;%= (sum * 1.0 / @bookmark_ratings.size).round(1) %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;%= '-' %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;% else %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Compute average rating based on rubrics --&amp;gt;&lt;br /&gt;
            &amp;lt;% avg = BookmarkRating.average_based_on_rubric(bookmark) %&amp;gt;&lt;br /&gt;
            &amp;lt;%= avg == 0 ? '-' : avg %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
         &amp;lt;!-- Only allow to rate a bookmark which is not uploaded by the current user --&amp;gt;&lt;br /&gt;
          &amp;lt;% if bookmark.user.id != current_user.id %&amp;gt;&lt;br /&gt;
            &amp;lt;% if has_dropdown?(@topic) %&amp;gt;&lt;br /&gt;
              &amp;lt;% if BookmarkRating.exists?(bookmark_id: bookmark.id, user_id: session[:user].id) %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.rating.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = &amp;quot;0&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;%= form_tag :action =&amp;gt; &amp;quot;save_bookmark_rating_score&amp;quot;, :id =&amp;gt; bookmark.id do %&amp;gt;&lt;br /&gt;
                &amp;lt;% params[:rating] = rating %&amp;gt;&lt;br /&gt;
                &amp;lt;select id=&amp;lt;%= bookmark.id %&amp;gt; name=&amp;quot;rating&amp;quot; style=&amp;quot;font-size: 10px&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;% (0..5).each do |i| %&amp;gt;&lt;br /&gt;
                    &amp;lt;option value=&amp;lt;%= i.to_s %&amp;gt;&lt;br /&gt;
                              &amp;lt;% if params[:rating] == i.to_s %&amp;gt;&lt;br /&gt;
                                selected&lt;br /&gt;
                       &amp;lt;% end %&amp;gt;&lt;br /&gt;
                     &amp;gt;&lt;br /&gt;
                       &amp;lt;%= i.to_s %&amp;gt;&lt;br /&gt;
                     &amp;lt;/option&amp;gt;&lt;br /&gt;
                  &amp;lt;% end %&amp;gt;&lt;br /&gt;
                &amp;lt;/select&amp;gt;&lt;br /&gt;
                &amp;lt;% if BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.blank? %&amp;gt;&lt;br /&gt;
                  &amp;lt;%= button_tag &amp;quot;Rate&amp;quot;, {:id=&amp;gt;'button'+bookmark.id.to_s,:style=&amp;gt;&amp;quot;font-size:10px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
                &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;%= button_tag &amp;quot;Update&amp;quot;, {:id=&amp;gt;'button'+bookmark.id.to_s,:style=&amp;gt;&amp;quot;font-size:10px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- This will be used to show the rubric --&amp;gt;&lt;br /&gt;
              &amp;lt;% bookmark_rating_response_map = BookmarkRating.get_bookmark_rating_response_map(bookmark, current_user) %&amp;gt;&lt;br /&gt;
              &amp;lt;% if bookmark_rating_response_map.nil? || bookmark_rating_response_map.response.size == 0 %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;Begin&amp;quot;, :action =&amp;gt; &amp;quot;new_bookmark_review&amp;quot;, :id =&amp;gt; bookmark.id %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;View&amp;quot;, view_response_index_path(id: bookmark_rating_response_map.response.first.response_id) %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;Edit&amp;quot;, edit_response_path(id: bookmark_rating_response_map.response.first.response_id, return: 'bookmark') %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;% if bookmark.user_id == session[:user].id %&amp;gt;&lt;br /&gt;
          &amp;lt;td&amp;gt;&amp;lt;%= link_to 'Edit', :action =&amp;gt; 'edit', :id =&amp;gt; bookmark.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;td&amp;gt;&amp;lt;%= link_to 'Destroy', bookmark, :confirm =&amp;gt; &amp;quot;Delete bookmark \&amp;quot;#{bookmark.title}\&amp;quot;?&amp;quot;, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
           ....&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
# method to check if a dropdown is used for rating bookmarks&lt;br /&gt;
   def has_dropdown?(topic)&lt;br /&gt;
     bookmark_rating_questionnaire = topic.assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire')&lt;br /&gt;
     if bookmark_rating_questionnaire[0].nil?&lt;br /&gt;
       true&lt;br /&gt;
     else&lt;br /&gt;
       false&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
    &lt;br /&gt;
    ..... &lt;br /&gt;
    # Saves the responses to the bookmark review questionnaire.&lt;br /&gt;
    # If a previous response exists it updates it.&lt;br /&gt;
    def new_bookmark_review&lt;br /&gt;
        bookmark = Bookmark.find(params[:id])&lt;br /&gt;
        topic = SignUpTopic.find(bookmark.topic_id)&lt;br /&gt;
        assignment_participant = AssignmentParticipant.find_by(user_id: current_user.id)&lt;br /&gt;
        response_map = BookmarkRatingResponseMap.where(&lt;br /&gt;
          reviewed_object_id: topic.assignment.id,&lt;br /&gt;
          reviewer_id: assignment_participant.id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        ).first&lt;br /&gt;
        if response_map.nil?&lt;br /&gt;
          response_map = BookmarkRatingResponseMap.create(&lt;br /&gt;
            reviewed_object_id: topic.assignment.id,&lt;br /&gt;
            reviewer_id: assignment_participant.id,&lt;br /&gt;
            reviewee_id: bookmark.id&lt;br /&gt;
          )&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to new_response_url(id: response_map.id, return: 'bookmark')&lt;br /&gt;
      end&lt;br /&gt;
      .....&lt;br /&gt;
&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': When 'Bookmark Rating' is 'None', the error the error 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' is out of scope of the current project and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
Rspec testing videos can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/open?id=1KY2WNfuQB9U99FYhqUE15dnnKDFgTCwb here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
* Giving credit to the author of the bookmark for his contribution&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127385</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127385"/>
		<updated>2019-11-06T21:05:29Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Future Scope */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Bugs that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design and Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for creating a new bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     ....&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    ....&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     ....&lt;br /&gt;
     # validates if the url provided is of a valid format&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     ....&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/models/bookmark_rating.rb&lt;br /&gt;
   &lt;br /&gt;
    # Calculates the rating of a bookmark when review type is a rubric and not a dropdown&lt;br /&gt;
   def average_based_on_rubric(bookmark)&lt;br /&gt;
       if bookmark.nil?&lt;br /&gt;
          0&lt;br /&gt;
       else&lt;br /&gt;
          assignment = SignUpTopic.find(bookmark.topic_id).assignment&lt;br /&gt;
          questions = assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire').flat_map(&amp;amp;:questions)&lt;br /&gt;
          responses = BookmarkRatingResponseMap.where(&lt;br /&gt;
              reviewed_object_id: assignment.id,&lt;br /&gt;
              reviewee_id: bookmark.id&lt;br /&gt;
          ).flat_map {|r| Response.where(map_id: r.id) }&lt;br /&gt;
          scores = Answer.compute_scores(responses, questions)&lt;br /&gt;
          if scores[:avg].nil?&lt;br /&gt;
            0&lt;br /&gt;
           else&lt;br /&gt;
            (scores[:avg] * 5.0 / 100.0).round(2)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
   &lt;br /&gt;
   # fetches the previously added responses to rate a bookmark   &lt;br /&gt;
   def self.get_bookmark_rating_response_map(bookmark, current_user)&lt;br /&gt;
      BookmarkRatingResponseMap.find_by(&lt;br /&gt;
          reviewed_object_id: SignUpTopic.find(bookmark.topic_id).assignment.id,&lt;br /&gt;
          reviewer_id: AssignmentParticipant.find_by(user_id: current_user.id).id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
       ....&lt;br /&gt;
            &amp;lt;td&amp;gt;&amp;lt;a href=&amp;lt;%= &amp;quot;http://#{bookmark.url}&amp;quot;%&amp;gt; target='_blank'&amp;gt;&amp;lt;%=bookmark.title %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;!--Set maximum length of bookmark description and keep description in one line.--&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;%=truncate(bookmark.description, length: 100) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;!--Average rating score--&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings = BookmarkRating.where(bookmark_id: bookmark.id) %&amp;gt;&lt;br /&gt;
        &amp;lt;!--Self rated bookmark should not be counted in average rating.--&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings.to_a.reject! {|bookmark_rating| bookmark_rating.user_id == Bookmark.find(bookmark_rating.bookmark_id).user_id} %&amp;gt;&lt;br /&gt;
        &amp;lt;% sum = 0 %&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings.each do |bookmark_rating| %&amp;gt;&lt;br /&gt;
          &amp;lt;% sum += bookmark_rating.rating %&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
          &amp;lt;% if BookmarkRatingQuestionnaire.has_dropdown?(@topic) %&amp;gt;&lt;br /&gt;
            &amp;lt;% if @bookmark_ratings.size &amp;gt; 0 %&amp;gt;&lt;br /&gt;
              &amp;lt;%= (sum * 1.0 / @bookmark_ratings.size).round(1) %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;%= '-' %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;% else %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Compute average rating based on rubrics --&amp;gt;&lt;br /&gt;
            &amp;lt;% avg = BookmarkRating.average_based_on_rubric(bookmark) %&amp;gt;&lt;br /&gt;
            &amp;lt;%= avg == 0 ? '-' : avg %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
         &amp;lt;!-- Only allow to rate a bookmark which is not uploaded by the current user --&amp;gt;&lt;br /&gt;
          &amp;lt;% if bookmark.user.id != current_user.id %&amp;gt;&lt;br /&gt;
            &amp;lt;% if BookmarkRatingQuestionnaire.has_dropdown?(@topic) %&amp;gt;&lt;br /&gt;
              &amp;lt;% if BookmarkRating.exists?(bookmark_id: bookmark.id, user_id: session[:user].id) %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.rating.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = &amp;quot;0&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;%= form_tag :action =&amp;gt; &amp;quot;save_bookmark_rating_score&amp;quot;, :id =&amp;gt; bookmark.id do %&amp;gt;&lt;br /&gt;
                &amp;lt;% params[:rating] = rating %&amp;gt;&lt;br /&gt;
                &amp;lt;select id=&amp;lt;%= bookmark.id %&amp;gt; name=&amp;quot;rating&amp;quot; style=&amp;quot;font-size: 10px&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;% (0..5).each do |i| %&amp;gt;&lt;br /&gt;
                    &amp;lt;option value=&amp;lt;%= i.to_s %&amp;gt;&lt;br /&gt;
                              &amp;lt;% if params[:rating] == i.to_s %&amp;gt;&lt;br /&gt;
                                selected&lt;br /&gt;
                       &amp;lt;% end %&amp;gt;&lt;br /&gt;
                     &amp;gt;&lt;br /&gt;
                       &amp;lt;%= i.to_s %&amp;gt;&lt;br /&gt;
                     &amp;lt;/option&amp;gt;&lt;br /&gt;
                  &amp;lt;% end %&amp;gt;&lt;br /&gt;
                &amp;lt;/select&amp;gt;&lt;br /&gt;
                &amp;lt;% if BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.blank? %&amp;gt;&lt;br /&gt;
                  &amp;lt;%= button_tag &amp;quot;Rate&amp;quot;, {:id=&amp;gt;'button'+bookmark.id.to_s,:style=&amp;gt;&amp;quot;font-size:10px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
                &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;%= button_tag &amp;quot;Update&amp;quot;, {:id=&amp;gt;'button'+bookmark.id.to_s,:style=&amp;gt;&amp;quot;font-size:10px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- This will be used to show the rubric --&amp;gt;&lt;br /&gt;
              &amp;lt;% bookmark_rating_response_map = BookmarkRating.get_bookmark_rating_response_map(bookmark, current_user) %&amp;gt;&lt;br /&gt;
              &amp;lt;% if bookmark_rating_response_map.nil? || bookmark_rating_response_map.response.size == 0 %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;Begin&amp;quot;, :action =&amp;gt; &amp;quot;new_bookmark_review&amp;quot;, :id =&amp;gt; bookmark.id %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;View&amp;quot;, view_response_index_path(id: bookmark_rating_response_map.response.first.response_id) %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;Edit&amp;quot;, edit_response_path(id: bookmark_rating_response_map.response.first.response_id, return: 'bookmark') %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;% if bookmark.user_id == session[:user].id %&amp;gt;&lt;br /&gt;
          &amp;lt;td&amp;gt;&amp;lt;%= link_to 'Edit', :action =&amp;gt; 'edit', :id =&amp;gt; bookmark.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;td&amp;gt;&amp;lt;%= link_to 'Destroy', bookmark, :confirm =&amp;gt; &amp;quot;Delete bookmark \&amp;quot;#{bookmark.title}\&amp;quot;?&amp;quot;, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
           ....&lt;br /&gt;
:app/models/bookmark_rating_questionnaire.rb&lt;br /&gt;
# method to check if a dropdown is used for rating bookmarks&lt;br /&gt;
      def self.has_dropdown?(topic)&lt;br /&gt;
        bookmark_rating_questionnaire = topic.assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire')&lt;br /&gt;
        if bookmark_rating_questionnaire[0].nil?&lt;br /&gt;
          true&lt;br /&gt;
        else&lt;br /&gt;
          false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
    &lt;br /&gt;
    ..... &lt;br /&gt;
    # Saves the responses to the bookmark review questionnaire.&lt;br /&gt;
    # If a previous response exists it updates it.&lt;br /&gt;
    def new_bookmark_review&lt;br /&gt;
        bookmark = Bookmark.find(params[:id])&lt;br /&gt;
        topic = SignUpTopic.find(bookmark.topic_id)&lt;br /&gt;
        assignment_participant = AssignmentParticipant.find_by(user_id: current_user.id)&lt;br /&gt;
        response_map = BookmarkRatingResponseMap.where(&lt;br /&gt;
          reviewed_object_id: topic.assignment.id,&lt;br /&gt;
          reviewer_id: assignment_participant.id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        ).first&lt;br /&gt;
        if response_map.nil?&lt;br /&gt;
          response_map = BookmarkRatingResponseMap.create(&lt;br /&gt;
            reviewed_object_id: topic.assignment.id,&lt;br /&gt;
            reviewer_id: assignment_participant.id,&lt;br /&gt;
            reviewee_id: bookmark.id&lt;br /&gt;
          )&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to new_response_url(id: response_map.id, return: 'bookmark')&lt;br /&gt;
      end&lt;br /&gt;
      .....&lt;br /&gt;
&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': When 'Bookmark Rating' is 'None', the error the error 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' is out of scope of the current project and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
*&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127356</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127356"/>
		<updated>2019-11-06T20:22:56Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Design and Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Bugs that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design and Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for creating a new bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     ....&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    ....&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     ....&lt;br /&gt;
     # validates if the url provided is of a valid format&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     ....&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/models/bookmark_rating.rb&lt;br /&gt;
   &lt;br /&gt;
    # Calculates the rating of a bookmark when review type is a rubric and not a dropdown&lt;br /&gt;
   def average_based_on_rubric(bookmark)&lt;br /&gt;
       if bookmark.nil?&lt;br /&gt;
          0&lt;br /&gt;
       else&lt;br /&gt;
          assignment = SignUpTopic.find(bookmark.topic_id).assignment&lt;br /&gt;
          questions = assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire').flat_map(&amp;amp;:questions)&lt;br /&gt;
          responses = BookmarkRatingResponseMap.where(&lt;br /&gt;
              reviewed_object_id: assignment.id,&lt;br /&gt;
              reviewee_id: bookmark.id&lt;br /&gt;
          ).flat_map {|r| Response.where(map_id: r.id) }&lt;br /&gt;
          scores = Answer.compute_scores(responses, questions)&lt;br /&gt;
          if scores[:avg].nil?&lt;br /&gt;
            0&lt;br /&gt;
           else&lt;br /&gt;
            (scores[:avg] * 5.0 / 100.0).round(2)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
   &lt;br /&gt;
   # fetches the previously added responses to rate a bookmark   &lt;br /&gt;
   def self.get_bookmark_rating_response_map(bookmark, current_user)&lt;br /&gt;
      BookmarkRatingResponseMap.find_by(&lt;br /&gt;
          reviewed_object_id: SignUpTopic.find(bookmark.topic_id).assignment.id,&lt;br /&gt;
          reviewer_id: AssignmentParticipant.find_by(user_id: current_user.id).id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
       ....&lt;br /&gt;
            &amp;lt;td&amp;gt;&amp;lt;a href=&amp;lt;%= &amp;quot;http://#{bookmark.url}&amp;quot;%&amp;gt; target='_blank'&amp;gt;&amp;lt;%=bookmark.title %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;!--Set maximum length of bookmark description and keep description in one line.--&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;%=truncate(bookmark.description, length: 100) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;!--Average rating score--&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings = BookmarkRating.where(bookmark_id: bookmark.id) %&amp;gt;&lt;br /&gt;
        &amp;lt;!--Self rated bookmark should not be counted in average rating.--&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings.to_a.reject! {|bookmark_rating| bookmark_rating.user_id == Bookmark.find(bookmark_rating.bookmark_id).user_id} %&amp;gt;&lt;br /&gt;
        &amp;lt;% sum = 0 %&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings.each do |bookmark_rating| %&amp;gt;&lt;br /&gt;
          &amp;lt;% sum += bookmark_rating.rating %&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
          &amp;lt;% if BookmarkRatingQuestionnaire.has_dropdown?(@topic) %&amp;gt;&lt;br /&gt;
            &amp;lt;% if @bookmark_ratings.size &amp;gt; 0 %&amp;gt;&lt;br /&gt;
              &amp;lt;%= (sum * 1.0 / @bookmark_ratings.size).round(1) %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;%= '-' %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;% else %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Compute average rating based on rubrics --&amp;gt;&lt;br /&gt;
            &amp;lt;% avg = BookmarkRating.average_based_on_rubric(bookmark) %&amp;gt;&lt;br /&gt;
            &amp;lt;%= avg == 0 ? '-' : avg %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
         &amp;lt;!-- Only allow to rate a bookmark which is not uploaded by the current user --&amp;gt;&lt;br /&gt;
          &amp;lt;% if bookmark.user.id != current_user.id %&amp;gt;&lt;br /&gt;
            &amp;lt;% if BookmarkRatingQuestionnaire.has_dropdown?(@topic) %&amp;gt;&lt;br /&gt;
              &amp;lt;% if BookmarkRating.exists?(bookmark_id: bookmark.id, user_id: session[:user].id) %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.rating.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = &amp;quot;0&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;%= form_tag :action =&amp;gt; &amp;quot;save_bookmark_rating_score&amp;quot;, :id =&amp;gt; bookmark.id do %&amp;gt;&lt;br /&gt;
                &amp;lt;% params[:rating] = rating %&amp;gt;&lt;br /&gt;
                &amp;lt;select id=&amp;lt;%= bookmark.id %&amp;gt; name=&amp;quot;rating&amp;quot; style=&amp;quot;font-size: 10px&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;% (0..5).each do |i| %&amp;gt;&lt;br /&gt;
                    &amp;lt;option value=&amp;lt;%= i.to_s %&amp;gt;&lt;br /&gt;
                              &amp;lt;% if params[:rating] == i.to_s %&amp;gt;&lt;br /&gt;
                                selected&lt;br /&gt;
                       &amp;lt;% end %&amp;gt;&lt;br /&gt;
                     &amp;gt;&lt;br /&gt;
                       &amp;lt;%= i.to_s %&amp;gt;&lt;br /&gt;
                     &amp;lt;/option&amp;gt;&lt;br /&gt;
                  &amp;lt;% end %&amp;gt;&lt;br /&gt;
                &amp;lt;/select&amp;gt;&lt;br /&gt;
                &amp;lt;% if BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.blank? %&amp;gt;&lt;br /&gt;
                  &amp;lt;%= button_tag &amp;quot;Rate&amp;quot;, {:id=&amp;gt;'button'+bookmark.id.to_s,:style=&amp;gt;&amp;quot;font-size:10px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
                &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;%= button_tag &amp;quot;Update&amp;quot;, {:id=&amp;gt;'button'+bookmark.id.to_s,:style=&amp;gt;&amp;quot;font-size:10px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- This will be used to show the rubric --&amp;gt;&lt;br /&gt;
              &amp;lt;% bookmark_rating_response_map = BookmarkRating.get_bookmark_rating_response_map(bookmark, current_user) %&amp;gt;&lt;br /&gt;
              &amp;lt;% if bookmark_rating_response_map.nil? || bookmark_rating_response_map.response.size == 0 %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;Begin&amp;quot;, :action =&amp;gt; &amp;quot;new_bookmark_review&amp;quot;, :id =&amp;gt; bookmark.id %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;View&amp;quot;, view_response_index_path(id: bookmark_rating_response_map.response.first.response_id) %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;Edit&amp;quot;, edit_response_path(id: bookmark_rating_response_map.response.first.response_id, return: 'bookmark') %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;% if bookmark.user_id == session[:user].id %&amp;gt;&lt;br /&gt;
          &amp;lt;td&amp;gt;&amp;lt;%= link_to 'Edit', :action =&amp;gt; 'edit', :id =&amp;gt; bookmark.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;td&amp;gt;&amp;lt;%= link_to 'Destroy', bookmark, :confirm =&amp;gt; &amp;quot;Delete bookmark \&amp;quot;#{bookmark.title}\&amp;quot;?&amp;quot;, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
           ....&lt;br /&gt;
:app/models/bookmark_rating_questionnaire.rb&lt;br /&gt;
# method to check if a dropdown is used for rating bookmarks&lt;br /&gt;
      def self.has_dropdown?(topic)&lt;br /&gt;
        bookmark_rating_questionnaire = topic.assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire')&lt;br /&gt;
        if bookmark_rating_questionnaire[0].nil?&lt;br /&gt;
          true&lt;br /&gt;
        else&lt;br /&gt;
          false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
    &lt;br /&gt;
    ..... &lt;br /&gt;
    # Saves the responses to the bookmark review questionnaire.&lt;br /&gt;
    # If a previous response exists it updates it.&lt;br /&gt;
    def new_bookmark_review&lt;br /&gt;
        bookmark = Bookmark.find(params[:id])&lt;br /&gt;
        topic = SignUpTopic.find(bookmark.topic_id)&lt;br /&gt;
        assignment_participant = AssignmentParticipant.find_by(user_id: current_user.id)&lt;br /&gt;
        response_map = BookmarkRatingResponseMap.where(&lt;br /&gt;
          reviewed_object_id: topic.assignment.id,&lt;br /&gt;
          reviewer_id: assignment_participant.id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        ).first&lt;br /&gt;
        if response_map.nil?&lt;br /&gt;
          response_map = BookmarkRatingResponseMap.create(&lt;br /&gt;
            reviewed_object_id: topic.assignment.id,&lt;br /&gt;
            reviewer_id: assignment_participant.id,&lt;br /&gt;
            reviewee_id: bookmark.id&lt;br /&gt;
          )&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to new_response_url(id: response_map.id, return: 'bookmark')&lt;br /&gt;
      end&lt;br /&gt;
      .....&lt;br /&gt;
&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': When 'Bookmark Rating' is 'None', the error the error 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' is out of scope of the current project and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127355</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127355"/>
		<updated>2019-11-06T20:18:07Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Bugs that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design and Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for creating a new bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     ....&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    ....&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     ....&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     ....&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/models/bookmark_rating.rb&lt;br /&gt;
&lt;br /&gt;
   def average_based_on_rubric(bookmark)&lt;br /&gt;
       if bookmark.nil?&lt;br /&gt;
          0&lt;br /&gt;
       else&lt;br /&gt;
          assignment = SignUpTopic.find(bookmark.topic_id).assignment&lt;br /&gt;
          questions = assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire').flat_map(&amp;amp;:questions)&lt;br /&gt;
          responses = BookmarkRatingResponseMap.where(&lt;br /&gt;
              reviewed_object_id: assignment.id,&lt;br /&gt;
              reviewee_id: bookmark.id&lt;br /&gt;
          ).flat_map {|r| Response.where(map_id: r.id) }&lt;br /&gt;
          scores = Answer.compute_scores(responses, questions)&lt;br /&gt;
          if scores[:avg].nil?&lt;br /&gt;
            0&lt;br /&gt;
           else&lt;br /&gt;
            (scores[:avg] * 5.0 / 100.0).round(2)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
   def self.get_bookmark_rating_response_map(bookmark, current_user)&lt;br /&gt;
      BookmarkRatingResponseMap.find_by(&lt;br /&gt;
          reviewed_object_id: SignUpTopic.find(bookmark.topic_id).assignment.id,&lt;br /&gt;
          reviewer_id: AssignmentParticipant.find_by(user_id: current_user.id).id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
       ....&lt;br /&gt;
            &amp;lt;td&amp;gt;&amp;lt;a href=&amp;lt;%= &amp;quot;http://#{bookmark.url}&amp;quot;%&amp;gt; target='_blank'&amp;gt;&amp;lt;%=bookmark.title %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;!--Set maximum length of bookmark description and keep description in one line.--&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;%=truncate(bookmark.description, length: 100) %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;!--Average rating score--&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings = BookmarkRating.where(bookmark_id: bookmark.id) %&amp;gt;&lt;br /&gt;
        &amp;lt;!--Self rated bookmark should not be counted in average rating.--&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings.to_a.reject! {|bookmark_rating| bookmark_rating.user_id == Bookmark.find(bookmark_rating.bookmark_id).user_id} %&amp;gt;&lt;br /&gt;
        &amp;lt;% sum = 0 %&amp;gt;&lt;br /&gt;
        &amp;lt;% @bookmark_ratings.each do |bookmark_rating| %&amp;gt;&lt;br /&gt;
          &amp;lt;% sum += bookmark_rating.rating %&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
          &amp;lt;% if BookmarkRatingQuestionnaire.has_dropdown?(@topic) %&amp;gt;&lt;br /&gt;
            &amp;lt;% if @bookmark_ratings.size &amp;gt; 0 %&amp;gt;&lt;br /&gt;
              &amp;lt;%= (sum * 1.0 / @bookmark_ratings.size).round(1) %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;%= '-' %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;% else %&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Compute average rating based on rubrics --&amp;gt;&lt;br /&gt;
            &amp;lt;% avg = BookmarkRating.average_based_on_rubric(bookmark) %&amp;gt;&lt;br /&gt;
            &amp;lt;%= avg == 0 ? '-' : avg %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
         &amp;lt;!-- Only allow to rate a bookmark which is not uploaded by the current user --&amp;gt;&lt;br /&gt;
          &amp;lt;% if bookmark.user.id != current_user.id %&amp;gt;&lt;br /&gt;
            &amp;lt;% if BookmarkRatingQuestionnaire.has_dropdown?(@topic) %&amp;gt;&lt;br /&gt;
              &amp;lt;% if BookmarkRating.exists?(bookmark_id: bookmark.id, user_id: session[:user].id) %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.rating.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = &amp;quot;0&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;%= form_tag :action =&amp;gt; &amp;quot;save_bookmark_rating_score&amp;quot;, :id =&amp;gt; bookmark.id do %&amp;gt;&lt;br /&gt;
                &amp;lt;% params[:rating] = rating %&amp;gt;&lt;br /&gt;
                &amp;lt;select id=&amp;lt;%= bookmark.id %&amp;gt; name=&amp;quot;rating&amp;quot; style=&amp;quot;font-size: 10px&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;% (0..5).each do |i| %&amp;gt;&lt;br /&gt;
                    &amp;lt;option value=&amp;lt;%= i.to_s %&amp;gt;&lt;br /&gt;
                              &amp;lt;% if params[:rating] == i.to_s %&amp;gt;&lt;br /&gt;
                                selected&lt;br /&gt;
                       &amp;lt;% end %&amp;gt;&lt;br /&gt;
                     &amp;gt;&lt;br /&gt;
                       &amp;lt;%= i.to_s %&amp;gt;&lt;br /&gt;
                     &amp;lt;/option&amp;gt;&lt;br /&gt;
                  &amp;lt;% end %&amp;gt;&lt;br /&gt;
                &amp;lt;/select&amp;gt;&lt;br /&gt;
                &amp;lt;% if BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.blank? %&amp;gt;&lt;br /&gt;
                  &amp;lt;%= button_tag &amp;quot;Rate&amp;quot;, {:id=&amp;gt;'button'+bookmark.id.to_s,:style=&amp;gt;&amp;quot;font-size:10px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
                &amp;lt;% else %&amp;gt;&lt;br /&gt;
                  &amp;lt;%= button_tag &amp;quot;Update&amp;quot;, {:id=&amp;gt;'button'+bookmark.id.to_s,:style=&amp;gt;&amp;quot;font-size:10px; display:none;&amp;quot;} %&amp;gt;&lt;br /&gt;
                &amp;lt;% end %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;!-- This will be used to show the rubric --&amp;gt;&lt;br /&gt;
              &amp;lt;% bookmark_rating_response_map = BookmarkRating.get_bookmark_rating_response_map(bookmark, current_user) %&amp;gt;&lt;br /&gt;
              &amp;lt;% if bookmark_rating_response_map.nil? || bookmark_rating_response_map.response.size == 0 %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;Begin&amp;quot;, :action =&amp;gt; &amp;quot;new_bookmark_review&amp;quot;, :id =&amp;gt; bookmark.id %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;View&amp;quot;, view_response_index_path(id: bookmark_rating_response_map.response.first.response_id) %&amp;gt;&lt;br /&gt;
                &amp;lt;%= link_to &amp;quot;Edit&amp;quot;, edit_response_path(id: bookmark_rating_response_map.response.first.response_id, return: 'bookmark') %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
          &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;% if bookmark.user_id == session[:user].id %&amp;gt;&lt;br /&gt;
          &amp;lt;td&amp;gt;&amp;lt;%= link_to 'Edit', :action =&amp;gt; 'edit', :id =&amp;gt; bookmark.id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;td&amp;gt;&amp;lt;%= link_to 'Destroy', bookmark, :confirm =&amp;gt; &amp;quot;Delete bookmark \&amp;quot;#{bookmark.title}\&amp;quot;?&amp;quot;, :method =&amp;gt; :delete %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;% end %&amp;gt;&lt;br /&gt;
           ....&lt;br /&gt;
:app/models/bookmark_rating_questionnaire.rb&lt;br /&gt;
# method to check if a dropdown is used for rating bookmarks&lt;br /&gt;
      def self.has_dropdown?(topic)&lt;br /&gt;
        bookmark_rating_questionnaire = topic.assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire')&lt;br /&gt;
        if bookmark_rating_questionnaire[0].nil?&lt;br /&gt;
          true&lt;br /&gt;
        else&lt;br /&gt;
          false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
    &lt;br /&gt;
    .....&lt;br /&gt;
    def new_bookmark_review&lt;br /&gt;
        bookmark = Bookmark.find(params[:id])&lt;br /&gt;
        topic = SignUpTopic.find(bookmark.topic_id)&lt;br /&gt;
        assignment_participant = AssignmentParticipant.find_by(user_id: current_user.id)&lt;br /&gt;
        response_map = BookmarkRatingResponseMap.where(&lt;br /&gt;
          reviewed_object_id: topic.assignment.id,&lt;br /&gt;
          reviewer_id: assignment_participant.id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        ).first&lt;br /&gt;
        if response_map.nil?&lt;br /&gt;
          response_map = BookmarkRatingResponseMap.create(&lt;br /&gt;
            reviewed_object_id: topic.assignment.id,&lt;br /&gt;
            reviewer_id: assignment_participant.id,&lt;br /&gt;
            reviewee_id: bookmark.id&lt;br /&gt;
          )&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to new_response_url(id: response_map.id, return: 'bookmark')&lt;br /&gt;
      end&lt;br /&gt;
      .....&lt;br /&gt;
&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': When 'Bookmark Rating' is 'None', the error the error 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' is out of scope of the current project and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127344</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127344"/>
		<updated>2019-11-06T19:53:36Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Bugs that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design and Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for creating a new bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     ....&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    ....&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     ....&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     ....&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/models/bookmark_rating.rb&lt;br /&gt;
&lt;br /&gt;
   def average_based_on_rubric(bookmark)&lt;br /&gt;
       if bookmark.nil?&lt;br /&gt;
          0&lt;br /&gt;
       else&lt;br /&gt;
          assignment = SignUpTopic.find(bookmark.topic_id).assignment&lt;br /&gt;
          questions = assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire').flat_map(&amp;amp;:questions)&lt;br /&gt;
          responses = BookmarkRatingResponseMap.where(&lt;br /&gt;
              reviewed_object_id: assignment.id,&lt;br /&gt;
              reviewee_id: bookmark.id&lt;br /&gt;
          ).flat_map {|r| Response.where(map_id: r.id) }&lt;br /&gt;
          scores = Answer.compute_scores(responses, questions)&lt;br /&gt;
          if scores[:avg].nil?&lt;br /&gt;
            0&lt;br /&gt;
           else&lt;br /&gt;
            (scores[:avg] * 5.0 / 100.0).round(2)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
   def self.get_bookmark_rating_response_map(bookmark, current_user)&lt;br /&gt;
      BookmarkRatingResponseMap.find_by(&lt;br /&gt;
          reviewed_object_id: SignUpTopic.find(bookmark.topic_id).assignment.id,&lt;br /&gt;
          reviewer_id: AssignmentParticipant.find_by(user_id: current_user.id).id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
       ....&lt;br /&gt;
       &amp;lt;% if @has_dropdown %&amp;gt;&lt;br /&gt;
            &amp;lt;% if @bookmark_ratings.size &amp;gt; 0 %&amp;gt;&lt;br /&gt;
              &amp;lt;%= (sum * 1.0 / @bookmark_ratings.size).round(1) %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;%= '-' %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
         ....&lt;br /&gt;
         &amp;lt;!-- Compute average rating based on rubrics --&amp;gt;&lt;br /&gt;
            &amp;lt;% avg = average_based_on_rubric(bookmark) %&amp;gt;&lt;br /&gt;
            &amp;lt;%= avg == 0 ? '-' : avg %&amp;gt;&lt;br /&gt;
          ...&lt;br /&gt;
          &amp;lt;% if BookmarkRating.exists?(bookmark_id: bookmark.id, user_id: session[:user].id) %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.rating.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = &amp;quot;0&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
           ....&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
    &lt;br /&gt;
    .....&lt;br /&gt;
    def new_bookmark_review&lt;br /&gt;
        bookmark = Bookmark.find(params[:id])&lt;br /&gt;
        topic = SignUpTopic.find(bookmark.topic_id)&lt;br /&gt;
        assignment_participant = AssignmentParticipant.find_by(user_id: current_user.id)&lt;br /&gt;
        response_map = BookmarkRatingResponseMap.where(&lt;br /&gt;
          reviewed_object_id: topic.assignment.id,&lt;br /&gt;
          reviewer_id: assignment_participant.id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        ).first&lt;br /&gt;
        if response_map.nil?&lt;br /&gt;
          response_map = BookmarkRatingResponseMap.create(&lt;br /&gt;
            reviewed_object_id: topic.assignment.id,&lt;br /&gt;
            reviewer_id: assignment_participant.id,&lt;br /&gt;
            reviewee_id: bookmark.id&lt;br /&gt;
          )&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to new_response_url(id: response_map.id, return: 'bookmark')&lt;br /&gt;
      end&lt;br /&gt;
      .....&lt;br /&gt;
&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': When 'Bookmark Rating' is 'None', the error the error 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' is out of scope of the current project and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127325</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127325"/>
		<updated>2019-11-06T19:01:29Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Peer Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Tasks that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for adding bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     ....&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    ....&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     ....&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     ....&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/models/bookmark_rating.rb&lt;br /&gt;
&lt;br /&gt;
   def average_based_on_rubric(bookmark)&lt;br /&gt;
       if bookmark.nil?&lt;br /&gt;
          0&lt;br /&gt;
       else&lt;br /&gt;
          assignment = SignUpTopic.find(bookmark.topic_id).assignment&lt;br /&gt;
          questions = assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire').flat_map(&amp;amp;:questions)&lt;br /&gt;
          responses = BookmarkRatingResponseMap.where(&lt;br /&gt;
              reviewed_object_id: assignment.id,&lt;br /&gt;
              reviewee_id: bookmark.id&lt;br /&gt;
          ).flat_map {|r| Response.where(map_id: r.id) }&lt;br /&gt;
          scores = Answer.compute_scores(responses, questions)&lt;br /&gt;
          if scores[:avg].nil?&lt;br /&gt;
            0&lt;br /&gt;
           else&lt;br /&gt;
            (scores[:avg] * 5.0 / 100.0).round(2)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
   def self.get_bookmark_rating_response_map(bookmark, current_user)&lt;br /&gt;
      BookmarkRatingResponseMap.find_by(&lt;br /&gt;
          reviewed_object_id: SignUpTopic.find(bookmark.topic_id).assignment.id,&lt;br /&gt;
          reviewer_id: AssignmentParticipant.find_by(user_id: current_user.id).id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
       ....&lt;br /&gt;
       &amp;lt;% if @has_dropdown %&amp;gt;&lt;br /&gt;
            &amp;lt;% if @bookmark_ratings.size &amp;gt; 0 %&amp;gt;&lt;br /&gt;
              &amp;lt;%= (sum * 1.0 / @bookmark_ratings.size).round(1) %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;%= '-' %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
         ....&lt;br /&gt;
         &amp;lt;!-- Compute average rating based on rubrics --&amp;gt;&lt;br /&gt;
            &amp;lt;% avg = average_based_on_rubric(bookmark) %&amp;gt;&lt;br /&gt;
            &amp;lt;%= avg == 0 ? '-' : avg %&amp;gt;&lt;br /&gt;
          ...&lt;br /&gt;
          &amp;lt;% if BookmarkRating.exists?(bookmark_id: bookmark.id, user_id: session[:user].id) %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.rating.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = &amp;quot;0&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
           ....&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
    &lt;br /&gt;
    .....&lt;br /&gt;
    def new_bookmark_review&lt;br /&gt;
        bookmark = Bookmark.find(params[:id])&lt;br /&gt;
        topic = SignUpTopic.find(bookmark.topic_id)&lt;br /&gt;
        assignment_participant = AssignmentParticipant.find_by(user_id: current_user.id)&lt;br /&gt;
        response_map = BookmarkRatingResponseMap.where(&lt;br /&gt;
          reviewed_object_id: topic.assignment.id,&lt;br /&gt;
          reviewer_id: assignment_participant.id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        ).first&lt;br /&gt;
        if response_map.nil?&lt;br /&gt;
          response_map = BookmarkRatingResponseMap.create(&lt;br /&gt;
            reviewed_object_id: topic.assignment.id,&lt;br /&gt;
            reviewer_id: assignment_participant.id,&lt;br /&gt;
            reviewee_id: bookmark.id&lt;br /&gt;
          )&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to new_response_url(id: response_map.id, return: 'bookmark')&lt;br /&gt;
      end&lt;br /&gt;
      .....&lt;br /&gt;
&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': When 'Bookmark Rating' is 'None', the error the error 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' is out of scope of the current project and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127311</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127311"/>
		<updated>2019-11-06T18:19:06Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Tasks that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for adding bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     ....&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    ....&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     ....&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     ....&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Earlier:&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/models/bookmark_rating.rb&lt;br /&gt;
&lt;br /&gt;
   def average_based_on_rubric(bookmark)&lt;br /&gt;
       if bookmark.nil?&lt;br /&gt;
          0&lt;br /&gt;
       else&lt;br /&gt;
          assignment = SignUpTopic.find(bookmark.topic_id).assignment&lt;br /&gt;
          questions = assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire').flat_map(&amp;amp;:questions)&lt;br /&gt;
          responses = BookmarkRatingResponseMap.where(&lt;br /&gt;
              reviewed_object_id: assignment.id,&lt;br /&gt;
              reviewee_id: bookmark.id&lt;br /&gt;
          ).flat_map {|r| Response.where(map_id: r.id) }&lt;br /&gt;
          scores = Answer.compute_scores(responses, questions)&lt;br /&gt;
          if scores[:avg].nil?&lt;br /&gt;
            0&lt;br /&gt;
           else&lt;br /&gt;
            (scores[:avg] * 5.0 / 100.0).round(2)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
   def self.get_bookmark_rating_response_map(bookmark, current_user)&lt;br /&gt;
      BookmarkRatingResponseMap.find_by(&lt;br /&gt;
          reviewed_object_id: SignUpTopic.find(bookmark.topic_id).assignment.id,&lt;br /&gt;
          reviewer_id: AssignmentParticipant.find_by(user_id: current_user.id).id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
       ....&lt;br /&gt;
       &amp;lt;% if @has_dropdown %&amp;gt;&lt;br /&gt;
            &amp;lt;% if @bookmark_ratings.size &amp;gt; 0 %&amp;gt;&lt;br /&gt;
              &amp;lt;%= (sum * 1.0 / @bookmark_ratings.size).round(1) %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;%= '-' %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
         ....&lt;br /&gt;
         &amp;lt;!-- Compute average rating based on rubrics --&amp;gt;&lt;br /&gt;
            &amp;lt;% avg = average_based_on_rubric(bookmark) %&amp;gt;&lt;br /&gt;
            &amp;lt;%= avg == 0 ? '-' : avg %&amp;gt;&lt;br /&gt;
          ...&lt;br /&gt;
          &amp;lt;% if BookmarkRating.exists?(bookmark_id: bookmark.id, user_id: session[:user].id) %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.rating.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = &amp;quot;0&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
           ....&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
    &lt;br /&gt;
    .....&lt;br /&gt;
    def new_bookmark_review&lt;br /&gt;
        bookmark = Bookmark.find(params[:id])&lt;br /&gt;
        topic = SignUpTopic.find(bookmark.topic_id)&lt;br /&gt;
        assignment_participant = AssignmentParticipant.find_by(user_id: current_user.id)&lt;br /&gt;
        response_map = BookmarkRatingResponseMap.where(&lt;br /&gt;
          reviewed_object_id: topic.assignment.id,&lt;br /&gt;
          reviewer_id: assignment_participant.id,&lt;br /&gt;
          reviewee_id: bookmark.id&lt;br /&gt;
        ).first&lt;br /&gt;
        if response_map.nil?&lt;br /&gt;
          response_map = BookmarkRatingResponseMap.create(&lt;br /&gt;
            reviewed_object_id: topic.assignment.id,&lt;br /&gt;
            reviewer_id: assignment_participant.id,&lt;br /&gt;
            reviewee_id: bookmark.id&lt;br /&gt;
          )&lt;br /&gt;
        end&lt;br /&gt;
        redirect_to new_response_url(id: response_map.id, return: 'bookmark')&lt;br /&gt;
      end&lt;br /&gt;
      .....&lt;br /&gt;
&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:app/models/questionnaire.rb&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
'''Peer Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': The error popping 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' when None is selected in Bookmark rating is out of scope of the current project. Although the error pops up, the functionalities are working as it is expected  and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127310</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127310"/>
		<updated>2019-11-06T17:50:37Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Solutions Implemented */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Tasks that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for adding bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     ....&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    ....&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     ....&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     ....&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Earlier:&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
   def average_based_on_rubric(bookmark)&lt;br /&gt;
       if bookmark.nil?&lt;br /&gt;
          0&lt;br /&gt;
       else&lt;br /&gt;
          assignment = SignUpTopic.find(bookmark.topic_id).assignment&lt;br /&gt;
          questions = assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire').flat_map(&amp;amp;:questions)&lt;br /&gt;
          responses = BookmarkRatingResponseMap.where(&lt;br /&gt;
              reviewed_object_id: assignment.id,&lt;br /&gt;
              reviewee_id: bookmark.id&lt;br /&gt;
          ).flat_map {|r| Response.where(map_id: r.id) }&lt;br /&gt;
          scores = Answer.compute_scores(responses, questions)&lt;br /&gt;
          if scores[:avg].nil?&lt;br /&gt;
            0&lt;br /&gt;
           else&lt;br /&gt;
            (scores[:avg] * 5.0 / 100.0).round(2)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      .&lt;br /&gt;
      .&lt;br /&gt;
      .&lt;br /&gt;
      helper_method :average_based_on_rubric&lt;br /&gt;
      .&lt;br /&gt;
      .&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
       ....&lt;br /&gt;
       &amp;lt;% if @has_dropdown %&amp;gt;&lt;br /&gt;
            &amp;lt;% if @bookmark_ratings.size &amp;gt; 0 %&amp;gt;&lt;br /&gt;
              &amp;lt;%= (sum * 1.0 / @bookmark_ratings.size).round(1) %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;%= '-' %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
         ....&lt;br /&gt;
         &amp;lt;!-- Compute average rating based on rubrics --&amp;gt;&lt;br /&gt;
            &amp;lt;% avg = average_based_on_rubric(bookmark) %&amp;gt;&lt;br /&gt;
            &amp;lt;%= avg == 0 ? '-' : avg %&amp;gt;&lt;br /&gt;
          ...&lt;br /&gt;
          &amp;lt;% if BookmarkRating.exists?(bookmark_id: bookmark.id, user_id: session[:user].id) %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.rating.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = &amp;quot;0&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
           ....&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:app/models/questionnaire.rb&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
'''Peer Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': The error popping 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' when None is selected in Bookmark rating is out of scope of the current project. Although the error pops up, the functionalities are working as it is expected  and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127308</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127308"/>
		<updated>2019-11-06T17:43:13Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: /* Solutions Implemented */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Tasks that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for adding bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Earlier:&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
   def average_based_on_rubric(bookmark)&lt;br /&gt;
       if bookmark.nil?&lt;br /&gt;
          0&lt;br /&gt;
       else&lt;br /&gt;
          assignment = SignUpTopic.find(bookmark.topic_id).assignment&lt;br /&gt;
          questions = assignment.questionnaires.where(type: 'BookmarkRatingQuestionnaire').flat_map(&amp;amp;:questions)&lt;br /&gt;
          responses = BookmarkRatingResponseMap.where(&lt;br /&gt;
              reviewed_object_id: assignment.id,&lt;br /&gt;
              reviewee_id: bookmark.id&lt;br /&gt;
          ).flat_map {|r| Response.where(map_id: r.id) }&lt;br /&gt;
          scores = Answer.compute_scores(responses, questions)&lt;br /&gt;
          if scores[:avg].nil?&lt;br /&gt;
            0&lt;br /&gt;
           else&lt;br /&gt;
            (scores[:avg] * 5.0 / 100.0).round(2)&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      .&lt;br /&gt;
      .&lt;br /&gt;
      .&lt;br /&gt;
      helper_method :average_based_on_rubric&lt;br /&gt;
      .&lt;br /&gt;
      .&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
       ....&lt;br /&gt;
       &amp;lt;% if @has_dropdown %&amp;gt;&lt;br /&gt;
            &amp;lt;% if @bookmark_ratings.size &amp;gt; 0 %&amp;gt;&lt;br /&gt;
              &amp;lt;%= (sum * 1.0 / @bookmark_ratings.size).round(1) %&amp;gt;&lt;br /&gt;
            &amp;lt;% else %&amp;gt;&lt;br /&gt;
              &amp;lt;%= '-' %&amp;gt;&lt;br /&gt;
            &amp;lt;% end %&amp;gt;&lt;br /&gt;
         ....&lt;br /&gt;
         &amp;lt;!-- Compute average rating based on rubrics --&amp;gt;&lt;br /&gt;
            &amp;lt;% avg = average_based_on_rubric(bookmark) %&amp;gt;&lt;br /&gt;
            &amp;lt;%= avg == 0 ? '-' : avg %&amp;gt;&lt;br /&gt;
          ...&lt;br /&gt;
          &amp;lt;% if BookmarkRating.exists?(bookmark_id: bookmark.id, user_id: session[:user].id) %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = BookmarkRating.where(bookmark_id: bookmark.id, user_id: session[:user].id).first.rating.to_s %&amp;gt;&lt;br /&gt;
              &amp;lt;% else %&amp;gt;&lt;br /&gt;
                &amp;lt;% rating = &amp;quot;0&amp;quot; %&amp;gt;&lt;br /&gt;
              &amp;lt;% end %&amp;gt;&lt;br /&gt;
           ....&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:app/models/questionnaire.rb&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
'''Peer Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': The error popping 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' when None is selected in Bookmark rating is out of scope of the current project. Although the error pops up, the functionalities are working as it is expected  and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127307</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127307"/>
		<updated>2019-11-06T17:24:44Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Tasks that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/controllers/sign_up_sheet_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/new.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
         &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id , :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for adding bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Earlier:&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
     def update&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
     begin&lt;br /&gt;
      @bookmark.update_attributes!(url: params[:bookmark][:url], title: params[:bookmark][:title], description: params[:bookmark][:description])&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, 'Your bookmark has been successfully updated!', request)&lt;br /&gt;
      flash[:success] = 'Your bookmark has been successfully updated!'&lt;br /&gt;
    rescue StandardError&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, $ERROR_INFO.to_s, request)&lt;br /&gt;
      flash[:error] = 'Bookmark could not be updated: ' + $ERROR_INFO.to_s&lt;br /&gt;
    end&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
     class Bookmark &amp;lt; ActiveRecord::Base&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
     validates_format_of :url, :multiline =&amp;gt; true, :with =&amp;gt; /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, :on =&amp;gt; :create&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Earlier:&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           .&lt;br /&gt;
           .&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:app/models/questionnaire.rb&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
'''Peer Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': The error popping 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' when None is selected in Bookmark rating is out of scope of the current project. Although the error pops up, the functionalities are working as it is expected  and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127299</id>
		<title>CSC/ECE 517 Fall 2019 - E1939. OSS Project Juniper: Bookmark enhancements</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1939._OSS_Project_Juniper:_Bookmark_enhancements&amp;diff=127299"/>
		<updated>2019-11-06T17:12:17Z</updated>

		<summary type="html">&lt;p&gt;Tmpandi2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
===== Bookmark Functionality  in Expertiza =====&lt;br /&gt;
&lt;br /&gt;
Expertiza features the bookmarking functionality which allows users to help the author of the project by suggesting insights. Let’s say there are five topics that I’m interested in and would like to contribute to, but I can only choose one.  Well, for the other topics, I’m allowed to submit hyperlinks to pages that I think would help the author do the work.  On each line of the signup sheet are two icons, one for adding a bookmark to the topic, and another for viewing bookmarks on the topic. The bookmarks are attached to each project topic and user can suggest by filling up a questionnaire. As soon as a user creates a bookmark, the project author is able to view all the bookmarks that are created for his project. The author can give a feedback on the bookmark that he has received which helps even the user know the usefuless of his bookmark. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Bookmark Enhancements==&lt;br /&gt;
&lt;br /&gt;
The Bookmark functionality in expertiza is in its nascent stage which allows user to provide feedback on the projects that he is interested in. It also allows the author to rate the bookmarks that he has received for his project. Project Juniper Bookmark Enhancements is an attempt to make the bookmarks more user-friendly and credible. We have improved the functionality for an author to descriptively evaluate the bookmark  that he has received on his project using rubrics as set by the instructor.&lt;br /&gt;
&lt;br /&gt;
=== Tasks that were identified  === &lt;br /&gt;
&lt;br /&gt;
*Fixing the “Back” button &lt;br /&gt;
*Validations on the form for adding bookmarks were missing&lt;br /&gt;
*Allowed the creator of bookmark to rate himself  and fixed the logic for calculating average rating&lt;br /&gt;
*Bookmark Rating Questionnaire could not be created&lt;br /&gt;
*Functionality for review of  bookmarks using rubric&lt;br /&gt;
&lt;br /&gt;
== Solutions Implemented ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Fixing the Back button:'''&lt;br /&gt;
When user visits “Create Bookmarks&amp;quot; and  &amp;quot;View Bookmarks&amp;quot;, the back button was not functional which refrained the user from going back to the Signup-sheet. Now this issue has been fixed which in future will allow to any contributor to use this back functionality.&lt;br /&gt;
&lt;br /&gt;
Earlier: [[File: Backbutton_old.png ]]&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb &lt;br /&gt;
  def list&lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @bookmarks = Bookmark.where(topic_id: params[:id])	   &lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	   &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def new	 &lt;br /&gt;
    @participant = Participant.where(user_id: session[:user].id).first&lt;br /&gt;
    @topic = SignUpTopic.find(params[:id])	    &lt;br /&gt;
    @bookmark = Bookmark.new	 &lt;br /&gt;
  end	 &lt;br /&gt;
&lt;br /&gt;
:app/controllers/sign_up_sheet_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
:app/views/bookmarks/list.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id, :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:app/views/bookmarks/new.html.erb &amp;lt;br/&amp;gt;&lt;br /&gt;
   &amp;lt;p&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt; &amp;lt;%= submit_tag &amp;quot;Add new bookmark&amp;quot; %&amp;gt; |&lt;br /&gt;
         &amp;lt;%= link_to 'Back', :controller=&amp;gt; 'sign_up_sheet', :action=&amp;gt;'list', :id =&amp;gt; @participant.id , :assignment_id =&amp;gt; @topic.assignment_id %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The changed code can be found  &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/aad5803b1e2bb49c17cff082d9d0661eb5e5f4aa?file-filters%5B%5D=.erb&amp;amp;file-filters%5B%5D=.rb&amp;amp;file-filters%5B%5D=No+extension#diff-dfb6f1f1b681adb17aeaef26d931880b here]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1CqxFbLjmh3nQ-gi4PFZVJzIok_-xrpJU/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bookmark Validations '''&lt;br /&gt;
The form for adding bookmark allowed malformed URLs to be entered into the system. Now, the bookmarks can be added only when user enters legitimate URL as well as all the fields are completely filled. Validations were added as a security measure to prevent misuse.&lt;br /&gt;
&lt;br /&gt;
Earlier:&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:app/models/bookmark.rb&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/4f70a3dc25dddf04c671186d52f0942b744d91da here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/14A9e76pcd6HoNEYFzPrfH4xR3HBjps-c/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Self Rating of Bookmarks and average calculation'''&lt;br /&gt;
When reviewing the bookmark, the average rating for that bookmark shown was calculated wrongly and showed average rating for the bookmark that wasn’t reviewed. Also, the user who created the bookmark could rate himself. &lt;br /&gt;
Now, the user cannot rate his own bookmarks and the average rating is calculated perfectly after one or more people have reviewed it.&lt;br /&gt;
&lt;br /&gt;
Earlier:&lt;br /&gt;
&lt;br /&gt;
Files Changed:&lt;br /&gt;
:app/controllers/bookmarks_controller.rb&lt;br /&gt;
:app/views/bookmarks/list.html.erb&lt;br /&gt;
The changed code can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://github.com/expertiza/expertiza/pull/1540/commits/3ad53b0cbd9b06f4a3a3ff85311c38f5b5672970?file-filters%5B%5D= here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Review bookmark using rubric functionality'''&lt;br /&gt;
The bookmark functionality earlier only allowed for the users to rate the bookmark and not give feedback about the the quality of the Bookmark. Now, feature is added so that the instructor can decide whether to allow for bookmark to be just rated or a have a rubric . The instructor can customize the questions in the rubric.  The rubric once created by the instructor can be used for multiple assignments and also multiple rubrics can be created for different types of assignments. &lt;br /&gt;
&lt;br /&gt;
Files Modified&lt;br /&gt;
:app/controllers/questionnaires_controller.rb&lt;br /&gt;
&lt;br /&gt;
    if %w[AuthorFeedback CourseSurvey TeammateReview GlobalSurvey AssignmentSurvey BookmarkRating].include?(display_type)&lt;br /&gt;
          display_type = (display_type.split /(?=[A-Z])/).join(&amp;quot;%&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
        @questionnaire.display_type = display_type&lt;br /&gt;
&lt;br /&gt;
:app/controllers/response_controller.rb&lt;br /&gt;
&lt;br /&gt;
        when &amp;quot;bookmark&amp;quot;&lt;br /&gt;
            bookmark = Bookmark.find(@map.response_map.reviewee_id)&lt;br /&gt;
             redirect_to controller: 'bookmarks', action: 'list', id: bookmark.topic_id&lt;br /&gt;
     &lt;br /&gt;
       def set_questionnaire_for_new_response&lt;br /&gt;
           case @map.type&lt;br /&gt;
            when &amp;quot;ReviewResponseMap&amp;quot;, &amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
                reviewees_topic = SignedUpTeam.topic_id_by_team_id(@contributor.id)&lt;br /&gt;
               @current_round = @assignment.number_of_current_round(reviewees_topic)&lt;br /&gt;
               @questionnaire = @map.questionnaire(@current_round)&lt;br /&gt;
            when&lt;br /&gt;
               &amp;quot;MetareviewResponseMap&amp;quot;,&lt;br /&gt;
               &amp;quot;TeammateReviewResponseMap&amp;quot;,&lt;br /&gt;
               &amp;quot;FeedbackResponseMap&amp;quot;,&lt;br /&gt;
               &amp;quot;CourseSurveyResponseMap&amp;quot;,&lt;br /&gt;
               &amp;quot;AssignmentSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;GlobalSurveyResponseMap&amp;quot;,&lt;br /&gt;
              &amp;quot;BookmarkRatingResponseMap&amp;quot;&lt;br /&gt;
              @questionnaire = @map.questionnaire&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:app/models/questionnaire.rb&lt;br /&gt;
The screencast can be found &amp;lt;span class = &amp;quot;plainlinks&amp;quot;&amp;gt;[https://drive.google.com/file/d/1W5xQCox-p_njQt_t8-yVkhn3B0HalKGk/view?usp=sharing here:]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Deployment==&lt;br /&gt;
This application with the mentioned changes have been deployed on VCL and can be found at [http://152.46.19.205:8080 http://152.46.19.205:8080]&lt;br /&gt;
&lt;br /&gt;
'''Peer Review Assessment Credentials &lt;br /&gt;
'''&lt;br /&gt;
The credentials for Peer review assessment for Bookmark Enhancement project are&lt;br /&gt;
Instructor Login: username =&amp;gt; instructor6	password=&amp;gt;password&lt;br /&gt;
&lt;br /&gt;
Accounts for Impersonation: username =&amp;gt; student6340, student6341&lt;br /&gt;
Assignment =&amp;gt; Exercises, CSC456, Fall2015&lt;br /&gt;
&lt;br /&gt;
== Testing  Plan ==&lt;br /&gt;
&lt;br /&gt;
===Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
* Enable Bookmarks&lt;br /&gt;
# After logging in as instructor, go to Manage &amp;gt; Assignments &lt;br /&gt;
# Select Edit under Actions for assignment&lt;br /&gt;
# Under Topics Tab select 'Allow participants to create bookmarks?' to allow bookmarks&lt;br /&gt;
# Go to Rubrics tab, under 'Bookmark Rating' select the Bookmark review questionnaire to use the rubric for reviewing the bookmarks , select None for dropdown. &lt;br /&gt;
&lt;br /&gt;
'''Note''': The error popping 'You did not specify all the necessary rubrics. You need [BookmarkRating] of assignment Exercises before saving the assignment. You can assign rubrics here.' when None is selected in Bookmark rating is out of scope of the current project. Although the error pops up, the functionalities are working as it is expected  and the error can safely be ignored from point of view of this project&lt;br /&gt;
'&lt;br /&gt;
* Fixing the back Button &amp;amp; Validations&lt;br /&gt;
#     Log in as an instructor and impersonate as a student using the credentials given above&lt;br /&gt;
#	Select ‘Exercises’ assignment and go to the Signup sheet&lt;br /&gt;
#	We can see a list of projects with 2 columns to add or remove the Bookmark, select any of them&lt;br /&gt;
#	You’ll be redirected to the corresponding page where the back button will be visible&lt;br /&gt;
#      Select add bookmark and the form can be tested for Validations.   &lt;br /&gt;
&lt;br /&gt;
*Create new Bookmark Rating Rubric&lt;br /&gt;
# As an instructor, go to Manage&amp;gt;Questionnaires and select Bookmark Rating field&lt;br /&gt;
#Create a new rubric with required details&lt;br /&gt;
# Start adding questions. This can be done by manually entering into the system or importing Questionnaire.&lt;br /&gt;
&lt;br /&gt;
*View Bookmarks&lt;br /&gt;
&lt;br /&gt;
#	Log in as an instructor and impersonate as user using the credentials mentioned above and then select assignment &amp;quot;Exercises&amp;quot;&lt;br /&gt;
#     Add bookmarks to other topics.&lt;br /&gt;
#	The owner of that project should be able to see all the bookmarks created for his project and can rate the bookmark through the way instructor has defined it (rating or rubric).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing with RSpec ===&lt;br /&gt;
The current version of expertiza did not have any test for the BookmarksController and the Bookmarks model. Using the test driven development(TDD) approach, we have added an exhaustive set of RSPEC tests for BookmarksController, to test all the modifications we have done to the code of the controller class. We have also added unit tests to the bookmarks model. The tests can be executed using the &amp;quot;bundle exec rspec filename&amp;quot; command as shown below.&lt;br /&gt;
&lt;br /&gt;
   user-expertiza $bundle exec rspec spec_file_path&lt;br /&gt;
   [Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
   [Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
   ......................&lt;br /&gt;
   Finished in 1 minute 50.34 seconds (files took 10.6 seconds to load)&lt;br /&gt;
   22 examples, 0 failures&lt;br /&gt;
   Randomized with seed 5067&lt;br /&gt;
&lt;br /&gt;
== Future Scope ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#Github Link: https://github.com/srujana13/expertiza &lt;br /&gt;
#Pull Request: https://github.com/expertiza/expertiza/pull/1540/&lt;br /&gt;
#http://wiki.expertiza.ncsu.edu/index.php/E1830_OSS_Project_Juniper:_Bookmark_enhancements&lt;br /&gt;
# Expertiza on Github https://github.com/expertiza/expertiza&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
#Tanvi Pandit (tmpandi2@ncsu.edu)&lt;br /&gt;
#Abhirav Kariya (akariya@ncsu.edu)&lt;br /&gt;
#Srujana Rachakonda (srachak@ncsu.edu)&lt;br /&gt;
#Mentor Edward Gehringer  (efg@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Tmpandi2</name></author>
	</entry>
</feed>