Quantcast
Channel: Is it possible to run a single test in MiniTest? - Stack Overflow
Browsing latest articles
Browse All 18 View Live

Answer by Artur INTECH for Is it possible to run a single test in MiniTest?

If you're using Minitest::TestTask and no Rails, you can also pass the name of a test using the N environment variable:rake test N=test_some_test_name

View Article



Answer by mechnicov for Is it possible to run a single test in MiniTest?

Rails 7.1 introduce new syntax for specific lines for testsNow you can run not only specific tests by single linebin/rails test test/models/user_test.rb:10 # by line 10but also by lines rangebin/rails...

View Article

Answer by par for Is it possible to run a single test in MiniTest?

Install gem minitest-focus and use the keyword focus on test/spec like below to run only the specific test.focusdef testendfocusit "test" doendThis would not need any command line argument to be passed.

View Article

Answer by Vasanth Saminathan for Is it possible to run a single test in...

I am in Rails Version 4.2.11.3 and Ruby Version 2.4.7p357Below one worked for me.ruby -Itest <relative_minitest_file_path> --name /<test_name>/

View Article

Answer by user4636030 for Is it possible to run a single test in MiniTest?

Following will workdef test_abcendtest "hello world"endThis can run bybundle exec ruby -I test path/to/test -n test_abcbundle exec ruby -I test path/to/test -n test_hello_word

View Article


Answer by sloneorzeszki for Is it possible to run a single test in MiniTest?

I use ruby /path/to/test -n /distinguishable word/Edit:-n is a shorthand for --name. distinguishable word can be any string you put in the test description, I usually use some random word that I know...

View Article

Answer by wteuber for Is it possible to run a single test in MiniTest?

I'm looking for similar functionality to:rspec path/to/test_file.rb -l 25There is a gem that does exactly that: minitest-line.gem install minitest-lineruby test/my_file -l 5from...

View Article

Answer by Derek Hill for Is it possible to run a single test in MiniTest?

If you are using MiniTest with Rails 5+ the best way to run all tests in a single file is:bin/rails test path/to/test_file.rbAnd for a single test (e.g. on line 25):bin/rails test...

View Article


Answer by Rimian for Is it possible to run a single test in MiniTest?

You can pass --name to run a test by its name or a number within its name:-n, --name PATTERN Filter run on /regexp/ or string.e.g.:$ ruby spec/stories/foo_spec.rb --name 3FAIL (0:00:00.022)...

View Article


Answer by tuhaj for Is it possible to run a single test in MiniTest?

You can use this to run a single file:rake test TEST=test/path/to/file.rbI also used ruby -I"lib:test" test/path/to/file.rbfor better display.

View Article

Answer by randomor for Is it possible to run a single test in MiniTest?

No gem required:ruby -Itest test/lib/test.rb --name /some_test/Source: http://blog.arvidandersson.se/2012/03/28/minimalicous-testing-in-ruby-1-9

View Article

Answer by Laknath for Is it possible to run a single test in MiniTest?

If you are using Turn gem with minitest, just make sure to use Turn.config.pattern option since Turn Minitest runner doesn't respect --name option in ARGs.

View Article

Answer by jduan for Is it possible to run a single test in MiniTest?

The command should be:% rake test TEST=test/test_foobar.rb TESTOPTS="--name=test_foobar1 -v"

View Article


Answer by Elliot Winkler for Is it possible to run a single test in MiniTest?

I'm looking for similar functionality to rspec path/to/file.rb -l 25With Nick Quaranto's "m" gem, you can say:m spec/my_spec.rb:25

View Article

Answer by fguillen for Is it possible to run a single test in MiniTest?

This is one of the things that bother me about the string name definition in tests.When you have:def test_my_testendyou always know how your test is named so you can execute it like this:ruby my_test...

View Article


Answer by Alexander Gromnitsky for Is it possible to run a single test in...

There are 2 ways to do it:Run tests 'manually' (see Andrew Grimm's answer).Hack Rake::TestTask target to use a different tests loader.Rake::TestTask (from rake 0.8.7) theoretically is able to pass...

View Article

Answer by Andrew Grimm for Is it possible to run a single test in MiniTest?

Have you tried:ruby path/to/test_file.rb --name test_method_name

View Article


Is it possible to run a single test in MiniTest?

I can run all tests in a single file with:rake test TEST=path/to/test_file.rbHowever, if I want to run just one test in that file, how would I do it?I'm looking for similar functionality to:rspec...

View Article
Browsing latest articles
Browse All 18 View Live




Latest Images