JUnitEE Howto

Last update : July 6 2002
Doc for : v1.3

Cactusについて
  • Cactus とは
  • ニュース
  • 変更履歴
  • 特徴/開発状況
  • 目標
  • ロードマップ/ToDo
  • 協力者
  • 協力者募集
  • Cactus ユーザ
  • テスト済環境 ...
  • ライセンス


  • ダウンロード
  • ダウンロード


  • ドキュメント
  • Cactus の仕組み
  • さぁ始めよう
  • モック対コンテナ
  • Javadocs
  • └Javadocs
  • よくある質問


  • Howto ガイド
  • クラスパス Howto
  • 設定 Howto
  • アップグレードHowto
  • テストケース Howto
  • セキュリティHowto
  • Ant Howto
  • HttpUnit Howto
  • サンプル Howto
  • EJB Howto
  • IDE Howto
  • JUnitEE Howto


  • サポート
  • Bug DB
  • メーリングリスト


  • その他
  • 名前の由来
  • ロゴコンテスト
  • 参考文献
  • アクセス状況
  • └WebAlizer


  • 開発者向け
  • CVS
  • コード規約
  • ビルドの結果


  • JUnitEE,コンテナ内のTestRunner/JUnitEE, a TestRunner inside the Container

    You can use the JUnitEE user interface to run your all your tests inside the Container. JUnitEE is a JUnit TestRunner that has been written as a servlet with the user interface in HTML format.

    コンテナ中で行われる全てのテストを実行するのに JUnitEE ユーザーインターフェースが使えます。 JUnitEE は HTML フォーマットのユーザインターフェースを持つ、 サーブレットとして記述された JUnit の TestRunner です。

    You cannot achieve all features of Cactus using JUnitEE as part of them depend on being executed on the client side. Executing JUnitEE from ANT commands will probably not be possible. Some benefits however of JUnitEE are:

    一部はクライアント側での実行に依存しているので、 JUnitEE を用いて Cactus の全ての機能を達成することはできません。 JUnitEE を Ant コマンドから実行することは、 おそらくできないでしょう。 しかしながら、JUnitEE には幾つかのメリットがあります :

    • All class files are in one place : Install all your TestCase class-files only in your container classpath. Both TestCases derived from junit.framework.TestCase and from org.apache.cactus.JspTestCase will be located in the same place and only once.
    • 全てのクラスが一箇所に置ける : 自分のテストケースを全てコンテナのクラスパスにインストールします。 junit.framework.TestCase および org.apache.cactus.JspTestCase から 派生したテストケースは、 同じたった一つの場所に置かれるのです。
    • Run all TestCases in the container : You can mix both types of TestCases mentioned above in your test. All tests are executed inside the Container. You can use testcases derived from junit.framework.TestCase to test methods that do not require the http objects such as the HttpServletRequest or HttpServletResponse objects.
    • 全てのテストケースをコンテナで実行します : 開発者はテスト中に上述のテストケースのどちらを混ぜて使っても構いません。 全てのテストはコンテナ上で行われます。 HttpServletRequestHttpServletResponse オブジェクトのような HTTP オブジェクトを必要としないメソッドをテストするために、 junit.framework.TestCase から派生したテストケースを 使うことができます。

    Using JUnitEE is (relatively) simple. Assuming you have a container such as Weblogic, Tomcat or Orion functioning and you know how to configure Servlets and adding libraries to the Containers classpath and you are familiar with the basics of Cactus then the rest is easy.

    JUnitEE を使うのは(比較的)簡単です。 正しく動作する Weblogic、Tomcat、Orion のようなコンテナがあり、 サーブレットやライブラリをコンテナのクラスパスに設定する方法を知っており、 Cactus の基本について知っていれば、 残りは簡単です。

    • One good reason to use JUnitEE would be when you want to try Cactus quickly and are not concerned with automatic unit testing.
    • JUnitEE を使う一つの良い理由は、 Cactus をすぐ試してみたく、 自動的な単体テストに関心が無い時でしょう。
    • Usage of standard JUnit testrunner (textui,swingui, ...) will not be possible if cactus is configured this way and thus the ant junit task cannot be used to automate the test.
    • Cactus がこの方法で設定された場合、 標準の JUnit のテストランナー(textui、swinguiなど)は使えないので、Ant の junit タスクをテスト自動化に使う事はできません。

    JUnitEE のインストール法/How to install JUnitEE

    Download the JUnitEE zip-file. Add a reference to junitee.jar to your Container classpath. Add also references to junit.jar, httpunit.jar cactus.jar and aspectjrt.jar if you have not already done that.

    JUnitEE ZIPファイルをダウンロードし、 コンテナのクラスパスに、junitee.jar を参照できるよう加えます。 まだ加えてない場合には、 junit.jarhttpunit.jarcactus.jarおよびaspectjrt.jar も参照できるように加えます。

    Note add junitee.jar in the same way as cactus.jar is added.

    Note cactus.jar を加えたのと同じ方法で junitee.jar を加えます。

    Configure TestServlet in your Container. You may use the example servlet org.infohazard.servlet.TestServlet that comes with JUnitEE. Check JUnitEE documentation. TestServlet extends junit.htmlui.TestServletBase that executes junit.htmlui.TestRunner i.e. the JUnitEE interface.

    コンテナ中の TestServlet を設定します。 JUnitEE にある、 org.infohazard.servlet.TestServlet サンプルサーブレットが利用できます。 JUnitEE のドキュメントをご覧ください。 TestServlet は JUnitEE のインターフェースである junit.htmlui.TestRunner を実行する junit.htmlui.TestServletBase を拡張します。


    JUnitEE でのテストの実行/Executing the tests with JUnitEE

    You request the tests from an html-page in your container. You can write the name of your testclasses according to the examples with JUnitEE as:

    コンテナにある HTML ページからテストを要求します。 JUnitEE のサンプルに従って自分のテストクラスの名前を書くことができます :

    • a commandstring parameter such as "/TestServlet?suite=fi.iki.kaila.MyTests&list=yes"
    • "/TestServlet?suite=fi.iki.kaila.MyTests&list=yes" といったコマンド文字列パラメーターとして
    • as input using <input type="text" name="suite" size=60 /> in a form element that requests TestServlet
    • TestServlet を要求する FORM 要素にある <input type="text" name="suite" size=60 /> を用いた入力として
    • as one or more option elements in a select element in the form-element
    • FORM 要素中の SELECT 要素の中の 一つあるいはそれ以上の OPTION 要素として

    JUnitEE に Cactus リダイレクタを使うよう指示する/Tell JUnitEE to use Cactus redirector

    The cactus.properties file must be located so that your container can find it e.g. in your containers classpath.

    cactus.properties ファイルはコンテナが見付けられるような場所に置かなければなりません。 例えば、コンテナのクラスパスの中など、




    [訳注:これは 漆島賢二 が翻訳しました。日本語訳に対するコメントがあれば こちらに送ってください]
    Copyright © 2000-2002 The Apache Software Foundation. All Rights Reserved.