diff options
author | Alberto Almagro <albertoalmagro@gmail.com> | 2018-10-05 21:34:32 +0200 |
---|---|---|
committer | Alberto Almagro <albertoalmagro@gmail.com> | 2018-10-05 21:44:04 +0200 |
commit | 899334b5b3a64e4563219d9fe1b923e9033beb3f (patch) | |
tree | bc8e4e45553c541a350d0c9fc966ad45b53b9e18 /guides/source | |
parent | 0b6d2189c8d5c5d700877724b66242ce541d511d (diff) | |
download | rails-899334b5b3a64e4563219d9fe1b923e9033beb3f.tar.gz rails-899334b5b3a64e4563219d9fe1b923e9033beb3f.tar.bz2 rails-899334b5b3a64e4563219d9fe1b923e9033beb3f.zip |
Add documentation to run tests with specific seed [ci skip]
This commit documents how to run all tests or a single test file with a
specific randomization seed.
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/contributing_to_ruby_on_rails.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index 01848bdc11..1beadd78d6 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -336,6 +336,26 @@ $ bundle exec ruby -w -Itest test/mail_layout_test.rb -n test_explicit_class_lay The `-n` option allows you to run a single method instead of the whole file. +#### Running tests with a specific seed + +Test execution is randomized with a randomization seed. If you are experiencing random +test failures you can more accurately reproduce a failing test scenario by specifically +setting the randomization seed. + +Running all tests for a component: + +```bash +$ cd actionmailer +$ SEED=15002 bundle exec rake test +``` + +Running a single test file: + +```bash +$ cd actionmailer +$ SEED=15002 bundle exec ruby -w -Itest test/mail_layout_test.rb +``` + #### Testing Active Record First, create the databases you'll need. You can find a list of the required |