CSC/ECE 517 Fall 2015 E1581 Integration testing for student interface: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(24 intermediate revisions by 4 users not shown)
Line 8: Line 8:


'''Capybara''' is a web-based automation framework used for creating functional tests which can simulate how users would interact with your application.
'''Capybara''' is a web-based automation framework used for creating functional tests which can simulate how users would interact with your application.
==Setup==
In order to run these test successfully the test data must be inserted into the expertiza_test database.  To add the test data to the database run this command: "mysql -u root -p -h localhost expertiza_test < spec/features/db/TestData.sql".  You should now be able to run the integration tests.


== Test Plan ==
== Test Plan ==
Line 27: Line 29:
When we sign in with correct name and password; we expect that there should be content ‘User: (username)’ appear in the new page.
When we sign in with correct name and password; we expect that there should be content ‘User: (username)’ appear in the new page.


==== We have test file "student_sign_in.rb" do this task. Run test using command " rspec spec/features/student_sign_in_spec.rb"====
Run test using the command "rspec spec/features/student_sign_in_spec.rb"


=== Add someone to a team ===
=== Add someone to a team ===
Line 44: Line 46:
On this page, we expect the sender's name will appear.
On this page, we expect the sender's name will appear.


====We have "add_member_spec.rb" to do this task. Run test using the command "rspec spec/features/add_member_spec.rb "====
Run test using the command "rspec spec/features/add_member_spec.rb "


=== Select a topic ===
=== Select a topic ===
Line 55: Line 57:
# click the sign up for the remaining topic we want, as this user has already signed up for this topic, we should get the following message: Your topic(s): Self-plagiarism. 
# click the sign up for the remaining topic we want, as this user has already signed up for this topic, we should get the following message: Your topic(s): Self-plagiarism. 
# sign out 
# sign out 
Run test using the command "rspec spec/features/select_a_topic_spec.rb "


=== Select a submission to review ===
=== Select a submission to review ===
Line 62: Line 66:
# click the link for the submission we want to review
# click the link for the submission we want to review
# sign out 
# sign out 
Run test using the command "rspec spec/features/select_a_submission_to_review_spec.rb "


=== Bring up a review form ===
=== Bring up a review form ===
Repeated for an assignment without a topic and an assignment with a topic
* Scenario 1: Choose a topic to review
# sign in.  
# sign in.  
# click the link for the assignment we want to review.
# click the link for the assignment we want to review.
# click the link for “other’s work”
# click the link for “other’s work”
# choose a topic
# click 'Begin'
# click 'Begin'
# check that a review form has successfully been created
# check that a review form has successfully been created
* Scenario 2: Choose a random topic
# sign in.  
# click the link for the assignment we want to review.
# click the link for “other’s work”
# check 'I do not care'
# click 'Request new submission' button
# click 'Begin' to open review form
# check that a review form has successfully been created
* Scenario 3: Review an assignment without a topic
# sign in.  
# click the link for the assignment we want to review.
# click the link for “other’s work”
# click 'Request new submission' button
# click 'Begin' to open review form
# check that a review form has successfully been created
Run test using the command "rspec spec/features/bring_up_review_form_spec.rb "


=== Fill out and submit a review form ===
=== Fill out and submit a review form ===
* Scenario 1:
* Scenario 1: Fill out form and save
Note: Do this for an assignment without a topic and an assignment with a topic.
# sign in.  
# sign in.  
# click the link for the assignment we want to review.
# click the link for the assignment we want to review.
# click the link for “other’s work”
# click the link for “other’s work”
# open a review form
# click 'Begin'
# fill out all text fields
# fill out all text fields
# select all scores from dropdowns
# save form
# submit form
# check for successful save
# check for successful save
 
* Scenario 2: Fill out form, save, edit, and resave
* Scenario 2:
# open a review form
# sign in.  
# sign in.  
# click the link for the assignment we want to review.
# click the link for the assignment we want to review.
# click the link for “other’s work”
# click the link for “other’s work”
# fill out some text fields
# click 'Begin'
# select some scores
# fill out one text field
# save form
# reopen form
# fill out remaining fields and scores
# save form
# save form
# click edit
# fill out other text fields
# click save
# check for successful save
# check for successful save
Run test using the command "rspec spec/features/fill_out_review_form_spec.rb "


