Skip to content

Running Tests Individually

ekilfeather edited this page Dec 14, 2016 · 5 revisions

Overview

You can run the entire test suite for active_fedora (and most other hydra applications & gems) by running rake ci from the application root. Sometimes, though, you want to run an individual test without the overhead of waiting for the entire test suite to complete.

Essential Services

For any Hydra-based application and most gems, Solr and Fedora must be running on the expected test ports. There may be other services that you need to start as well, check your project README. Hydra expects Solr and Fedora to be running on the ports configured in config/solr.yml and config/fedora.yml respectively. The default is to run a Solr test server on port 8985 and a Fedora test server on port 8986 on localhost.

In development and test environments, we usually use solr_wrapper and fcrepo_wrapper to start these services. To do this, open a separate terminal window and start a Solr instance using the provided config file:

solr_wapper --config config/solr_wrapper_test.yml

Then open a separate terminal window and start a Fedora test instance (using the provided config file):

fcrepo_wapper --config config/fcrepo_wrapper_test.yml

The wrapper config files specified in the example above are provided by the Hydra application generator and contain default configuration values needed to run the test services. See the documentation for solr_wrapper and fcrepo_wrapper wrapper for information about additional configuration options.

Running Tests

Run the full test suite

rspec

Run only the tests in a specific file

rspec spec/integration/attached_files_spec.rb

i.e. provide the path to the spec file you want to run as a command line option

Run a single test from a single file

rspec spec/integration/attached_files_spec.rb -e "creates datastreams from the spec on new objects"

i.e. pass the filename and path along with the pattern to match -e <pattern> to select which specific test(s) to run

For more details on rspec options, run rspec -h

Clone this wiki locally