Using the initial value from the rake in the module and functional tests

When performing unit and functional tests using rake in a rails application, I notice that there is an initial value specified on the command line: - seed x

$ rake test (in /code/blah) Loaded suite /../ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake/rake_test_loader Started . Finished in 0.12345 seconds. 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips Test run options: --seed 20290 

I assume that this value can be used in tests, but I cannot figure out how to do this. I tried Google, Rails Guides, etc. but can not find the answer.

EDIT:

Could this seed value be a parameter that Minitest uses to randomize the order in which tests are run?

+43
ruby-on-rails rake
May 04 '11 at 8:21
source share
2 answers

I found this online about MiniTest: http://www.mikeperham.com/2012/09/25/minitest-ruby-1-9s-test-framework/

Turns out you're right. It is about randomizing the order in which tests are run. You can explicitly use them as follows:

 rake TESTOPTS="--seed=1261" 

(according to the link above).

+66
Jun 22 2018-11-22T00:
source share

Answer from MrDanA is correct. This solution also works and is a little shorter and easier to remember.

 SEED=20290 rake test 
+40
Nov 19 '15 at 21:47
source share



All Articles