CSC/CSC 517 Fall 2016/oss E1667

From Expertiza_Wiki
Revision as of 02:58, 29 October 2016 by Iyadav (talk | contribs)
Jump to navigation Jump to search

Template:Student sandbox

About Expertiza

Expertiza is an open source application developed on the Ruby on Rails framework. It allows instructors to create assignments, set deadlines and give grades to the assignments. In this application, students can submit their assignments by providing links to their sites or repositories or upload files and folders. The students can also review assignments submitted by their peers.

Problem Statement

Goal: The aim of the project was to write a feature test that mocks the Heat Map that a student views for an assignment of his. The following tasks were performed to accomplish the goal:

  1. Understanding the flow of the creation of Assignment by instructor.
  2. Understanding the flow of the submission of an assignment by a student and then the flow of submitting reviews to an assignment uploaded by a student.
  3. Understanding the flow of viewing the Heat Map related to an assignment by a student.
  4. Mock the above steps using capybara.

Project Links

Instructions for Reviewer

Clone the reopsitory

     git clone (repository URL)

Repository URL can be found by visiting this Github repo.

Installing Gems (ruby dependencies)

Go to your cloned expertiza directory in terminal and run the following command:

    bundle install

Setting up the databses

  • Go to your cloned expertiza directory and run the following command to create the development and test databases.
  rake db:create:all
  • If available, import the database dump that you received in class to pre-populate your database. eg:
  mysql -u root expertiza_development < expertiza-scrubbed.sql
  • Run the Expertiza database migrations. This should populate your database with the current tables of the schema.
  rake db:migrate

Running the tests

  • Go to your cloned expertiza directory and run the following command for the tests:
   rspec spec/features/heat_map_spec.rb

Note : Travis CI build fails because we are directly using the development database for our tests, thus Travis CI is not able to locate the login information. This was done because it was not possible to create factories or fixtures for our tests. So, please don’t consider the build failure in the pull request to be a valid error.

Solutions to problems while setting up the repository

rjb gem error

  • To solve this, make sure that you have java installed on your system or else you could do that from here.
  • Then set the JAVA_HOME environment variable by typing this on the terminal
    export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
  • Run bundle install again.

pg gem error

  • To solve this, we have to install PostgreSQL.
  • Then type in the following set of commands in the terminal
     sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
     wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
     sudo apt-get update
     sudo apt-get install postgresql-common
     sudo apt-get install postgresql-9.3 libpq-dev
  • Run bundle install again

Database related errors

   rake db:migrate RAILS_ENV=development
   rake db:migrate RAILS_ENV=test

Other errors

For any other kind of errors faced during setting up the repository, you can write to us at any of the following ids.

  • @ncsu.edu
  • @ncsu.edu
  • @ncsu.edu

Classes Involved

  • .rb
  • .rb
  • .rb

The heat_map_spce.rb contains the feature tests written to test the creation of the assignment. The rails_helper is copied to spec/ when you run 'rails generate rspec:install'. All the rspec-expectations config goes into the spec_helper_file. We have used Capybara and RSpec to test our application. Capybara helps you test web applications by simulating how a real user would interact with your app. One of the major reasons for selecting Capybara to write our tests was that it has an intuitive API which mimics the language an actual user would use and also we can run tests from fast headless mode to an actual browser with no changes to our tests.

Scenarios Tested

No matter which combination of parameters is selected in the creation of the assignment, the test cases should pass. Following are some of the scenarios which we have tested.

Flow of our test

Code

heat_map_spec.rb