Eclipse Pluginの自動テストの方法

  1. test用のPluginを落とす
    1. http://www.eclipse.org/downloads/index.phpから「ByProject」→「Platform」→「LatestDownload」の「LatestRelease」→「JUnit Plugin Tests and Automated Testing Framework」の「eclipse-test-framework-ver.zip」を落とす。
  2. セットアップ
    1. テスト用のEclipse環境を用意する。
    2. 落としてきたテストフレームワークを解凍し、テスト環境のEclipseのホームディレクトリに上書きする。
    3. 自動ビルド等で出力したテスト対象プラグインをテスト環境Eclipseの中へコピーする
  3. コマンドプロンプトを立ち上げテスト用のEclipse環境へcdする。
  4. 以下のコマンドを実行する。下記のコマンドはコマンドプロンプト上で起動しますが、改行は必要ありません。coretestapplicationはUIを使わない場合のテストです。uitestapplicationはUIを使う場合のテストです。RCPアプリケーションの場合は-testapplicationで対象のアプリケーションIDを指定してください。指定しない場合はeclipseが起動します。
java -classpath startup.jar org.eclipse.core.launcher.Main 
-consolelog 
-application org.eclipse.test.[coretestapplication || uitestapplication] -classname テストクラス名 
-testpluginname テスト対象のプラグイン 
-testapplication テスト対象のアプリケーションID 
formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter