Concordion-execute-command
提供:Dev Guides
一致-コマンドの実行
一致実行コマンドは、一致フィクスチャの操作を実行するために使用されます。 次の要件を考慮してください-
私たちは2つの数字を受け入れ、その合計を出力する合計関数の仕様を書きたい場合、仕様は次のようになります-
Concordionはドキュメントを解析するときに、一時変数#firstNumberを値 "2"に設定し、#secondNumberを値 "3"に設定してから、executeを使用して#firstNumberおよび#secondNumberのようなパラメーターでsum()メソッドを実行しますコマンドを実行し、結果を#result変数に設定し、#result変数が「5」に等しいことを確認します。
例
動作する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テスト実行の出力です。