<?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=Sdinaka</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=Sdinaka"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sdinaka"/>
	<updated>2026-07-01T07:21:32Z</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=131197</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=131197"/>
		<updated>2019-12-10T05:47:54Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
&lt;br /&gt;
addition of deliver method to the statement triggered the mail to be sent. The message is also modified such the it is uniform throughout&lt;br /&gt;
&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
instead of return unless, changed to if statement and return separately&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&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>Sdinaka</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=131196</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=131196"/>
		<updated>2019-12-10T05:02:06Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
&lt;br /&gt;
addition of deliver method to the statement triggered the mail to be sent. The message is also modified such the it is uniform throughout&lt;br /&gt;
&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
instead of return unless, change to if statement and return separately&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&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>Sdinaka</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=131195</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=131195"/>
		<updated>2019-12-10T05:01:21Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
addition of deliver method to the statement triggered the mail to be sent. The message is also modified such the it is uniform throughout&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
instead of return unless, change to if statement and return seperately&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&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>Sdinaka</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=131194</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=131194"/>
		<updated>2019-12-10T04:59:43Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
addition of deliver method to the statement triggered the mail to be sent. The message is also modified such the it is uniform throughout&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&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>Sdinaka</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=131083</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=131083"/>
		<updated>2019-12-07T05:33:01Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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:User request1.PNG|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;
