When running tests in Ruby's unit::test framework, is there a really easy way to specify, from the command-line, that only one test should be run (that is, specify the test class and test member variable)? If not, is there another framework that has this feature?
If your tests don't require any specific actions before start and you don't want to configure additional options, such as code coverage, you can run them by using the following options: Place the caret at the test class to run all tests in that class, or at the test method, and press Ctrl+Shift+F10 .
assert(test, [failure_message]) Tests if test is true. msg may be a String or a Proc. If msg is a String, it will be used as the failure message. Otherwise, the result of calling msg will be used as the message if the assertion fails.
Tests for a particular unit of code are grouped together into a test case, which is a subclass of Test::Unit::TestCase. Assertions are gathered in tests, member functions for the test case whose names start with test_.
ruby /path/to/foo_test.rb --name test_should_do_something_really_spiffy
That will call the test defined by the method test_should_do_something_really_spiffy
in that file.
EDIT: That's for the Test::Unit
framework that most ruby tests are written with. I am assuming you meant the same.
If you have the full Test::Unit
framework, you can do
ruby /path/to/foo_test.rb --help
to get the command line options. I don't think it works if you just have the minitest version though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With