2012-07-14 01:52:22 +08:00
|
|
|
== Setup
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
If you don't have an environment for running tests, read
|
2019-03-09 20:08:03 +08:00
|
|
|
https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#setting-up-a-development-environment
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2012-07-14 01:52:22 +08:00
|
|
|
== Running the Tests
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
To run a specific test:
|
|
|
|
|
2016-03-03 00:34:40 +08:00
|
|
|
$ bundle exec ruby -Itest test/cases/base_test.rb -n method_name
|
2013-05-14 01:26:39 +08:00
|
|
|
|
|
|
|
To run a set of tests:
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2016-03-03 00:34:40 +08:00
|
|
|
$ bundle exec ruby -Itest test/cases/base_test.rb
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
You can also run tests that depend upon a specific database backend. For
|
|
|
|
example:
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2015-01-16 06:25:28 +08:00
|
|
|
$ bundle exec rake test:sqlite3
|
2004-11-24 09:04:44 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
Simply executing <tt>bundle exec rake test</tt> is equivalent to the following:
|
2010-08-14 13:13:00 +08:00
|
|
|
|
2014-12-22 00:13:54 +08:00
|
|
|
$ bundle exec rake test:mysql2
|
2023-03-21 04:17:09 +08:00
|
|
|
$ bundle exec rake test:trilogy
|
2014-12-22 00:13:54 +08:00
|
|
|
$ bundle exec rake test:postgresql
|
|
|
|
$ bundle exec rake test:sqlite3
|
2015-01-16 06:25:28 +08:00
|
|
|
|
|
|
|
Using the SQLite3 adapter with an in-memory database is the fastest way
|
|
|
|
to run the tests:
|
|
|
|
|
2014-12-22 00:13:54 +08:00
|
|
|
$ bundle exec rake test:sqlite3_mem
|
2008-05-04 00:29:47 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
There should be tests available for each database backend listed in the {Config
|
|
|
|
File}[rdoc-label:label-Config+File]. (the exact set of available tests is
|
|
|
|
defined in +Rakefile+)
|
2006-07-05 10:54:19 +08:00
|
|
|
|
2021-03-12 06:46:13 +08:00
|
|
|
There are some performance tests for the encryption system that can be run with.
|
|
|
|
|
|
|
|
$ rake test:encryption:performance:mysql2
|
2021-03-13 01:02:21 +08:00
|
|
|
$ rake test:integration:active_job:postgresql
|
2021-03-12 06:46:13 +08:00
|
|
|
$ rake test:encryption:performance:sqlite3
|
|
|
|
|
|
|
|
These performance tests are not executed as part of the regular testing tasks.
|
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
== Config File
|
2006-07-05 10:54:19 +08:00
|
|
|
|
2014-08-22 15:45:25 +08:00
|
|
|
If +test/config.yml+ is present, then its parameters are obeyed; otherwise, the
|
|
|
|
parameters in +test/config.example.yml+ are.
|
2011-06-10 03:15:34 +08:00
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
You can override the +connections:+ parameter in either file using the +ARCONN+
|
|
|
|
(Active Record CONNection) environment variable:
|
|
|
|
|
2016-03-03 00:34:40 +08:00
|
|
|
$ ARCONN=postgresql bundle exec ruby -Itest test/cases/base_test.rb
|
2011-06-13 02:08:16 +08:00
|
|
|
|
2017-08-12 15:51:45 +08:00
|
|
|
Or
|
|
|
|
|
|
|
|
$ bundle exec rake test:postgresql TEST=test/cases/base_test.rb
|
|
|
|
|
2013-05-14 01:26:39 +08:00
|
|
|
You can specify a custom location for the config file using the +ARCONFIG+
|
|
|
|
environment variable.
|