2009-10-17 20:37:23 +00:00
Installing gems for testing
===========================
2012-02-19 14:30:46 +00:00
Remove your .bundle/config if you've already installed Redmine without
2012-06-12 19:14:06 +00:00
the test dependencies. Then, run `bundle install`.
2009-10-17 20:37:23 +00:00
2008-03-12 20:28:49 +00:00
Running Tests
=============
2009-01-12 04:44:01 +00:00
Run `rake --tasks test` to see available tests.
2012-06-12 19:33:09 +00:00
Run `rake test` to run the entire test suite (except the tests for the
2013-01-26 14:36:02 +00:00
Apache perl module Redmine.pm and Capybara tests, see below).
2012-06-12 19:14:06 +00:00
2013-08-01 03:31:54 +00:00
You can run `ruby test/unit/issue_test.rb` for running a single test case and
`ruby test/unit/issue_test.rb -n test_create` for running a single test.
2008-03-12 20:28:49 +00:00
2021-04-06 06:27:42 +00:00
You can run tests in parallel by setting the PARALLEL_WORKERS environment
variable:
`PARALLEL_WORKERS=8 rake test`
2011-09-05 10:33:59 +00:00
Before running tests, you need to configure both development
2009-11-08 13:15:59 +00:00
and test databases.
2008-03-12 20:28:49 +00:00
2009-01-12 04:44:01 +00:00
Creating test repositories
2012-06-12 19:14:06 +00:00
==========================
2009-01-12 04:44:01 +00:00
Redmine supports a wide array of different version control systems.
To test the support, a test repository needs to be created for each of those.
2008-03-12 20:28:49 +00:00
2009-01-12 04:44:01 +00:00
Run `rake --tasks test:scm:setup` for a list of available test-repositories or
2012-06-12 19:14:06 +00:00
run `rake test:scm:setup:all` to set up all of them. The repositories are
unpacked into {redmine_root}/tmp/test.
If the test repositories are not present, the tests that need them will be
skipped.
2008-09-30 00:02:46 +00:00
2016-01-22 18:22:58 +00:00
Creating a test LDAP database
2010-02-16 16:40:50 +00:00
=============================
Redmine supports using LDAP for user authentications. To test LDAP
with Redmine, load the LDAP export from test/fixtures/ldap/test-ldap.ldif
2012-06-12 19:14:06 +00:00
into a testing LDAP server. Make sure that the LDAP server can be accessed
2010-02-16 16:40:50 +00:00
at 127.0.0.1 on port 389.
2016-01-22 18:22:58 +00:00
If your LDAP server is not running on localhost, you can use the
REDMINE_TEST_LDAP_SERVER environment variable to specify another host.
2012-06-12 19:14:06 +00:00
Setting up the test LDAP server is beyond the scope of this documentation.
2010-02-16 16:40:50 +00:00
The OpenLDAP project provides a simple LDAP implementation that should work
good as a test server.
2012-06-12 19:14:06 +00:00
If the LDAP is not available, the tests that need it will be skipped.
2012-06-12 19:33:09 +00:00
Running Redmine.pm tests
========================
(work in progress)
Running the tests for the Redmine.pm perl module needs a bit more setup.
You need an Apache server with mod_perl, mod_dav_svn and Redmine.pm configured.
2024-11-03 09:50:55 +00:00
See: https://www.redmine.org/projects/redmine/wiki/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl
2012-06-12 19:33:09 +00:00
You need an empty repository accessible at http://127.0.0.1/svn/ecookbook
Then, you can run the tests with:
`ruby test\extra\redmine_pm\repository_subversion_test.rb`
2012-09-02 13:00:19 +00:00
2016-01-22 18:22:58 +00:00
If your svn server is not running on localhost, you can use the
REDMINE_TEST_DAV_SERVER environment variable to specify another host.
2013-01-26 14:36:02 +00:00
Running Capybara tests
======================
2021-02-08 06:42:18 +00:00
You need to have Chrome installed and available in your PATH.
Chromedriver is managed by the `webdrivers` gem (https://rubygems.org/gems/webdrivers)
2013-01-26 14:36:02 +00:00
Capybara tests can be run with:
2017-07-23 12:35:32 +00:00
`rails test:system`
2019-06-19 00:49:28 +00:00
2020-11-19 05:11:59 +00:00
The following environment variables can be used to configure your system tests setup:
`CAPYBARA_SERVER_HOST`: configure server to run on a custom IP which can be, for example, your remote Selenium IP or 0.0.0.0 to listen an all connections
`CAPYBARA_SERVER_PORT`: configure server port
`SELENIUM_REMOTE_URL`: remote Selenium URL
`CAPYBARA_APP_HOST`: by default, the tests expect to have the application running on your localhost. Using this variable, you can set a custom URL
2021-01-10 00:10:00 +00:00
`GOOGLE_CHROME_OPTS_ARGS`: configure Google Chrome Options arguments as a comma-delimited string. For example, it can be used to run the tests in headless mode:
`export GOOGLE_CHROME_OPTS_ARGS="headless,disable-gpu,no-sandbox,disable-dev-shm-usage"`
2020-11-19 05:11:59 +00:00
One use case of these variables is to run the system tests on a remote Selenium/ChromeDriver (eg: Docker).
2019-06-19 00:49:28 +00:00
Running RuboCop, a static code analyzer
=======================================
RuboCop allows you to find out if the code violates the Ruby Style Guide.
Checking with RuboCop is recommended when you write patches.
You can run RuboCop with:
`bundle exec rubocop [file ...]`
2020-04-29 04:17:01 +00:00
Running Stylelint, a static code analyzer for CSS files
=======================================
You need to have NodeJS and Yarn installed and available in your PATH:
https://nodejs.org/en/download/package-manager/
https://legacy.yarnpkg.com/lang/en/docs/install/#mac-stable
Install Stylelint:
`yarn install`
You can run Stylelint with:
2024-11-16 09:53:42 +00:00
`npx stylelint "app/assets/stylesheets/**/*.css"`
2025-08-30 07:48:50 +00:00
Viewing SVG icons list in development mode
=======================================
When running Redmine in development mode, you can view a list of all available SVG icons and their names at:
http://localhost:3000/rails/info/svg_icons
This page is useful for checking icon appearance and names during view development.