Run Single Test
Join the DZone community and get the full member experience.Join For Free
tests should be run with rake to load the test environment run all tests
$ rake testrun only one unit test
$ rake test:units TEST=test/unit/xy_test.rbrun tests done wrong and right ============================== run one test. WRONG. Doesn't load test environment. "require test_helper" fails!
$ ruby test/unit/glosentry_test.rbrun only one test. WRONG. runs test three times
$ rake test TEST=test/unit/glosentry_test.rbrun only the unit tests with rake. RIGHT
$ rake test:unitsrun only one unit test with rake. RIGHT. (same as obove)
$ rake test:units TEST=test/unit/xy_test.rbrunning one test without rake but with explicit $-loadpath works too here "ruby -I directory" specifies the $loadpath.
$ ruby -I test test/unit/xy_test.rb
Opinions expressed by DZone contributors are their own.