=== View your scores ===
=== View your scores ===
Line 108: Line 127:
# Click ‘Your scores’
# Click ‘Your scores’
# Check that displayed scores match scores independently calculated from all reviews.
# Check that displayed scores match scores independently calculated from all reviews.
To run this test run: $ rspec spec/features/student_view_score.rb


=== Respond to a review (“author feedback”) ===
=== Respond to a review (“author feedback”) ===
Line 117: Line 137:
# Fill out Feedback form
# Fill out Feedback form
# Click Save Feedback
# Click Save Feedback
# Sign out
# Check for confirmation that the feedback was saved
# Sign in as reviewer
To run this test run:$ rspec spec/features/review_feedback.rb
# Click link for Assignment
# Click ‘Other’s work’
# Check that a feedback exists.


==Links==
==Links==
*Github repository:  https://github.com/xhy279/expertiza/tree/fall2015/spec/features
*Github repository:  https://github.com/xhy279/expertiza/tree/fall2015/spec/features
*Demo videos(4 in total):  
*Pull requests link: https://github.com/expertiza/expertiza/pull/640
1. https://drive.google.com/open?id=0B3EOsci5DEveMGZOdVNIazJlNVE
*Demo videos(4 in total): <br>
2.
1. https://drive.google.com/open?id=0B3EOsci5DEveMGZOdVNIazJlNVE <br>
3.
2. https://drive.google.com/a/ncsu.edu/file/d/0B-l-xu44qiJUZDRFMU02U09kZWs/view?usp=sharing <br>
4.https://drive.google.com/a/ncsu.edu/file/d/0B7dSj1bvwNp9X29TTHJMVFhPWkE/view?usp=sharing
3. https://drive.google.com/a/ncsu.edu/file/d/0B80MLsKsoSOmaVV5Tm1mQWIwb0U/view?usp=sharing <br>
4. https://drive.google.com/a/ncsu.edu/file/d/0B7dSj1bvwNp9X29TTHJMVFhPWkE/view?usp=sharing <br>
Note: There is a problem at the end of the third video and the save can not complete because of a time out issue. This does not effect the test, just the ability to demonstrate the test.

Latest revision as of 15:25, 16 December 2015

Create integration tests for the student interface using capybara and rspec. Integration testing is the phase in software testing in which individual software modules are combined and tested as a group. It occurs after unit testing and before validation testing. Integration testing takes as its input modules that have been unit tested, groups them in larger aggregates, applies tests defined in an integration test plan to those aggregates, and delivers as its output the integrated system ready for system testing.

Design

To properly execute the integration tests we will write the test cases to mimic a user operating the system. We will create strong integration test cases to help ensure the outcome of application's student interface remains the same regardless of changes to its inner functionality. In an attempt to keep our tests DRY we will put common code in a support directory.

Testing tools

RSpec is a behavior-driven development (BDD) framework for the Ruby (programming language)|Ruby programming language, inspired by JBehave. It contains its own mocking framework that is fully integrated into the framework based upon JMock.

Capybara is a web-based automation framework used for creating functional tests which can simulate how users would interact with your application.

Setup

In order to run these test successfully the test data must be inserted into the expertiza_test database. To add the test data to the database run this command: "mysql -u root -p -h localhost expertiza_test < spec/features/db/TestData.sql". You should now be able to run the integration tests.

Test Plan

There are 8 features to be tested:

  1. Log in
  2. Add someone to a team
  3. Select a topic(if the assignment has topics)
  4. Select a submission to review For assignments with or without topics
  5. Bring up a review form
  6. Fill out & submit a review form
  7. View your scores
  8. Respond to a review (“author feedback”)

Log in

we create a file called ‘student_signin_spec.rb’.  We define a method named login; and because we need this method in every later  feature test we will put this in the support directory.

  • Scenario 1: Log in with ‘invalid combination of username and password’

When we sign in with correct name and password; we expect that there should be content ‘Invalid username/password’ appear in the new page.

  • Scenario 2: Log in with ‘valid combination of username and password’

When we sign in with correct name and password; we expect that there should be content ‘User: (username)’ appear in the new page.

Run test using the command "rspec spec/features/student_sign_in_spec.rb"

