Tag: Ruby/ユニットテスト
base_dir = File.expand_path(File.join(File.dirname(__FILE__), "..")) lib_dir = File.join(base_dir, "lib") test_dir = File.join(base_dir, "test") $LOAD_PATH.unshift(lib_dir) require 'test/unit' exit Test::Unit::AutoRunner.run(true, test_dir)
$ ruby test/run_test.rb
-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.
$ ruby test/run_test.rb --testcase=TestSome
$ ruby test/run_test.rb --testcase=TestSome --name=test_format