2017-05-09 57 views
0

在jmeter中,在具有多個相同名稱的標記的xml響應中,我想驗證在標記onlineFulfilmentFlag的值爲Y的情況下,那麼productId不應該爲空。以上條件,我想打印一個失敗信息爲「無效的產品ID」。我也附上了答覆。這個代碼包含1個報價的描述,但是這個數字可以在0-10之間變化。如何檢查jmeter中的xml響應中的條件

enter code here<offers> 
     <number xsi:nil="true"/> 
     <number> 
      <amrit>S</amrit> 
      <interestedFlag>Y</interestedFlag> 
      <msgid>145983</msgid> 
      <msisdn xsi:nil="true"/>     
      <offerIndex>1</offerIndex> 
      <msgtext>Rs115=225 </msgtext> 
      <onlineFulfilmentFlag>Y</onlineFulfilmentFlag> 
      <orderId xsi:nil="true"/> 
      <otherSearchInfo> 
      <number> 
       <key>START_DATE</key> 
       <value>2016-09-16 11:28:46.921455</value> 
      </number> 
      <number> 
       <key>END_DATE</key> 
       <value>2017-08-03 00:00:00.0</value> 
      </number> 
      <number> 
       <key>OFFER_CATEGORY</key> 
       <value>Others</value> 
      </number> 
      </otherSearchInfo> 
      <price>115</price> 
      <productId>ACT3G</productId> 
      <shortDesc>115=225Loc+STD M,28D</shortDesc> 
      <subscriptionStatus>P</subscriptionStatus> 
     </number> 
     <number> 
      <amrit>O</amrit> 
      <interestedFlag>Y</interestedFlag> 
      <msgid>143429</msgid> 
      <msisdn xsi:nil="true"/> 
      <msgid>2803708</msgid> 
      <offerIndex>2</offerIndex> 
      <msgtext>Rs306=Rs306 Full</msgtext> 
      <onlineFulfilmentFlag>Y</onlineFulfilmentFlag> 
      <orderId xsi:nil="true"/> 
      <otherSearchInfo> 
      <number> 
       <key>START_DATE</key> 
       <value>2016-09-16 11:28:46.921455</value> 
      </number> 
      <number> 
       <key>END_DATE</key> 
       <value>2017-08-03 00:00:00.0</value> 
      </number> 
      <number> 
       <key>OFFER_CATEGORY</key> 
       <value>Combo</value> 
      </number> 
      </otherSearchInfo> 
      <price>306</price> 
      <productId>ACT3G</productId> 
      <shortDesc>Rs306=306TT(Ultd Val)</shortDesc> 
      <subscriptionStatus>P</subscriptionStatus> 
     </number> 
     <number> 
      <amrit>O</amrit> 
      <interestedFlag>Y</interestedFlag> 
      <msgid>145022</msgid> 
      <msisdn xsi:nil="true"/> 
      <msgid>2800482</msgid> 
      <msgtext>Rs110=Rs110 Full</msgtext> 
      <onlineFulfilmentFlag>Y</onlineFulfilmentFlag> 
      <orderId xsi:nil="true"/> 
      <otherSearchInfo> 
      <number> 
       <key>START_DATE</key> 
       <value>2016-09-16 11:28:46.921455</value> 
      </number> 
      <number> 
       <key>END_DATE</key> 
       <value>2017-08-03 00:00:00.0</value> 
      </number> 
      <number> 
       <key>OFFER_CATEGORY</key> 
       <value>Others</value> 
      </number> 
      </otherSearchInfo> 
      <price>110</price> 
      <productId>ACT3G</productId> 
      <shortDesc>Rs110=Rs110 FTT, ULTD</shortDesc> 
      <subscriptionStatus>P</subscriptionStatus> 
     </number> 

回答