| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
- In order to avoid loading classes prematurely, let's use lazy load hooks that are now provided with each test case
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Provides both a forked process and threaded parallelization options. To
use add `parallelize` to your test suite.
Takes a `workers` argument that controls how many times the process
is forked. For each process a new database will be created suffixed
with the worker number; test-database-0 and test-database-1
respectively.
If `ENV["PARALLEL_WORKERS"]` is set the workers argument will be ignored
and the environment variable will be used instead. This is useful for CI
environments, or other environments where you may need more workers than
you do for local testing.
If the number of workers is set to `1` or fewer, the tests will not be
parallelized.
The default parallelization method is to fork processes. If you'd like to
use threads instead you can pass `with: :threads` to the `parallelize`
method. Note the threaded parallelization does not create multiple
database and will not work with system tests at this time.
parallelize(workers: 2, with: :threads)
The threaded parallelization uses Minitest's parallel exector directly.
The processes paralleliztion uses a Ruby Drb server.
For parallelization via threads a setup hook and cleanup hook are
provided.
```
class ActiveSupport::TestCase
parallelize_setup do |worker|
# setup databases
end
parallelize_teardown do |worker|
# cleanup database
end
parallelize(workers: 2)
end
```
[Eileen M. Uchitelle, Aaron Patterson]
|
|
|
|
|
|
|
| |
a94220b66c9e4890007f66b092b25f8a64a19d31:
- The namespacing should be `ActiveRecord::FixtureSet`
- I might be missing something but I'm not sure why `create_fixtures` is useful for nowaday (unless for testing rails internal /shrug) and since it's been that long it wasn't working I think it should be fine to just fire it
|
|
|
|
| |
This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By making the Rails minitest behave like a standard minitest plugin
we're much more likely to not break when people use other minitest
plugins. Like minitest-focus and pride.
To do this, we need to behave like minitest: require files up front
and then perform the plugin behavior via the at_exit hook.
This also saves us a fair bit of wrangling with test file loading.
Finally, since the environment and warnings options have to be applied
as early as possible, and since minitest loads plugins at_exit, they
have to be moved to the test command.
* Don't expect the root method.
It's likely this worked because we eagerly loaded the Rails minitest plugin
and that somehow defined a root method on `Rails`.
* Assign a backtrace to failed exceptions.
Otherwise Minitest pukes when attempting to filter the backtrace (which
Rails' backtrace cleaner then removes).
Means the exception message test has to be revised too.
This is likely caused by the rails minitest plugin now being loaded for
these tests and assigning a default backtrace cleaner.
|
| |
|
| |
|
|
|
|
|
|
|
| |
It turns out that we don't need to require system tests in the railties
test helper so we can remove it. If you're using system tests they will
be loaded by inheriting from ActionDispatch::SystemTestCase and the
routes will be loaded by ActionDispatch::IntegrationTest.
|
|
|
|
|
|
|
|
| |
SystemTestCase supports only Puma, and always load puma's file.
https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/system_testing/server.rb#L1
For that reason, the case of use Capybara but do not use Puma, it will cause an error.
So we need to check about Puma is defined as well.
|
|
|
|
|
|
|
|
| |
For applications that are upgrading or applications that are choosing to
skip system testing Capbyara will not be available. SystemTestCase and
friends shoud only be loaded if Capbyara is defined.
Fixes #28094
|
|
|
|
|
|
|
|
|
|
| |
* Move system tests back into Action Pack
* Rename `ActionSystemTest` to `ActionDispatch::SystemTestCase`
* Remove private base module and only make file for public
`SystemTestCase` class, name private module `SystemTesting`
* Rename `ActionSystemTestCase` to `ApplicationSystemTestCase`
* Update corresponding documentation and guides
* Delete old `ActionSystemTest` files
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Originally I had set up system testing to have one configuration option
to be set in the test environment. After thinking it over I think a
generated class on app creation would be best. The reason for this is
Capybara has a ton of configuration options that I'm sure some folks
want to use.
Thinking about how we handle screenshots, database transactions, and a
whole bunch of other settings it would be better for users to be able to
turn all of that on and off.
When an app or scaffold is generated a `test/system_test_helper.rb` test
helper will be generated as well. This will contain the class for tests
to inherit from `ActionSystemTestCase` which will inherit from
`ActionSystemTest::Base`. Here is where users can change the test
driver, remove the screenshot helper, and add their additional Capybara
configuration.
|
|
|
|
|
|
|
|
|
|
| |
Renames `Rails::SystemTestCase` to `ActionSystemTest` and moves it to a
gem under the Rails name.
We need to name the class `ActionSystemTestCase` because the gem expects
a module but tests themselves expect a class.
Adds MIT-LICENSE, CHANGELOG, and README for the future.
|
|
|
|
| |
Rubocop / code climate don't like single quotes and prefer doubles.
|
|
|
|
|
|
|
| |
This skelton is the bare minimum to get system tests to actually run in
an application. This of course doesn't yet actually run a test but it is
enough for `bin/rails test:system` to attempt to run files in
`test/system` that inherit from `Rails::SystemTestCase`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a lot of monkey patches inside the code base but there's
no need to document external constants so let's remove them from
the documentation
Also, since there are monkey patches for some test cases classes,
there were sometimes both documented and sneaked under the wrong
section in the sidebar.
Finally, for future references, the `active_support/vendor`
folder has been originally ignored in https://git.io/vDqfA but
no longer exists.
[ci skip]
|
|
|
|
| |
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
| |
|
|
|
|
|
| |
This makes it possible to easily get the runner working with existing
setups that rely on `active_support/testing/autorun.rb`.
|
|
|
|
|
|
|
|
|
|
|
| |
This also adds free mix and matching of directories, files and lines filters.
Like so:
bin/rails test models/post_test.rb test/integration models/person_test.rb:26
You can also mix in a traditional Minitest filter:
bin/rails test test/integration -n /check_it_out/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`setup do` creates unnecessary allocations of proc objects in test
callbacks. This prevents that from happening and results in faster code.
Originally I had done this as `def setup` and all Railties tests passed.
See 044f9ab. Later it was reported there was an issue with this that
caused routes in tests to be nil because devs don't generally call
`super` in their test setups. Because of that I reverted the commit
until I could find a suitble replacement.
`before_setup` esentially does the same thing but without the
requirement that applications call `super` in their test setups.
|
|
|
|
| |
This reverts commit 044f9ab7a4d6646ddce4560bb83b58cdc0baa751.
|
|
|
|
|
|
|
| |
Minitest Rails plugin should be loaded on test_help, so we report errors
even when not running from the runner.
Also fix the backtrace
|
|
|
|
|
| |
`setup do` creates unnecessary allocations of proc objects in callbacks.
This prevents that from happening and results in faster code.
|
|
|
|
|
|
| |
It's a thin layer to provide easy access to sample files throughout
test-cases. This adds the directory `test/fixtures/files` to newly
generated applications.
|
|
|
|
|
|
| |
This will load properly the loading hooks.
Closes rails/sass-rails#205
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Move check from generated helper to test_help.rb, so that all
applications can benefit
* Rather than just raising when the test schema has pending migrations,
try to load in the schema and only raise if there are pending
migrations afterwards
* Opt out of the check by setting
config.active_record.maintain_test_schema = false
* Deprecate db:test:* tasks. The test helper is now fully responsible
for maintaining the test schema, so we don't need rake tasks for this.
This is also a speed improvement since we're no longer reloading the
test database on every call to "rake test".
|
|
|
|
|
|
| |
renamed to `Minitest`
Ref: https://github.com/seattlerb/minitest/blob/master/History.txt
|
|
|
|
|
|
|
|
|
|
|
| |
We used to support the `BACKTRACE` environment variable but when
we switched to MiniTest it got removed: f9382cd7948
This commit adds back the functionality to show the unfiltered backtrace when needed.
This also works when you run your tests with `rake`:
* `BACKTRACE=1 bin/rake test`
* `BACKTRACE=1 ruby -Itest ...`
|
|
|
|
| |
rake task included in test:all rake task.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
If 'turn' is in the Gemfile with `:require => nil`, Rails should
respect that.
This supports the case where 'turn' may or may not be required
depending on different developers' preference or environment. E.g., you
require turn for local testing, but not on your CI server by putting
this in `test/test_helper.rb`:
require 'turn' if ENV['TURN']
|
|
|
|
|
| |
minitest/autorun load minitest/spec polluting the global namespace with
the DSL that we don't want on Rails
|
|
|
|
| |
Rename `ActiveRecord::Fixtures` class to `ActiveRecord::FixtureSet`. Instances of this class normally hold a collection of fixtures (records) loaded either from a single YAML file, or from a file and a folder with the same name. This change make the class name singular and makes the class easier to distinguish from the modules like `ActiveRecord::TestFixtures`, which operates on multiple fixture sets, or `DelegatingFixtures`, `::Fixtures`, etc., and from the class `ActiveRecord::Fixture`, which corresponds to a single fixture.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Last versions of Turn don't monkey patch MiniTest to setup
the natural language option. Here is an
[example](https://github.com/TwP/turn/blob/master/try/test_autorun_minitest.rb#L3).
This patches the following behaviour:
$ rake test:units
`<top (required)>': undefined method `use_natural_language_case_names='
for MiniTest::Unit:Class (NoMethodError)
|
| |
|
|
|
|
| |
MiniTest::Unit.respond_to?(:use_natural_language_case_names=) available
|
|\
| |
| | |
Remove more references to Test::Unit
|
| | |
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
|
|
|
| |
require turn if it is available
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
activerecord/lib/active_record/associations/association_proxy.rb
activerecord/lib/active_record/autosave_association.rb
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/persistence.rb
|