0-9
JsTestDriverのコマンドラインオプション

この内容はJsTestDriver WikiのCommandLineFlagsを意訳したものです。
http://code.google.com/p/js-test-driver/wiki/CommandLineFlags

$ java -jar JsTestDriver.jar —help
 —browser VAR             : The path to the browser executable
 —browserTimeout VAR      : The ms before a browser is declared dead.
 —captureAddress VAL      : The address to capture the browser.
 —captureConsole          : Capture the console (if possible) from the browser
 —config VAL              : Loads the configuration file
 —dryRunFor VAR           : Outputs the number of tests that are going to be
                             run as well as their names for a set of
                             expressions or all to see all the tests
 —help                    : Help
 —port N                  : The port on which to start the JsTestDriver server
 —preloadFiles            : Preload the js files
 —requiredBrowsers VAR    : Browsers that all actions must be run on.
 —reset                   : Resets the runner
 —server VAL              : The server to which to send the command
 —serverHandlerPrefix VAL : Whether the handlers will be prefixed with jstd
 —sslPort N               : The SSL port on which to start the JsTestDriver
                             server
 —testOutput VAL          : A directory to which serialize the results of the
                             tests as XML
 —tests VAR               : Run the tests specified in the form testCase.testNa
                             me
 —verbose                 : Displays more information during a run

 —plugins VAL[,VAL]       : Comma separated list of paths to plugin jars.
 —config VAL              : Path to configuration file.
 —basePath VAL            : Override the base path in the configuration file. Defaults to the parent directory of the configuration file.
 —runnerMode VAL          : The configuration of the logging and frequency that the runner reports actions: DEBUG, DEBUG_NO_TRACE, DEBUG_OBSERVE, PROFILE, QUIET (default), INFO


サーバオプション

以下のオプションはJsTestDriverがサーバとして起動される場合に認識されるオプションです。

—port

サーバとして起動する際のポート番号です。
このオプションが指定された場合、JsTestDriverはサーバとして起動します。

ステータス

サーバとして起動しているJsTestDriverに対して「http://{サーバ名 or IP}:{ポート番号}/」で接続すると、現在そのサーバに接続しているブラウザのステータスが表示されます。

テスト対象ブラウザの追加

サーバとして起動しているJsTestDriverに対して「http://{サーバ名 or IP}:{ポート番号}/capture」で接続すると、接続したブラウザがテスト対象のブラウザとして追加されます。
接続したブラウザはキャプチャページを表示したまま更新しないでください。
また、最近のブラウザは非表示タブの動作を遅くする機能を持つものが多いので、タブの切替も行わないようにしてください。
(別Windowで立ち上げることを推奨します)
テスト対象のブラウザはそのサーバに接続できるものであれば同じ機体である必要はありません。
(JSが動作する環境であればiOS, Android等でも実行できます)
デバッグツールは使用出来ますが、debuggerステートメント等で動作を停止した場合でも設定ファイルのtimeout秒が経過した時点でタイムアウトとみなされるので注意してください。
JsTestDriverの設定ファイル書式 http://0-9.tumblr.com/post/16858820234/jstestdriver-configurationfile

—browser

ブラウザの実行ファイルのパスを,区切りで指定するとサーバの起動と同時にブラウザを起動します。
これはCI等の自動テストを行う場合にも使うことができます。
継続的ビルド http://code.google.com/p/js-test-driver/wiki/ContinuousBuild

クライアントオプション

以下のオプションはJsTestDriverがクライアントとして起動される場合に認識されるオプションです。

—captureConsole

以下のメソッドの出力内容をJsTestDriverクライアントを実行しているコンソールへも出力します。
console.log、console.debug、console.info、console.warn、console.error
ブラウザ標準のconsoleを使用しない場合(ブラウザ標準のconsole objectが存在しない場合、ブラウザ標準のconsoleへ出力したくない場合)はjstestdriver以下のメソッドを使用してください。

jstestdriver.console.log
出力はテキストのみ可能です。
各メソッドは出力時の先頭に[LOG]、[DEBUG]、[INFO]がつくことで区別されます。
console.debugは行番号を出力しません。

—config

設定ファイルの参照先を変更します。
設定ファイルは標準ではカレントディレクトリのjsTestDriver.confを参照します。
JsTestDriverの設定ファイル書式 http://0-9.tumblr.com/post/16858820234/jstestdriver-configurationfile

—reset

テスト対象のブラウザのテストを実行している領域ををリロードします。
JsTestDriverは標準でJSの再読み込みを行わないため、広域変数を使用している場合「—reset」オプションを指定して実行毎に環境をクリアしてください。

—server

JsTestDriverサーバが実行されているURLを指定します。
設定ファイルの値を上書きします。
JsTestDriverの設定ファイル書式 http://0-9.tumblr.com/post/16858820234/jstestdriver-configurationfile
末尾に「/」をつけないように注意してください。

—tests

実行するテストを指定します。

・all すべてのテストを実行します。
・TestCaseName TestCase(‘TestCaseName’, {})で指定されたテストを実行します
・TestCaseName.testName TestCase(‘TestCaseName’, { ‘testName’ : function () {} })で指定されたテストを実行します

  1. atm09td0-9からリブログしました
  2. 0-9の投稿です