[[Review_r_!.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Review_r_@.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>Sdinaka</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=131080</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=131080"/>
		<updated>2019-12-07T05:29:43Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
[[Review_r_!.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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_r_!.JPG&amp;diff=131079</id>
		<title>File:Review r !.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_r_!.JPG&amp;diff=131079"/>
		<updated>2019-12-07T05:29:30Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=131078</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=131078"/>
		<updated>2019-12-07T05:28:01Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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.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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix.JPG&amp;diff=131077</id>
		<title>File:Reviewer fix.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix.JPG&amp;diff=131077"/>
		<updated>2019-12-07T05:27:44Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: uploaded a new version of &amp;amp;quot;File:Reviewer fix.JPG&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=131058</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=131058"/>
		<updated>2019-12-07T05:02:01Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
=== &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;
=== 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_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>Sdinaka</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=131056</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=131056"/>
		<updated>2019-12-07T05:01:09Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
=== &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;
=== 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_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;
&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>Sdinaka</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=131052</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=131052"/>
		<updated>2019-12-07T05:00:09Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 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;
=== 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;
=== 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;
&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>Sdinaka</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=131051</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=131051"/>
		<updated>2019-12-07T04:59:51Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 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;
=== 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;
=== 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>Sdinaka</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=131039</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=131039"/>
		<updated>2019-12-07T04:50:25Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 creating a new user&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. create user through instructor filling up the form:&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 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;
[[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;
== 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>Sdinaka</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=131037</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=131037"/>
		<updated>2019-12-07T04:49:26Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 creating a new user&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) create user through instructor filling up the form:&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;
[[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 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;
[[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;
== 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>Sdinaka</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=131035</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=131035"/>
		<updated>2019-12-07T04:49:03Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 creating a new user&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;#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;
&amp;lt;font size = '3'&amp;gt;ii) create user through instructor filling up the form:&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;
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;
user creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&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 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;
[[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;
== 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>Sdinaka</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=131034</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=131034"/>
		<updated>2019-12-07T04:47:40Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* 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;
==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 creating a new user&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;#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;
&amp;lt;font size = '3'&amp;gt;ii) create user through instructor filling up the form:&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;
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;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&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 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;
[[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;
== 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>Sdinaka</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=131033</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=131033"/>
		<updated>2019-12-07T04:47:29Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* 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;
==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 creating a new user&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;#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;
&amp;lt;font size = '3'&amp;gt;ii) create user through instructor filling up the form:&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;
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;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&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;
==== Cases Tested ====&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&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 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;
[[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;
== 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>Sdinaka</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=131028</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=131028"/>
		<updated>2019-12-07T04:43:51Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 creating a new user&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;
==== 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;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&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;
==== 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;
&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 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;
[[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;
== 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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_import_file.JPG&amp;diff=131027</id>
		<title>File:New user import file.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_import_file.JPG&amp;diff=131027"/>
		<updated>2019-12-07T04:43:29Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_assignment.JPG&amp;diff=131025</id>
		<title>File:New user assignment.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_assignment.JPG&amp;diff=131025"/>
		<updated>2019-12-07T04:42:43Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=131022</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=131022"/>
		<updated>2019-12-07T04:42:10Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 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;
==== 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;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.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;
==== 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;
&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 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;
[[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;
== 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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_3.JPG&amp;diff=131021</id>
		<title>File:New user 3.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_3.JPG&amp;diff=131021"/>
		<updated>2019-12-07T04:41:38Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=131020</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=131020"/>
		<updated>2019-12-07T04:41:15Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 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;
==== 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;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
[[File:New_user_2.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;
==== 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;
&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 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;
[[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;
== 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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_2.JPG&amp;diff=131019</id>
		<title>File:New user 2.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_2.JPG&amp;diff=131019"/>
		<updated>2019-12-07T04:41:06Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=131018</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=131018"/>
		<updated>2019-12-07T04:40:33Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 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;
==== 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;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
[[File:New_user_1.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;
==== 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;
&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 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;
[[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;
== 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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_1.JPG&amp;diff=131016</id>
		<title>File:New user 1.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user_1.JPG&amp;diff=131016"/>
		<updated>2019-12-07T04:40:14Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=131015</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=131015"/>
		<updated>2019-12-07T04:39:50Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 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;
==== 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;
[[File:New_user.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;
==== 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;
&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 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;
[[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;
== 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>Sdinaka</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=131013</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=131013"/>
		<updated>2019-12-07T04:39:09Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 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;
==== 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;
[[New_user.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;
==== 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;
&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 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;
[[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;
== 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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user.JPG&amp;diff=131012</id>
		<title>File:New user.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New_user.JPG&amp;diff=131012"/>
		<updated>2019-12-07T04:38:56Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=131010</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=131010"/>
		<updated>2019-12-07T04:38:03Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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 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;
==== 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;
[[new.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;
==== 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;
&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 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;
[[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;
== 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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New.JPG&amp;diff=131008</id>
		<title>File:New.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New.JPG&amp;diff=131008"/>
		<updated>2019-12-07T04:37:21Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=131005</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=131005"/>
		<updated>2019-12-07T04:35:08Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
==== &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;
&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;
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;
==== 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;
&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;
==== 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;
&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 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;
[[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;
== 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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix_4.JPG&amp;diff=131004</id>
		<title>File:Reviewer fix 4.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix_4.JPG&amp;diff=131004"/>
		<updated>2019-12-07T04:34:52Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=131001</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=131001"/>
		<updated>2019-12-07T04:34:22Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
==== &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;
&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;
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;
&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;
==== 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;
&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 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;
[[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;
== 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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix_3.JPG&amp;diff=131000</id>
		<title>File:Reviewer fix 3.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix_3.JPG&amp;diff=131000"/>
		<updated>2019-12-07T04:34:04Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=130999</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=130999"/>
		<updated>2019-12-07T04:33:18Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
==== &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;
&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;
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;
&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;
==== 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;
&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 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;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
[[File:Reviewer_fix_2.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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix_2.JPG&amp;diff=130998</id>
		<title>File:Reviewer fix 2.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix_2.JPG&amp;diff=130998"/>
		<updated>2019-12-07T04:32:44Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=130997</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=130997"/>
		<updated>2019-12-07T04:32:00Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
==== &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;
&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;
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;
&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;
==== 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;
&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 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;
[[File:Reviewer_fix.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>Sdinaka</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=130995</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=130995"/>
		<updated>2019-12-07T04:31:26Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
==== &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;
&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;
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;
&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;
==== 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;
&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 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;
Reviewer_fix.JPG&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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix.JPG&amp;diff=130994</id>
		<title>File:Reviewer fix.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewer_fix.JPG&amp;diff=130994"/>
		<updated>2019-12-07T04:31:11Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=130965</id>
		<title>CSC/ECE 517 Fall 2019 - E1942. Refactor stage deadlines in assignment.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb&amp;diff=130965"/>
		<updated>2019-12-07T04:17:54Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Expertiza Background''' ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an assignment portal developed by faculties and students at NCSU. It provides a platform for the faculties to create assignments for the students. Faculties can assign assignments with staged deadlines. Expertiza supports creation of teams for the students, tracking the team members and  reviewing the work done by the other team members. Students can also review their peer team's assignment submission. Expertiza has been developed on Ruby on Rails and is available on github.&lt;br /&gt;
&lt;br /&gt;
== '''Project Description''' ==&lt;br /&gt;
Following is an OSS project which deals with refactoring of stage deadlines in the assignment.rb file. An assignment can have incremental deadlines for different topics in a single assignment. This project involves refactoring the functions in the assignment.rb file related to stage deadlines. There existed five functions to check the kind of stage an assignment is in. However, the names of these functions were ambiguous and functionalities implemented in some of them overlapped with each other. By the end of this project we have refactored these deadline functions.&lt;br /&gt;
&lt;br /&gt;
== '''Important Links''' ==&lt;br /&gt;
1. [https://152.46.19.152:8080\ VCL Link for expertiza deployed with changes] &amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1942._Refactor_stage_deadlines_in_assignment.rb\ OSS documentation] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Current Scenario''' ==&lt;br /&gt;
The assignment.rb file has the following functions implemented :&amp;lt;br&amp;gt;&lt;br /&gt;
1. current_stage_name(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
2. find_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
3. get_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
4. link_for_current_stage(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
5. stage_deadline(topic_id = nil)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Refractors implemented''' ==&lt;br /&gt;
The following is the list of refractors done in the code. It discusses the issues we found in the code with respect to Ruby conventions and the solutions that we provided for the same.&lt;br /&gt;
&lt;br /&gt;
==='''1.To avoid multiple calls to DueDate.get_next_due_date()'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with Existing code&amp;lt;/h4&amp;gt;&lt;br /&gt;
	In the existing code, DueDate.get_next_due_date(self.id, topic_id) has been called at numerous places. This does not follow the ruby coding standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	New private method next_due_date(topic_id) has been added. This function returns the next_due_date by calling the get_next_due_date method on DueDate.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 def next_due_date(topic_id = nil)&lt;br /&gt;
  DueDate.get_next_due_date(self.id, topic_id)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Following places have been refactored.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
[[File:duedate_lm.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Duedate_change.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''2.To not have finished status checked with static string “Finished”'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with Existing code&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The condition,  if @assignment.current_stage_name(@topic_id) != 'Finished',  have been used at various places to check finish status of assignment by comparing with “Finished”. This does not follow ruby coding standards, as we should never compare with static things. Otherwise it becomes difficult to refactor the code later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	Assignment is said to be finished if the next due is nil. A new private method finished? has been added. It calls the above next_due_date method and returns true if the next_due_date is nil.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb&lt;br /&gt;
&amp;lt;h4&amp;gt;Code&amp;lt;/h4&amp;gt;&lt;br /&gt;
 def finished?( topic_id = nil )&lt;br /&gt;
  next_due_date(topic_id).nil?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The check with “Finished” has been replaces with a call to finished? . The code has been refactored at following places.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
[[File:Finished.png]]&lt;br /&gt;
[[File:Finished_change.png]]&lt;br /&gt;
&lt;br /&gt;
==='''3.Return “Unknown” when topic_id is missing'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with existing code:&amp;lt;/h4&amp;gt;&lt;br /&gt;
	When it is staggered deadline and the topic_id is nil, “Unknown” is returned. This does not follow the DRY Principle. Never should we compare with static strings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	To make the code more readable and understandable, and to DRY out the code we have added a new private method topic_missing? to check if the topic is missing in case of staggered deadline.  &lt;br /&gt;
&lt;br /&gt;
File:app/models/assignment.rb &lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 def topic_missing?( topic_id = nil)&lt;br /&gt;
  topic_id.nil? and self.staggered_deadline?&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
The code has been refactored at following places:&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Topic_missing_change.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Topic_missing.PNG]]&lt;br /&gt;
&lt;br /&gt;
Topic_missing.PNG&lt;br /&gt;
&lt;br /&gt;
==='''4.find_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with the existing code:&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The method find_current_stage has been used locally in assignment.rb and once in students controller. However internally, this method calls the next_due_date method for the assignment which has already been separated out.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The method find_current_stage has been removed. The places where it was called has been replaced by a call to next_due_date method. &lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/controllers/student_controller.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 Before:&lt;br /&gt;
  due_date = find_current_stage(topic_id)&lt;br /&gt;
 &lt;br /&gt;
 After:&lt;br /&gt;
  due_date = DueDate.get_next_due_date(self.id.topic_id)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has been refactored in assignments.rb and the students controller at following places:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
[[File:Find_cur.PNG]]&lt;br /&gt;
[[File:Find_cur_change.PNG]]&lt;br /&gt;
&lt;br /&gt;
==='''5.link_for_current_stage method removed'''===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Problem with existing code&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The method link_for_current_stage was called once in list.html.erb. This method checks if the current assignment has any URL specified with it and would return it if present. However, the database has no such value. As a result, the if condition where the function was called always evaluated to false. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Solution&amp;lt;/h4&amp;gt;&lt;br /&gt;
	The function link_for_current_stage has been removed. The call to this function has also been removed and the code has been refactored accordingly.&lt;br /&gt;
&lt;br /&gt;
File: app/models/assignment.rb , app/views/list.html.erb&lt;br /&gt;
&lt;br /&gt;
The code in list.html.erb has been refactored as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Screenshots&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Link_for_change.PNG]]&lt;br /&gt;
&lt;br /&gt;
[[File:Link_for.PNG]]&lt;br /&gt;
&lt;br /&gt;
== '''Automated Testing using RSPEC''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Tests for get_current_stage()'''===&lt;br /&gt;
&lt;br /&gt;
The current stage of expertiza did not have any tests for get_current_stage. We have added the test for the same as follows:&lt;br /&gt;
&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
 describe '#get_current_stage ' do&lt;br /&gt;
    context 'when topic id is nil and current assignment has staggered deadline' do&lt;br /&gt;
      it 'returns Unknown' do&lt;br /&gt;
        allow(assignment).to receive(:topic_missing?).and_return(true)&lt;br /&gt;
        expect(assignment.get_current_stage).to eq('Unknown')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when current assignment does not have staggered deadline' do&lt;br /&gt;
      context 'when due date is nil' do&lt;br /&gt;
        it 'returns Finished' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(true)&lt;br /&gt;
          expect(assignment.get_current_stage (123)).to eq('Finished')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when due date is not nil and due date is not equal to Finished' do&lt;br /&gt;
        it 'returns current stage name' do&lt;br /&gt;
          allow(assignment).to receive(:finished?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:topic_missing?).with(123).and_return(false)&lt;br /&gt;
          allow(assignment).to receive(:next_due_date).with(123).and_return(assignment_due_date)&lt;br /&gt;
          deadline = create(:deadline_type, id: 1, name:&amp;quot;Review&amp;quot;)&lt;br /&gt;
          allow(DeadlineType).to receive(:find).with(1).and_return(deadline)&lt;br /&gt;
          expect(assignment.get_current_stage(123)).to eq('Review')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Tests for finished?'''===&lt;br /&gt;
&lt;br /&gt;
Tests for new finished? function have been added.&amp;lt;br&amp;gt;&lt;br /&gt;
File: spec/models/assignment_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Code snippet&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 describe '#finished?' do&lt;br /&gt;
    context 'when assignment next due date is nil' do&lt;br /&gt;
      it 'returns True' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1, 123).and_return(nil)&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(true)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#finished?' do&lt;br /&gt;
    context 'when there is a next due date' do&lt;br /&gt;
      it 'returns False' do&lt;br /&gt;
        allow(DueDate).to receive(:get_next_due_date).with(1,123).and_return('2021-11-11 11:11:11')&lt;br /&gt;
        expect(assignment.finished?(123)).to eq(false)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
topic_missing method is a private method and hence no tests have been added for the same.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
[mailto:onkashid@ncsu.edu Omkar Kashid]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:drao@ncsu.edu Deeksha Rao]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:sdinaka@ncsu.edu Swathi Dinakaran]&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=130892</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=130892"/>
		<updated>2019-12-07T03:47:14Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
==== 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>Sdinaka</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=130888</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=130888"/>
		<updated>2019-12-07T03:45:17Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
[[File:Fc-3.PNG|center|border]]&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;
==== 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>Sdinaka</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=130887</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=130887"/>
		<updated>2019-12-07T03:44:56Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
[[File:Fc-3.PNG|center|border]]&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:Fc-3.PNG|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;
==== 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>Sdinaka</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=130884</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=130884"/>
		<updated>2019-12-07T03:44:23Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
[[File:Fc-3.PNG|center|border]]&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;
Reset_password.JPG&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:Fc-3.PNG|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;
==== 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>Sdinaka</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=130883</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=130883"/>
		<updated>2019-12-07T03:44:11Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
Reset_password.JPG&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:Fc-3.PNG|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;
==== 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>Sdinaka</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=130882</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=130882"/>
		<updated>2019-12-07T03:43:15Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
Reset_password.JPG&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;
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;
==== 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>Sdinaka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reset_password.JPG&amp;diff=130880</id>
		<title>File:Reset password.JPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reset_password.JPG&amp;diff=130880"/>
		<updated>2019-12-07T03:41:28Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sdinaka</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=130824</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=130824"/>
		<updated>2019-12-07T03:20:23Z</updated>

		<summary type="html">&lt;p&gt;Sdinaka: /* Code Snippet */&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;
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;
&amp;lt;font size = '3'&amp;gt;2. 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;
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;
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;
&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;
==== 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>Sdinaka</name></author>
	</entry>
</feed>