Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > test/unit/autorunnerライブラリ > Test::Unit::AutoRunnerクラス > run
run(force_standalone = false, dir = '.', argv = ARGV) -> boolテストを実行します。全てのテストが成功した場合、true を返します。そうでない場合は、 false を返します。
-r, --runner=RUNNER Use the given RUNNER.
(c[onsole], f[ox], g[tk], g[tk]2, t[k])
-b, --basedir=DIR Base directory of test suites.
-w, --workdir=DIR Working directory to run tests.
-n, --name=NAME Runs tests matching NAME.
(patterns may be used).
-t, --testcase=TESTCASE Runs tests in TestCases matching TESTCASE.
(patterns may be used).
-v, --verbose=[LEVEL] Set the output level (default is verbose).
(s[ilent], p[rogress], n[ormal], v[erbose])
-- Stop processing options so that the
remaining options will be passed to the
test.
-h, --help Display this help.
force_standalone に true を与えた時には次のオプションが追加されます。
-a, --add=TORUN Add TORUN to the list of things to run;
can be a file or a directory.
-p, --pattern=PATTERN Match files to collect against PATTERN.
-x, --exclude=PATTERN Ignore files to collect against PATTERN.
例
require 'test/unit'
Test::Unit::AutoRunner.run(true, './', ['--runner=tk', '-v',
'--exclude=/test_hoge.*\.rb\Z/i'])
argv にデフォルトのまま ARGV を渡しておけばコマンドラインからオプションを 指定できます。
require 'test/unit' Test::Unit::AutoRunner.run(true, './')
と、runner.rb に書いておいて、コマンドラインから以下のように実行。
$ ruby runner.rb --runner=tk -v --exclude=/test_hoge.\*\\.rb\\Z/i