スコアリングロジック

スコアは0から1までの数字で、aの選択を支援します。 熱 意/ヘルプ/ zest -仕様ファイル/構造/導入/"> 受信した応答に対する検証のためのリストから。 これは、テストケースの応答の構造を、テストケースで概説されている対応する構造と比較することによって計算されます。 熱 意/ヘルプ/ zest -仕様ファイル/書き込み方法-a-zスペックファイル/">ZSPEC .存在するたびに 0 から 1 の間になります。 ミスマッチ で

  • 構造体のキー
  • データ型 熱 意/ヘルプ/ zest -仕様ファイル/構造/プロパティ/導入/"> の構造
  • プロパティの可能な値 応答内の構造が 正確に一致する Zspecで言及されている構造体では、構造体のスコアは 1. スコアが最も高い構造は検証のために取られます。
    スコア マッチ
    1 パーフェクトマッチ
    > 0 と < 1 キーの問題
    0 マッチなし

注:

ザ ケース 構造体の属性はリストから構造体の候補リストに役立ち、スコアリングロジックは候補構造体にのみ適用されます。 もし ケース 属性が構造体で言及されていない場合、スコアリングロジックはリスト内のすべての構造体に適用され、応答に最適な一致を見つけます。

情報:

さまざまなサービスとコンポーネントに精通し、以下のステップバイステップガイドを使用して触媒をより実践的に理解できます。 チュートリアルセクション.

サンプル

スコアリングロジックが応答を検証する際にどのように機能するかを調べるために、いくつかのXML応答構造とjson応答を見てみましょう。

ケース属性付き

更新 Api の成功応答の構造は次のとおりです。

copy

{
 "code": "SUCCESS",
 "details": {},
 "message": "Record Updated",
 "status": "success"
 }

さて、次の4つの応答構造があり、そのうち2つの構造は 成功 の値 ケース 属性。

copy

<!-- Structure - A -->
 <structure name="create_success" cases="Success">
 <property name="code" type="string" values="SUCCESS" />
 <property name="details" type="map" />
 <property name="message" type="string" values="Record created" />
 <property name="status" type="string" values="success" />
 </structure>
copy

<!-- Structure - B -->
 <structure name="invalid_error" cases="InvalidValueInURLPath">
 <property name="code" type="string" values="INVALID_URL_PATTERN" />
 <property name="details" type="map" />
 <property name="message" type="string" values="Please check if the URL trying to access is a correct one" />
 <property name="status" type="string" values="error" />
 </structure>
copy

<!-- Structure - C -->
 <structure name="update_success" cases="Success">
 <property name="code" type="string" values="SUCCESS" />
 <property name="details" type="map" />
 <property name="message" type="string" values="Record Updated" />
 <property name="status" type="string" values="success" />
 </structure>
copy

<!-- Structure - D -->
 <structure name="mandatory_error" cases="Mandatory">
 <property name="code" type="string" values="REQUIRED_NOT_FOUND" />
 <property name="details" type="map" />
 <property name="message" type="string" values="Mandatory fields are missing" />
 <property name="status" type="string" values="error" />
 </structure>

ZEST 成功ケースで定義された2つの構造を取り入れ、その上にスコアリングロジックを適用します。 構造体のすべてのキーと値を受信した json レスポンスと比較します。メッセージキーの値を除いて、他のすべてのキーと値は両方の構造体で同じです。 json レスポンス内のメッセージキーの値は レコード更新. 同じメッセージを持つ構造を探し、最高のスコアを与えます。以下はスコア1の構造です。

copy

<!-- Structure - C -->
 <structure name="update_success" cases="Success">
 <property name="code" type="string" values="SUCCESS" />
 <property name="details" type="map" />
 <property name="message" type="string" values="Record Updated" />
 <property name="status" type="string" values="success" />
 </structure>

同じ成功ケースを持つ他の構造には、1未満のスコアが与えられます。

copy

<!-- Structure - A -->
 <structure name="create_success" cases="Success">
 <property name="code" type="string" values="SUCCESS" />
 <property name="details" type="map" />
 <property name="message" type="string" values="Record created" />
 <property name="status" type="string" values="success" />
 </structure>

Last Updated 2026-02-06 15:55:45 +0530 IST