CSC/ECE 517 Fall 2017/E1754 Feature test of rubric advice

From Expertiza_Wiki
Revision as of 20:19, 27 October 2017 by Rcoutin (talk | contribs)
Jump to navigation Jump to search

Introduction

Expertiza is a web application which provides a dashboard to the students where they can submit and peer-review assignments, projects, codes, and other such objects. It allows students to review each other’s work and improve their work upon this feedback. Rubric advice allows reviewers to see what characteristics of work merit a particular score.


The problem statement

Rubric advice lets a user see what criterion or characteristics of work merit a particular score. An instructor can retrieve peer review assignments and leave some advice or give scores based on some criteria. Similarly, students can log in and retrieve the rubric advice left by the instructor. We mocked the behavior of the user (both as an instructor and student) to see how different scenarios work, like modifying, saving and retrieving advice and building feature tests for it. The testing frameworks used for the same were Selenium and Capybara.


Tasks identified

Student Side: A student, when filling a peer review should be able to see the rubric advice associated with a particular test score. We test this task through adding a test case in the peer_review_spec.rb since Peer Review is superset of the Rubric Advice feature as it is a task where a student uses the rubric advice and submit it.

Files changed: peer_review_spec.rb The test case checks if student is able to select a rubric advice that the instructor has created and then submit it.

  it "able to view and use rubric advice", :js => true do
    load_questionnaire
    expect(page).to have_content "Show advice"
    page.find('#showAdivce_1').click
    expect(page).to have_content "5 - Good"
    page.find("a", :text => "5 - Good").click
    click_button "Save Review"
    expect(page).to have_content "Your response was successfully saved."
  end

The existing code given creates the required environment for the test student. It sets up a team, assignment and other required elements for the test student to submit a review.

before(:each) do
    create(:assignment, name: "TestAssignment", directory_path: 'test_assignment')
    create_list(:participant, 3)
    create(:assignment_node)
    create(:deadline_type, name: "submission")
    create(:deadline_type, name: "review")
    create(:deadline_type, name: "metareview")
    create(:deadline_type, name: "drop_topic")
    create(:deadline_type, name: "signup")
    create(:deadline_type, name: "team_formation")
    create(:deadline_right)
    create(:deadline_right, name: 'Late')
    create(:deadline_right, name: 'OK')
    create(:assignment_due_date, deadline_type: DeadlineType.where(name: 'review').first, due_at: Time.now.in_time_zone + 1.day)
    create(:topic)
    create(:topic, topic_name: "TestReview")
    create(:team_user, user: User.where(role_id: 2).first)
    create(:team_user, user: User.where(role_id: 2).second)
    create(:assignment_team)
    create(:team_user, user: User.where(role_id: 2).third, team: AssignmentTeam.second)
    create(:signed_up_team)
    create(:signed_up_team, team_id: 2, topic: SignUpTopic.second)
    create(:assignment_questionnaire)
    create(:question)
    create(:question_advices)
   end

The rubric advice is prepared in factory.rb with the following code addition . This allows our test Student to get a ready rubric advice that he can choose.

  factory :question_advices, class: QuestionAdvice do
    question_id 1
    score 5
    advice "Good work"
  end


Instructor side:

Edit a certain review rubric, and add advice to it. Test that when advice is added for a particular criterion, the advice can be retrieved and that it is exactly the advice that was added.

describe "Edit a rubric advice" do
    it "is able to edit a review rubric advice" do
      # creating a new rubric advice
      load_question 'Criterion'
      click_button "Edit/View advice"
      expect(page).to have_content('Edit an existing questionnaire')
      # setting intital advice in the field
      first(:css, "textarea[id^='horizontal_'][id$='advice']").set("Initial advice")
      click_button "Save and redisplay advice"
      expect(page).to have_content('advice was successfully saved')
      expect(page).to have_content('Initial advice')
      # editing a review rubric - Setting any element with new data
      first(:css, "textarea[id^='horizontal_'][id$='advice']").set("Edited the advice")
      click_button "Save and redisplay advice"
      expect(page).to have_content('advice was successfully saved')
      expect(page).to have_content('Edited the advice')
    end
  end

  describe "Remove a rubric advice" do
    it "should be able to delete a rubric advice" do
      load_question 'Criterion'
      click_button "Edit/View advice"
      expect(page).to have_content('Edit an existing questionnaire')
      first(:css, "textarea[id^='horizontal_'][id$='advice']").set("Initial advice")
      click_button "Save and redisplay advice"
      expect(page).to have_content('advice was successfully saved')
      expect(page).to have_content('Initial advice')
      # edit review advice to set to blank i.e. delete rubric advice
      first(:css, "textarea[id^='horizontal_'][id$='advice']").set("")
      click_button "Save and redisplay advice"
      expect(page).to have_content('advice was successfully saved')
    end
  end
end


Testing Instructions

References