CSC/ECE 517 Spring 2016/Functional tests for assignment creation function

From Expertiza_Wiki
Revision as of 06:29, 26 March 2016 by Bghagar (talk | contribs)
Jump to navigation Jump to search

Functional tests for assignment creation function

This page outlines the use tests for assignment creation using the Expertiza system

Structural Overview

Assignment creation in Expertiza provides a large number of options for users. Features come at the cost of complexity; this project is focused on creating testing methods to ensure that user interaction with the assignment interface remains stable and reliable.

Assignment creation is available from the Manage -> Assignments drop down on the expertiza site. Once an assignment is created it has 5 tabs for form entry. The remainder of this document will cover testing for each tab in more detail, the tabs are:

  • General
  • Topics
  • Rubrics
  • Review Strategy

Check the panxing01/expertiza repository for the current development files. Currently all tests are run in two files:

Setup

To setup functionality testing of assignment creation feature we did the following steps:

  • Created RSpec file in /spec/features/ folder of Expertiza
  • Wrote functional tests using Capybara

General

In this section, the functional test includes assignment name, course, submission directory, description URL, "Has team?", "Has quiz?" and "Calibrated peer-review for training".

  • assignment name
    it "can set assginment name" do
      login_as("instructor6")
      visit '/assignments/new?private=0'
      expect(page).to have_content "Assignment name"
      fill_in "Assignment name:", with: 'assignment for test'
      click_button "Create"
      expect(Assignment.where(name: "assignment for test")).to exist
    end
  • course
    it "can select course" do
      login_as("instructor6")
      visit '/assignments/new?private=0'
      select('5', :from => 'assignment_form_assignment_course_id')
      click_button "Create"
    end
  • submission directory
    it "can set assginment Submission directory" do
      login_as("instructor6")
      visit '/assignments/new?private=0'
      fill_in "Assignment name:", with: 'assignment for test 2'
      expect(page).to have_content "Submission directory"
      fill_in "Submission directory:", with: 'Submission directory for test'
      click_button "Create"
      expect(Assignment.find(2).directory_path).to eq 'Submission directory for test'
    end
  • description URL
    it "can set assginment Description URL" do
      login_as("instructor6")
      visit '/assignments/new?private=0'
      fill_in "Assignment name:", with: 'assignment for test 3'
      expect(page).to have_content "Description URL"
      fill_in "Description URL:", with: 'Description URL for test'
      click_button "Create"
      expect(Assignment.find(2).spec_location).to eq 'Description URL for test'
    end
  • "Has team?"
    it "can Has teams and set team number" do
      login_as("instructor6")
      visit '/assignments/new?private=0'
      fill_in "Assignment name:", with: 'assignment for test 5'
      find('#team_assignment').set(true)
      expect(page).to have_content "Maximum number of members per team"
      expect(page).to have_content "Show teammate reviews"
      fill_in 'assignment_form_assignment_max_team_size', with: 4
      find('#assignment_form_assignment_show_teammate_reviews').set(true)
      click_button "Create"
      expect(Assignment.find(2).show_teammate_reviews).to eq true
    end
  • "Has quiz?"
    it "can save the number of quiz questions" do
      login_as("instructor6")
      visit '/assignments/new?private=0'
      fill_in "Assignment name:", with: '11'
      select('5', :from => 'assignment_form_assignment_course_id')
      find('#assignment_form_assignment_require_quiz').set(true)
      click_button "Create"
      visit '/assignments/2/edit'
      expect(page).to have_content "Number of Quiz questions"
    end
  • "Calibrated peer-review for training"
    it "can set Calibrated peer-view for training" do
      login_as("instructor6")
      visit '/assignments/new?private=0'
      fill_in "Assignment name:", with: 'assignment for test 4'
      find('#assignment_form_assignment_is_calibrated').set(true)
      click_button "Create"
      expect(Assignment.find(2).is_calibrated).to eq true
    end

Topics

