Skip to content

Testing and Developing Blacklight

Michael J. Giarlo edited this page Mar 27, 2020 · 7 revisions

Getting started

something something docker-compose

Automatically generate a test application (and run the tests)

To run the Blacklight test suite, Blacklight comes with a rake task that creates local dependencies like a Solr with indexed test data and a test Rails application, and then runs tests.

Requirements:

  • Java 8 or above (for Solr)
  • phantomjs (used by integration tests, you may be able to install with your local package manager, for instance on OSX with brew install phantomjs)

Then from the root directory of your blacklight git checkout:

bundle exec rake

This installs the necessary gems, ensures a test Solr exists and is running, creates a test application, and indexes the fixture objects for you, before running the tests.

Step by step, with more control

The default rake task will re-index test data in solr and re-build the test application (if needed). Running the full test suite can be time-consuming. You may prefer to set up the environment and run tests as separate steps.

To create the dummy test app (in the .internal_test_app directory):

$ bundle exec rake engine_cart:generate

In a new console, start up Solr (in the foreground, by default):

$ bundle exec solr_wrapper

To index the test data, from inside the .internal_test_app directory run:

$ RAILS_ENV=test bundle exec rake blacklight:index:seed

Then back in the blacklight directory, run all the specs with:

$ bundle exec rspec

Or run just one spec:

$ bundle exec rspec just/one_spec.rb
Clone this wiki locally