Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

RUNNING_TESTS 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. Installing gems for testing
  2. ===========================
  3. Remove your .bundle/config if you've already installed Redmine without
  4. the test dependencies. Then, run `bundle install`.
  5. Running Tests
  6. =============
  7. Run `rake --tasks test` to see available tests.
  8. Run `rake test` to run the entire test suite (except the tests for the
  9. Apache perl module Redmine.pm and Capybara tests, see below).
  10. You can run `ruby test/unit/issue_test.rb` for running a single test case and
  11. `ruby test/unit/issue_test.rb -n test_create` for running a single test.
  12. Before running tests, you need to configure both development
  13. and test databases.
  14. Creating test repositories
  15. ==========================
  16. Redmine supports a wide array of different version control systems.
  17. To test the support, a test repository needs to be created for each of those.
  18. Run `rake --tasks test:scm:setup` for a list of available test-repositories or
  19. run `rake test:scm:setup:all` to set up all of them. The repositories are
  20. unpacked into {redmine_root}/tmp/test.
  21. If the test repositories are not present, the tests that need them will be
  22. skipped.
  23. Creating a test LDAP database
  24. =============================
  25. Redmine supports using LDAP for user authentications. To test LDAP
  26. with Redmine, load the LDAP export from test/fixtures/ldap/test-ldap.ldif
  27. into a testing LDAP server. Make sure that the LDAP server can be accessed
  28. at 127.0.0.1 on port 389.
  29. If your LDAP server is not running on localhost, you can use the
  30. REDMINE_TEST_LDAP_SERVER environment variable to specify another host.
  31. Setting up the test LDAP server is beyond the scope of this documentation.
  32. The OpenLDAP project provides a simple LDAP implementation that should work
  33. good as a test server.
  34. If the LDAP is not available, the tests that need it will be skipped.
  35. Running Redmine.pm tests
  36. ========================
  37. (work in progress)
  38. Running the tests for the Redmine.pm perl module needs a bit more setup.
  39. You need an Apache server with mod_perl, mod_dav_svn and Redmine.pm configured.
  40. See: http://www.redmine.org/projects/redmine/wiki/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl
  41. You need an empty repository accessible at http://127.0.0.1/svn/ecookbook
  42. Then, you can run the tests with:
  43. `ruby test\extra\redmine_pm\repository_subversion_test.rb`
  44. If your svn server is not running on localhost, you can use the
  45. REDMINE_TEST_DAV_SERVER environment variable to specify another host.
  46. Running Capybara tests
  47. ======================
  48. You need to have Chrome installed and available in your PATH.
  49. Chromedriver is managed by the `webdrivers` gem (https://rubygems.org/gems/webdrivers)
  50. Capybara tests can be run with:
  51. `rails test:system`
  52. The following environment variables can be used to configure your system tests setup:
  53. `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
  54. `CAPYBARA_SERVER_PORT`: configure server port
  55. `SELENIUM_REMOTE_URL`: remote Selenium URL
  56. `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
  57. `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:
  58. `export GOOGLE_CHROME_OPTS_ARGS="headless,disable-gpu,no-sandbox,disable-dev-shm-usage"`
  59. One use case of these variables is to run the system tests on a remote Selenium/ChromeDriver (eg: Docker).
  60. Running RuboCop, a static code analyzer
  61. =======================================
  62. RuboCop allows you to find out if the code violates the Ruby Style Guide.
  63. Checking with RuboCop is recommended when you write patches.
  64. You can run RuboCop with:
  65. `bundle exec rubocop [file ...]`
  66. Running Stylelint, a static code analyzer for CSS files
  67. =======================================
  68. You need to have NodeJS and Yarn installed and available in your PATH:
  69. https://nodejs.org/en/download/package-manager/
  70. https://legacy.yarnpkg.com/lang/en/docs/install/#mac-stable
  71. Install Stylelint:
  72. `yarn install`
  73. You can run Stylelint with:
  74. `node_modules/.bin/stylelint "public/stylesheets/**/*.css"`