CSC/ECE 517 Fall 2017/E1766 Test team functionality: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 146: Line 146:


== Result ==
== Result ==
[[File:new1.PNG|200px|Image: 200 pixels]]


[[File:new2.PNG|200px|Image: 200 pixels]]
Coverage increased (+0.2%) to 51.086% when pulling 46e4529 on ankit13jain:master into 781e456 on expertiza:master.


== External Links ==
== External Links ==

Revision as of 20:19, 27 October 2017

Background

Expertiza is an open source web based peer review system developed and maintained by students and faculty at North Carolina State University. It enables students enrolled in a particular course to form online teams and complete assignments. A typical cycle of an assignment involves the following major steps:

  • A pool of topics is made available to the students to choose from and form team to complete it within a pre-set deadline.
  • After the development phase is finished, begins the peer review phase. Here students can review work of other teams, on the basis of some predefined factors and provide their feedback.
  • Members of a team can also provide feedback for the respective review done for their work.
  • In some projects there is a second development phase which allows team members to improve upon their work keeping past reviews in consideration.
  • After this second development cycle begins another review phase, where original reviewers can re-review the updated work and provide critical feedback.

Purpose

The purpose of this task is to write functional tests for team functionality. Once an assignment is out, a student can select this assignment and others can join in the team. To test this functionality we wrote functional tests for the various scenarios. One such scenario is :

  • Once the assignment is out and a student selects it, he/she can send out invites to other students to join the team.
  • Invited students can accept the invitation and join the team.

Functional Tests

Functional tests ensure that the functionalities of a software system are working as expected. To write our functional tests, we used the Capybara gem available for Ruby. Capybara gem allows a user to test their web application through simulations.

Functional Tests Implementation

Functional Tests for Create group assignment

In Expertiza instructor can create public assignment for particular course, define the required rubrics and add students to that assignment.

The following test spec has been written to create public group assignment

def create_new_assignment
  login_as("instructor6")
  visit "/assignments/new?private=0"

  fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
  select('Course 2', from: 'assignment_form_assignment_course_id')
  fill_in 'assignment_form_assignment_directory_path', with: 'testDirectory'
  fill_in 'assignment_form_assignment_spec_location', with: 'testLocation'
  check("assignment_form_assignment_microtask")
  check("team_assignment")
  fill_in 'assignment_form_assignment_max_team_size', with: '3', visible: false
  check("assignment_form_assignment_reviews_visible_to_all")
  check("assignment_form_assignment_is_calibrated")
  check("assignment_form_assignment_availability_flag")
  expect(page).to have_select("assignment_form[assignment][reputation_algorithm]", options: ['--', 'Hamer', 'Lauw'])

  click_button 'Create'
end

Add topics to the assignment

def add_topic_to_assignment assignment
  visit "/assignments/#{assignment.id}/edit"
  click_link 'Topics'
  click_link 'New topic'
  fill_in 'topic_topic_identifier', with: '112'
  fill_in 'topic_topic_name', with: 'test_topic_1'
  fill_in 'topic_category', with: 'test_topic_1'
  fill_in 'topic_max_choosers', with: 3
  click_button 'Create'
  create(:assignment_due_date)
  create_list(:participant, 3)
end

Functional Tests for Log in as student and selecting a topic of assignment

When student login into his Expertiza account, he can check for new assignment under "Assignments" tab and choose the topic of his interest. Student then can send invitation to other students who are also enrolled in same course. We have written following test spec to impersonate as a student and select a topic

it "should impersonate as student" do
    user = User.find_by(name: "student2064")
    stub_current_user(user, user.role.name, user.role)
    visit '/student_task/list'
    # Assignment name
    expect(page).to have_content('public assignment for test')
    click_link 'public assignment for test'
    expect(page).to have_content('Submit or Review work for public assignment for test')

    click_link 'Signup sheet'
    expect(page).to have_content('Signup sheet for public assignment for test assignment')
    assignment_id = Assignment.first.id
    visit "/sign_up_sheet/sign_up?id=#{assignment_id}&topic_id=1"
    expect(page).to have_content('Your topic(s): test_topic_1') 
  end

Sending invitations to other students

    visit '/student_task/list'
    click_link 'public assignment for test'
    click_link 'Your team'
    expect(page).to have_content('public assignment for test_Team1')
    fill_in 'user_name', with: 'student2065'
    click_button 'Invite'
    fill_in 'user_name', with: 'student2066'
    click_button 'Invite'
    expect(page).to have_content('student2065')

Functional Tests for accepting an invitation

In Expertiza assignments, the only way for a student to join an existing team is to be invited by the leader.

Following test spec has been written to accept the invitation to join the team and verify that the assignment topic is assigned to all users

it "joins the team" do
    user = User.find_by(name: "student2065")
    stub_current_user(user, user.role.name, user.role)
    visit '/student_task/list'
    expect(page).to have_content('public assignment for test')
    visit '/invitation/accept?inv_id=1&student_id=1&team_id=1'
    visit '/student_teams/view?student_id=1'
    expect(page).to have_content('Team Information for public assignment for test')

    # to test invalid case - student who is not part of the team does not have created assignment
    user = User.find_by(name: "student2066")
    stub_current_user(user, user.role.name, user.role)
    visit '/student_task/list'
    page.should has_no_content?('public assignment for test')
  end

Functional Tests for whether students choosing the same topic are in the same team

Since the only way for students to be in a team is by invitation, students who choose the same topic will be in different team. Our test is to let two different students select the same topic and see if their teammates contains each other. Therefore, first we let ‘student2064’ and 'student2065' sign for the same topic, and in their pages, to see if there is 'student2065' or 'student2064'.

      expect(page).to have_content "Team Name"
      expect(page).to have_content "student2065"
      expect(page).to have_content "student2064"

Running the tests

The tests can be run on the terminal by navigating to the /spec/features directory using the command:

 rspec team_functionalities_spec.rb

Whether the test fails or succeeds, allows us to determine which parts of the system are functioning properly.

Result

Coverage increased (+0.2%) to 51.086% when pulling 46e4529 on ankit13jain:master into 781e456 on expertiza:master.

External Links

  1. link for forked repository [[1]]
  2. Github link for original repository [[2]]
  3. Github link for Capybara [[3]]