In this section, functionality of "Edit topics" is thoroughly tested. Below are some of the code snippets of this testing module:

  • Edit topics content
    it "is able to see edit topics content correctly" do
      login_as("instructor6")
      visit 'assignments/1/edit#tab-2'
      expect(page).to have_content("Allow topic suggestions from students?")
      expect(page).to have_content("Enable bidding for topics?")
      expect(page).to have_content("Enable authors to review others working on same topic?")
      expect(page).to have_content("Allow reviewer to choose which topic to review?")
      expect(page).to have_content("Allow participants to create bookmarks? ")
      expect(page).to have_content("Hide all teams")
      expect(page).to have_content("New topic")
      expect(page).to have_content("Import Topics")
      expect(page).to have_content("Back")
      expect(page).to have_content("Save")
    end
  • Show/hide teams
  it "is able to show/hide teams" do
      login_as("instructor6")
      visit 'assignments/1/edit#tab-2'

      click_link('Hide all teams')

      expect(page).to have_content("Show all teams")

      click_link("Show all teams")
      expect(page).to have_content("Hide all teams")
    end

Rubrics

Rubrics are arranged into 3 rows of data named "Review", "Author Feedback", and "Teammate Review". Each row is handled under separate descriptions in order to allow quick and comprehensive testing for the seperate functions. Each row updates using a subclass of the Questionnaire class for dropdown values. Classes used are the ReviewQuestionnaire, AuthorFeedbackQuestionnaire, and the TeammateReviewQuestionnaire respectively. The Active Record hierarchy is:

Testing required creation of the three questionnaire subclasses in order to populate the dropdowns. Basic code layout for testing each value change:

  describe "Edit [subclass] rubric" do
    it "should update [component]", js: true do
      login_as("instructor6")
      visit '/assignments/1/edit'
      find_link('Rubrics').click
      within("[table row identifier]") do
        select "[subclass instance name value]", :from => '[form identifier]'
      end
      click_button 'Save'
      expect([questionnaireinstance]).to have_attributes([attrib updated] => [new value])
    end

Review Strategy

In this module we have tested the functionality of the "Teammate Review" module. Some of the tests are given below:

  • Teammate Review
    it "should update questionnaire", js: true do
      login_as("instructor6")
      visit '/assignments/1/edit'
      find_link('Rubrics').click
      within("tr#questionnaire_table_TeammateReviewQuestionnaire") do
        select "TeammateReviewQuestionnaire2", :from => 'assignment_form[assignment_questionnaire][][questionnaire_id]'
      end
      click_button 'Save'
      expect(get_questionnaire("TeammateReviewQuestionnaire2")).to exist
    end
  • Notification limit
    it "should update notification limit", js: true do
      login_as("instructor6")
      visit '/assignments/1/edit'
      find_link('Rubrics').click
      within("tr#questionnaire_table_TeammateReviewQuestionnaire") do
        select "TeammateReviewQuestionnaire2", :from => 'assignment_form[assignment_questionnaire][][questionnaire_id]'
        fill_in 'assignment_form[assignment_questionnaire][][notification_limit]', :with => '50'
      end
      click_button 'Save'
      expect(get_questionnaire("TeammateReviewQuestionnaire2").first).to have_attributes(:notification_limit => 50)
    end

Class Hierarchy

The Assignment class has many questionnaires throught the AssignmentQuestionnairs class. The Questionnaire class inherits from ActiveRecord::Base and has 8 fields plus primary key and date entries. The fields are:

  • name: The name of the questionnaire row
  • instructor_id: The instuctor key linked to the row
  • private: True if private questionnaire
  • min_question_score
  • max_question_score
  • type: field showing subclass
  • display_type
  • instruction_loc: stores URL for questionnaire instruction

The Questionnaire class has 11 sub-classes. They are:

  • Rubric
  • CourseEvaluationQuestionnaire
  • SurveyQuestionnaire
  • BookmarkRatingQuestionnaire
  • AuthorFeedbackQuestionnaire
  • QuizQuestionnaire
  • GlobalSurveyQuestionnaire
  • Metasurvey
  • ReviewQuestionnaire
  • MetareviewQuestionnaire
  • TeammateReviewQuestionnaire