Add someone to a team

  • Scenario 1: Team member exceed max amount
  1. Sign in 
  2. Click link certain assignment(in this test: Ethical analysis 2)
  3. Click link  “Your team” 
  4. Fill in the text area with invitation receiver name
  5. Click send invitation button
  6. Sign out.
  7. Sign in as receiver
  8. Click link assignment
  9. Click link  “Your team”
  10. Click  button ‘accept’

On this page, we expect the sender's name will appear.

Run test using the command "rspec spec/features/add_member_spec.rb "

Select a topic

Note: assignment has topics

We need the following steps:

  1. sign in. 
  2. click the link for assignment 
  3. click link  “signup sheet”
  4. click the sign up for the remaining topic we want, as this user has already signed up for this topic, we should get the following message: Your topic(s): Self-plagiarism. 
  5. sign out 

Run test using the command "rspec spec/features/select_a_topic_spec.rb "


Select a submission to review

  1. sign in.  
  2. click the link for the assignment we want to review.
  3. click the link for “other’s work”
  4. click the link for the submission we want to review
  5. sign out 

Run test using the command "rspec spec/features/select_a_submission_to_review_spec.rb "

Bring up a review form

  • Scenario 1: Choose a topic to review
  1. sign in.  
  2. click the link for the assignment we want to review.
  3. click the link for “other’s work”
  4. choose a topic
  5. click 'Begin'
  6. check that a review form has successfully been created
  • Scenario 2: Choose a random topic
  1. sign in.  
  2. click the link for the assignment we want to review.
  3. click the link for “other’s work”
  4. check 'I do not care'
  5. click 'Request new submission' button
  6. click 'Begin' to open review form
  7. check that a review form has successfully been created
  • Scenario 3: Review an assignment without a topic
  1. sign in.  
  2. click the link for the assignment we want to review.
  3. click the link for “other’s work”
  4. click 'Request new submission' button
  5. click 'Begin' to open review form
  6. check that a review form has successfully been created

Run test using the command "rspec spec/features/bring_up_review_form_spec.rb "

Fill out and submit a review form

  • Scenario 1: Fill out form and save
  1. sign in.  
  2. click the link for the assignment we want to review.
  3. click the link for “other’s work”
  4. click 'Begin'
  5. fill out all text fields
  6. save form
  7. check for successful save
  • Scenario 2: Fill out form, save, edit, and resave
  1. sign in.  
  2. click the link for the assignment we want to review.
  3. click the link for “other’s work”
  4. click 'Begin'
  5. fill out one text field
  6. save form
  7. click edit
  8. fill out other text fields
  9. click save
  10. check for successful save

Run test using the command "rspec spec/features/fill_out_review_form_spec.rb "

View your scores

  • Scenario 1: No Scores available yet
  1. Sign in
  2. Click link for Assignment
  3. Click ‘Your scores’
  4. Check that nothing exists yet
  5. Check for dashes.
  • Scenario 2: Scores available.
  1. Sign in
  2. Click link for Assignment
  3. Click ‘Your scores’
  4. Check that displayed scores match scores independently calculated from all reviews.

To run this test run: $ rspec spec/features/student_view_score.rb

Respond to a review (“author feedback”)

  1. Sign in as author
  2. Click link for Assignment
  3. Click ‘Your scores’
  4. Click ‘show reviews’
  5. Click ‘Give feedback’
  6. Fill out Feedback form
  7. Click Save Feedback
  8. Check for confirmation that the feedback was saved

To run this test run:$ rspec spec/features/review_feedback.rb

Links

1. https://drive.google.com/open?id=0B3EOsci5DEveMGZOdVNIazJlNVE
2. https://drive.google.com/a/ncsu.edu/file/d/0B-l-xu44qiJUZDRFMU02U09kZWs/view?usp=sharing
3. https://drive.google.com/a/ncsu.edu/file/d/0B80MLsKsoSOmaVV5Tm1mQWIwb0U/view?usp=sharing
4. https://drive.google.com/a/ncsu.edu/file/d/0B7dSj1bvwNp9X29TTHJMVFhPWkE/view?usp=sharing
Note: There is a problem at the end of the third video and the save can not complete because of a time out issue. This does not effect the test, just the ability to demonstrate the test.