Skip to main content
Version: 1.1.1

Testing Code

We test the Chemotion ELN using three different kinds of tests.

1. JavaScript (npm) unit tests

We use the Mocha framework for JavaScript unit tests: https://mochajs.org/.

These tests are configured with

"test": "mocha --require '@babel/register' './spec/javascripts/helper/setup.js' './spec/javascripts/**/*.spec.js'"

in the scripts section of package.json.

2. Ruby unit tests

We use the RSpec framework for Ruby unit tests: https://rspec.info/.

3. Acceptance (feature) tests

The Capybara framework is used alongside RSpec to simulate user interactions: https://teamcapybara.github.io/capybara/. The test driver is Selenium: https://www.selenium.dev/.

Local testing for Chemotion ELN

For locally testing the Chemotion ELN, change your directory to to the root directory of your Chemotion ELN. Then type the following commands:

Javascript (npm) unit tests

source ~/.rvm/scripts/rvm && source ~/.nvm/nvm.sh && nvm use && RAILS_ENV=test bundle exec rake db:test:prepare && npm test

Ruby unit tests

source ~/.rvm/scripts/rvm && RAILS_ENV=test bundle exec rake db:test:prepare && bundle exec rspec --exclude-pattern spec/{features}/**/*_spec.rb

Acceptance tests

source ~/.rvm/scripts/rvm && source ~/.nvm/nvm.sh && nvm use  && RAILS_ENV=test bundle exec rake db:test:prepare && bundle exec rake assets:precompile  && bundle exec rspec spec/features

When you have freshly installed Chemotion ELN, make sure to create a welcome-message.md file in the public directory inside Chemotion ELN before running acceptance tests. You can create it from the example file:

cp public/welcome-message-sample.md public/welcome-message.md