<?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=Vpshah</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=Vpshah"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Vpshah"/>
	<updated>2026-08-11T09:17:24Z</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=131109</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=131109"/>
		<updated>2019-12-07T06:28:27Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method calls the email function to notify the reviewee&lt;br /&gt;
[[File:Reviewee2.PNG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
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>Vpshah</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=131107</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=131107"/>
		<updated>2019-12-07T06:26:00Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewee2.PNG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131106</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=131106"/>
		<updated>2019-12-07T06:24:27Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewee2.PNG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[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>Vpshah</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewee2.PNG&amp;diff=131105</id>
		<title>File:Reviewee2.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewee2.PNG&amp;diff=131105"/>
		<updated>2019-12-07T06:24:16Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131104</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=131104"/>
		<updated>2019-12-07T06:23:16Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
==== 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:Reviewee.PNG|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>Vpshah</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewee.PNG&amp;diff=131103</id>
		<title>File:Reviewee.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reviewee.PNG&amp;diff=131103"/>
		<updated>2019-12-07T06:22:43Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: uploaded a new version of &amp;amp;quot;File:Reviewee.PNG&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Issue2 screenshot&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131102</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=131102"/>
		<updated>2019-12-07T06:14:50Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
==== 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>Vpshah</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reset_positive.PNG&amp;diff=131098</id>
		<title>File:Reset positive.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reset_positive.PNG&amp;diff=131098"/>
		<updated>2019-12-07T06:07:39Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vpshah</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Reset_negative.PNG&amp;diff=131097</id>
		<title>File:Reset negative.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Reset_negative.PNG&amp;diff=131097"/>
		<updated>2019-12-07T06:07:29Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131095</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=131095"/>
		<updated>2019-12-07T06:00:10Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;II. Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;III. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; IV. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131092</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=131092"/>
		<updated>2019-12-07T05:52:45Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
[[File:Instructor create.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
*User creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&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;
[[File:User request3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:User request4.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;II. Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;III. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = 4&amp;gt; IV. Reviewer gets mail when authors resubmit work&amp;lt;/font&amp;gt; ===&lt;br /&gt;
This will be mainly the case when there will be more than one round of the submission. After the first submission, some users will be assigned to review the submitted work. Now, in second round of the submission, whenever author resubmits or edit their work, then in that case all the reviewers assigned to that author should get email notification stating new submission is available for them to review.&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/submitted_content_controller.rb&lt;br /&gt;
#app/helpers/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Author should receive email notification upon review submission ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. &lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method named send_email_to_reviewee which will trigger an email to the author. The function call to this method is added to the 'update' and 'create' methods of Response Controller that will be called on submission/updation of review&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_2.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131090</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=131090"/>
		<updated>2019-12-07T05:47:22Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
email count should be zero when user requests account with an invalid email address&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
email count should be one when user requests account with a valid email address&lt;br /&gt;
[[File:User request2.PNG|center|border]]&lt;br /&gt;
user creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:User request3.PNG|center|border]]&lt;br /&gt;
[[File:User request4.PNG|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>Vpshah</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:User_request4.PNG&amp;diff=131089</id>
		<title>File:User request4.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:User_request4.PNG&amp;diff=131089"/>
		<updated>2019-12-07T05:46:28Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131088</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=131088"/>
		<updated>2019-12-07T05:41:50Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
email count should be zero when user requests account with an invalid email address&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
email count should be one when user requests account with a valid email address&lt;br /&gt;
[[File:User request2.PNG|center|border]]&lt;br /&gt;
user creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:User request3.PNG|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>Vpshah</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:User_request3.PNG&amp;diff=131087</id>
		<title>File:User request3.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:User_request3.PNG&amp;diff=131087"/>
		<updated>2019-12-07T05:41:00Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131086</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=131086"/>
		<updated>2019-12-07T05:37:06Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
email count should be zero when user requests account with an invalid email address&lt;br /&gt;
[[File:User request1.PNG|center|border]]&lt;br /&gt;
email count should be one when user requests account with a valid email address&lt;br /&gt;
[[File:User request2.PNG|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>Vpshah</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=131085</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=131085"/>
		<updated>2019-12-07T05:36:11Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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:User request2.PNG|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>Vpshah</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:User_request2.PNG&amp;diff=131084</id>
		<title>File:User request2.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:User_request2.PNG&amp;diff=131084"/>
		<updated>2019-12-07T05:35:24Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131082</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=131082"/>
		<updated>2019-12-07T05:30:56Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* 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: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>Vpshah</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:User_request1.PNG&amp;diff=131081</id>
		<title>File:User request1.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:User_request1.PNG&amp;diff=131081"/>
		<updated>2019-12-07T05:29:54Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131070</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=131070"/>
		<updated>2019-12-07T05:21:53Z</updated>

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

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

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

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

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

		<summary type="html">&lt;p&gt;Vpshah: /* 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;
=== &amp;lt;font size = '4'&amp;gt;I. Creating a new user Account&amp;lt;/font&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a new user account in Expertiza. Irrespective of the user creation method, the newly added user should get notified via email when his account is created in the system. This email states the username and a randomized password to allow the user to login for the first time.&lt;br /&gt;
Below given are the ways to create new user to system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;1. By filling a user creation form&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An instructor can add a new user to the system by filling up a user creation form &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;2. By importing a CSV file&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The instructor can add new users to the system by importing a CSV file with user information&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-3.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;3. By importing a CSV file to add participants to an assignment&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instructor can add participants to an assignment by importing the users from a CSV. If the user listed in the CSV does not already exist in the system, then the a new user account is created and the user is added to the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-1.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '3'&amp;gt;4. User requests an account&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A user can request an account by filling up a form with his details. These details get saved in the requested users table. Also, the super administrator will see these details in his pending requests section. The superadmin can approve/reject such requests.  &lt;br /&gt;
If the superadmin approves a request, a new user account is created in the system and the user receives an account creation email notification &lt;br /&gt;
&lt;br /&gt;
[[File:Fc-2.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Cases Tested&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
'''The following features were checked for all cases as part of the email functionality when a new user is created'''&lt;br /&gt;
# Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#  Sender email-id is verified. The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#  Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since the default recipient is 'expertiza.development@gmail.com' in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
# The subject is checked to be equal to 'Your Expertiza account and password has been created'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We considered the following cases while testing specific to the scenario where user requests an account: &amp;lt;br&amp;gt;&lt;br /&gt;
#No email should be sent if new account requested with invalid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Super admin should receive email about new account request with a valid email address&amp;lt;br&amp;gt;&lt;br /&gt;
#Email notification should be sent to requester when super admin approves account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
#No email notification should be sent to requester when super admin rejects account creation request&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Capybara Tests&amp;lt;/font&amp;gt; ====&lt;br /&gt;
We used Capybara to model the scenario as follows:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''I. create user through instructor filling up the form:'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Admin user is created using factory class.&amp;lt;br&amp;gt;	&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.login_as 'admin_user'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
3.visit list of users&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
4.click New User link&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
5.fill user_name with 'teststudent'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user_fullname with 'test student'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
8.check checkbox to send email to user on review&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size = '2'&amp;gt;'''II. user requests a new account and account is created upon approval from superadmin'''&amp;lt;br&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
super admin is created using factory class.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.visit expertiza&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.click Request Account link&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.select instructor from dropdown&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.fill user name with 'requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.fill user fullname with 'requester1, requester1'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.fill user email with 'test.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.fill user_email with 'test@student.com'&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.select 'North Carolina State University' from user institution &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.click 'Create' button.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.visit list of pending requests from users&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.Requested user's status is first 'Under Review' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.Set status as Approved or Rejected &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
13.click on 'Submit' button &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
user creation by instructor:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user.JPG|center|border]]&lt;br /&gt;
user creation by user request&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_2.JPG|center|border]]&lt;br /&gt;
[[File:New_user_3.JPG|center|border]]&lt;br /&gt;
user creation by importing csv files&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:New_user_assignment.JPG|center|border]]&lt;br /&gt;
[[File:New_user_import_file.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;font size = '4'&amp;gt;II. Resetting Password&amp;lt;/font&amp;gt; ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;III. Authors get mail on receiving review&amp;lt;/font&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Whenever someone reviews other student or team’s work, then that student or all the members of that team should get notified through the email stating that new peer review is available for your work.&lt;br /&gt;
Even when the reviewer updates the reviews, then also that student or all the team members should get notified that updated comments are present on their submitted work.&lt;br /&gt;
&lt;br /&gt;
[[File:Fc-5.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
#app/controllers/response_controller.rb&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
&lt;br /&gt;
Following parameters need to be tested:&lt;br /&gt;
*Whenever reviewer reviews some team’s work, in that case all the team members should receive an email. So, number of emails delivered should be number of participants assigned to that work.&lt;br /&gt;
&lt;br /&gt;
=== 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>Vpshah</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=131057</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=131057"/>
		<updated>2019-12-07T05:01:35Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Resetting Password */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== &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;
&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>Vpshah</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=131055</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=131055"/>
		<updated>2019-12-07T05:00:48Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Creating a new user Account */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==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.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>Vpshah</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=131054</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=131054"/>
		<updated>2019-12-07T05:00:36Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Creating a new user Account */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==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;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.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>Vpshah</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=131050</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=131050"/>
		<updated>2019-12-07T04:57:31Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Capybara Tests */&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;
[[File:Reviewer_fix_3.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewer_fix_4.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Reviewer will receive an email notification upon resubmission of the work by the author ===&lt;br /&gt;
For the assignments which have multiple submission rounds, after review round if the author changes the work, the reviewer should be notified of this change. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
We have added a new method 'email_all_reviewers' to submitted_content_controller which will send an email to all the reviewers of the work. &lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Vpshah</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=131047</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=131047"/>
		<updated>2019-12-07T04:56:41Z</updated>

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

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

		<summary type="html">&lt;p&gt;Vpshah: /* Capybara Tests */&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. 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 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>Vpshah</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=131038</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=131038"/>
		<updated>2019-12-07T04:50:08Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Capybara Tests */&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>Vpshah</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=131036</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=131036"/>
		<updated>2019-12-07T04:49:10Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Capybara Tests */&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;
[[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>Vpshah</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=131032</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=131032"/>
		<updated>2019-12-07T04:46:52Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Capybara Tests */&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;
==== 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>Vpshah</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=131031</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=131031"/>
		<updated>2019-12-07T04:46:14Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Capybara Tests */&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 ====&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;&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>Vpshah</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=131030</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=131030"/>
		<updated>2019-12-07T04:45:22Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Outcome */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== 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;
==== Capybara Tests ====&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;
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>Vpshah</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=131026</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=131026"/>
		<updated>2019-12-07T04:42:58Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Cases Tested */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== 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;
&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>Vpshah</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=131024</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=131024"/>
		<updated>2019-12-07T04:42:43Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Cases Tested  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== 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;
#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>Vpshah</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=131007</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=131007"/>
		<updated>2019-12-07T04:36:26Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Creating a new user Account */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==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;
&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>Vpshah</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=131006</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=131006"/>
		<updated>2019-12-07T04:35:33Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Cases Tested  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== 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;
&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>Vpshah</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=131002</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=131002"/>
		<updated>2019-12-07T04:34:48Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Cases Tested  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== 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;
== 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>Vpshah</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=130993</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=130993"/>
		<updated>2019-12-07T04:30:43Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Cases Tested  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== 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;
== 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>Vpshah</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=130992</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=130992"/>
		<updated>2019-12-07T04:30:07Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Cases Tested  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Expertiza Background ==&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and the code is available on Github. It allows students to review each other’s work and improve their work upon this feedback. Students and Instructors (including TA's) use this application though their credentials. Instructors can add new projects, assignments etc as well edit the previous ones and at a later stage can see the student submission and grade them. They can even put a time limit (deadline) for submitting the assignment. Students can form teams for the projects, submit their work through handles (Wiki page, link to a video etc). Students can even review their teammates and other peers, as well give them any suggestions if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Expertiza system requires sending emails to students and instructors on occurrence of various events or to facilitate actions further.&lt;br /&gt;
&lt;br /&gt;
Email notifications are sent out when the following events occur:&lt;br /&gt;
#The author of a submission gets notified via email when a reviewer has reviewed their work and the feedback is available to view.&lt;br /&gt;
#The reviewer receives an email when work has been submitted/resubmitted by an author whose work needs to reviewed.&lt;br /&gt;
#An account holder is emailed when a new account is created.&lt;br /&gt;
#A confirmation email is sent to a user of the system when they reset their Expertiza account password&lt;br /&gt;
&lt;br /&gt;
In the current scenario, it has been identified that not all emailing functionalities are working as desired. &lt;br /&gt;
Also, presently, there is little evidence to claim that the existing implementation is covering all cases and handling all necessary conditions.&lt;br /&gt;
&lt;br /&gt;
Our project is to build robust test suite  for mailer functionality that is currently implemented in Expertiza. Developing this would ensure that all the  mailing features are backed up with a stronger set of test features.&lt;br /&gt;
&lt;br /&gt;
== Approach Chosen and Why?==&lt;br /&gt;
In this project we have first identified all the set of scenarios where the user of the system will get an email. Each of the four scenarios are identified as mentioned above and has been subdivided into a number of ways in which it can be realized. This will ensure that each of the mailers will be robust to any kind of unexpected changes and that the functionality will not be broken when deployed in production. We have chosen to bring about this robustness of test by writing unit test and functional tests using RSpec and Capybara respectively. Unit Tests will ensure that the particular functionality is being tested in a isolated setup which would even include the edge cases whereas the functional tests will ensure that this mailing feature is in resonance with the other features and works coherently.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== 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;
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;
== 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>Vpshah</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=130991</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=130991"/>
		<updated>2019-12-07T04:28:51Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &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;
&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;
&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;
== 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>Vpshah</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=130985</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=130985"/>
		<updated>2019-12-07T04:26:20Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &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;
&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;
&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;
=== 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;
&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
# Author receiving email&lt;br /&gt;
#&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Vpshah</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=130982</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=130982"/>
		<updated>2019-12-07T04:23:34Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: &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;
&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;
&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;
=== Resetting Password ===&lt;br /&gt;
When the user tries to login, and the password entered is wrong, the user is redirected to reset password page.&lt;br /&gt;
[[File:Forgotpwd.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
Here the email-id entered is searched through the database, &lt;br /&gt;
If such user account is found: url for reset is generated, with random token set as password is sent to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Flowchart:&lt;br /&gt;
&lt;br /&gt;
[[File:Flow.PNG|center|border]]&lt;br /&gt;
&lt;br /&gt;
==== Cases Tested ====&lt;br /&gt;
*User enters email id which is not associated with any account&amp;lt;br&amp;gt;&lt;br /&gt;
**No e-mail should be sent&lt;br /&gt;
*User enters email id that's present in the user database&amp;lt;br&amp;gt;&lt;br /&gt;
**The following features were checked inside 'it blocks' as part of verifying email functionality&amp;lt;br&amp;gt;&lt;br /&gt;
#Mail delivery count increased by 1 after the mail triggered by the scenario is sent&amp;lt;br&amp;gt;&lt;br /&gt;
#The sender mail-id is verified to be 'expertiza.development@gmail.com'&amp;lt;br&amp;gt;&lt;br /&gt;
#Receiver email id is checked to be equal to 'expertiza.development@gmail.com' . Since all mails triggered have a record in 'expertiza.development@gmail.com' when executed in test environment.&amp;lt;br&amp;gt;&lt;br /&gt;
#The subject is checked to be equal to 'Expertiza password reset'&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files associated with this functionality:&lt;br /&gt;
# spec/controllers/PasswordRetrievalController&lt;br /&gt;
# app/controllers/PasswordRetrievalController&lt;br /&gt;
# app/mailers/mailer.rb&lt;br /&gt;
# app/helper/mailer_helper.rb&lt;br /&gt;
&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
We used Capybara to model the scenario with following steps:&amp;lt;br&amp;gt;&lt;br /&gt;
1. Visit expertiza home page&amp;lt;br&amp;gt;&lt;br /&gt;
2. Click 'Forgot password?' link	&amp;lt;br&amp;gt;&lt;br /&gt;
3. After rediection to password retrieval page&amp;lt;br&amp;gt;&lt;br /&gt;
4. Fill in user email field with 'expertiza@mailinator.com'&amp;lt;br&amp;gt;&lt;br /&gt;
5. Click on 'Request password' button&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Reset_password.JPG|center|border]]&lt;br /&gt;
&lt;br /&gt;
== Fixing out of scope bugs ==&lt;br /&gt;
=== Account Creation ===&lt;br /&gt;
When student accounts are created by importing a CSV file on the Users page, they receive e-mails with their user-ID and password.&lt;br /&gt;
However, if an account is created by adding them as participants to an assignment when they don't already have an account, e-mail notification is not being sent.&lt;br /&gt;
&lt;br /&gt;
==== What we fixed ====&lt;br /&gt;
The issue here was that an already existing user in the system will not get added as a participant on the assignment.&lt;br /&gt;
&lt;br /&gt;
We fixed the issue by creating a new user if one doesn't exist and we enabling the email functionality by adding the .deliver_now method&lt;br /&gt;
&lt;br /&gt;
This method invokes the mailer to deliver an email immediately.&lt;br /&gt;
&lt;br /&gt;
Now that we have enabled the email functionality irrespective of where a new user is created from, we don't need to explicitly call the mailer from each location where new user is created. The email body was inconsistent across different scenarios. We had fixed this as well.&lt;br /&gt;
&lt;br /&gt;
==== Outcome  ====&lt;br /&gt;
If the user does not exist in the system,  new user account (if there is sufficient information about the user to create a new Expertiza account) is created&lt;br /&gt;
&lt;br /&gt;
If the user already exists as a participant on the assignment, do nothing Add the user to the assignment as a participant; otherwise.&lt;br /&gt;
&lt;br /&gt;
This way, the user(whether newly created or already an Expertiza user) gets added on the assignment as a participant.&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
[[File:Email_fix.JPG]]&lt;br /&gt;
&lt;br /&gt;
[[File:BadgerAddParticipant2.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== Author Review ===&lt;br /&gt;
After the reviewer submits the review, the author should get an email notification about this. Also, the instructor should receive an email about the same. This function is not currently working in the beta version. Also, if at all the author resubmits the work, the reviewer as well as the instructor should get an email about the change that was done. This is not currently functional in expertiza beta. As discussed with our mentor, we have successfully fixed that issue and now in both of the cases as discussed above, the intended users( author in first scenario and reviewer and instructor in second one) are receiving the email notification.&lt;br /&gt;
==== What we fixed====&lt;br /&gt;
# Author receiving email&lt;br /&gt;
#&lt;br /&gt;
==== Outcome ====&lt;br /&gt;
&lt;br /&gt;
==== Code Snippet ====&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
#Mohit Jain(mentor)&lt;br /&gt;
#Vishva Shah (vpshah@ncsu.edu)&lt;br /&gt;
#Urvish Vasani (uvasani@ncsu.edu)&lt;br /&gt;
#Tanvi Pandit(tmpandi2@ncsu.edu)&lt;br /&gt;
#Swathi Dinakaran(sdinaka@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Demo link&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo, [https://github.com/vishva1001/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza/pull/1632 here]&lt;/div&gt;</summary>
		<author><name>Vpshah</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=130973</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=130973"/>
		<updated>2019-12-07T04:19:49Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Developed By */&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;
== 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>Vpshah</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=130847</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=130847"/>
		<updated>2019-12-07T03:31:02Z</updated>

		<summary type="html">&lt;p&gt;Vpshah: /* Approach Chosen and Why? Implementation */&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;
&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>Vpshah</name></author>
	</entry>
</feed>