I can run all tests in a single file with:
rake test TEST=path/to/test_file.rb
However, if I want to run just one test in that file, how would I do it?
I'm looking for similar functionality to:
rspec path/to/test_file.rb -l 25
I can run all tests in a single file with:
rake test TEST=path/to/test_file.rb
However, if I want to run just one test in that file, how would I do it?
I'm looking for similar functionality to:
rspec path/to/test_file.rb -l 25
There are 2 ways to do it:
Rake::TestTask
target to use a different tests loader.Rake::TestTask
(from rake 0.8.7) theoretically is able to pass additional options toMiniTest::Unit
with a"TESTOPTS=blah-blah"
command line option, for example:In practice, the option
--name
(a filter for test names) won't work, due to rake internals. To fix that you'll need to write a small monkey patch in your Rakefile:This patch requires you to create a file
test/my-minitest-loader.rb
:To print all possible options for Minitest, type
You can use this to run a single file:
I also used
for better display.