Skip to content

Tools for Developing and Testing your Application

ndushay edited this page Apr 6, 2012 · 8 revisions

Tools for Developing and Testing your Application

Hydra-Jetty

The Hydra project provides a copy of Jetty (a java web server) with Fedora and Solr pre-installed. This is useful for running tests and for running your own code in your sandbox while you’re actively working on your hydra head.

Most projects add hydra jetty to their code as a git submodule:

  git submodule add git://github.com/projecthydra/hydra-jetty.git jetty
  git commit -m"added jetty submodule"

Now that you’ve added the submodule to your git repository, whenever you grab a new working copy of the code, you can get hydra-jetty by running:

git submodule init
git submodule update

Important: To apply your application’s solrconfig.xml and schema.xml to the copy of Solr in hydra-jetty, run this:

  rake hydra:jetty:config

Now you’re ready to start jetty. We’ve written a useful gem that gives you rake tasks for starting and stopping jetty. Make sure you have jettywrapper in your Gemfile

  gem "jettywrapper"

Then run

bundle install

Jettywrapper is now installed,

To start jetty:

rake jetty:start

To stop jetty:
rake jetty:stop

For more information about using jettywrapper, see http://hudson.projecthydra.org/job/jettywrapper/Documentation/

RSpec and Cucumber for Testing

We STRONGLY recommend that you write tests for every local change you make. This will allow you to ensure that upgrading the core code doesn’t break any local changes you have made.

A common question: when should it be a cucumber feature rather than a spec?
very basic rule: if it’s testing something created with view, use a cucumber feature to test. If it’s not created by view code, use a spec to test.

RSpec for Functional Tests

Most Ruby projects use either RSpec or Shoulda to write and run their Functional Tests. We use RSpec for all of the Hydra software.

To set up all the files you need to use rspec to test your Rails application, simply run the rspec generator. This will create a directory called “spec” and put all of the necessary files into it.

    rails g rspec:install

Cucumber to Test User Experience

If you will be writing cucumber tests, run the cucumber generator. This will create a directory called “features” and populate it with all the basic parts you need to run Cucumber tests on your Rails application.

rails g cucumber:install
Clone this wiki locally