Concordion-execute-list
提供:Dev Guides
一致-リストで実行
一致実行コマンドを使用すると、一致フィクスチャの操作を繰り返し実行できます。 たとえば、リスト形式で複数の例を使用して要件を説明する場合に役立ちます。
次の要件を考慮してください-
名前を名と姓に分割する分割関数の仕様を記述したい場合、仕様は次のようになります-
Concordionがドキュメントを解析するとき、特別な変数#TEXTの値を「Robert De」として現在の要素の値に設定し、それをsplit関数に渡します。 次に、executeコマンドを使用して#TEXTとしてパラメーターを指定してsplit()メソッドを実行し、結果を#result変数に設定し、resultを使用して、firstNameおよびlastNameの値を出力として出力します。
例
動作するEclipse IDEを用意し、以下の手順に従ってConcordionアプリケーションを作成します-
Step | Description |
---|---|
1 | Create a project with a name concordion and create a package com.finddevguides under the src folder in the created project. |
2 | Add required Concordion libraries using Add External JARs option as explained in the Concordion - First Application chapter. |
3 | Create Java class System under the com.finddevguides package. |
4 | Create Fixture class SystemFixture under the specs.finddevguides package. |
5 | Create Specification html Systeml under the specs.finddevguides package. |
6 | The final step is to create the content of all the Java files and specification file and run the application as explained below. |
System.javaファイルの内容は次のとおりです-
SystemFixture.javaファイルの内容は次のとおりです-
以下はSystemlファイルの内容です-
ソースファイルと仕様ファイルの作成が完了したら、アプリケーションをJUnitテストとして実行します。 すべてがあなたのアプリケーションでうまくいけば、それは次の結果を生成します-
システムは、Concordionテスト実行の出力です。