2017-05-30 1 views
0

私はWSDL石鹸サービス用のスクリプトを作成しようとしています。私の要件は、Beanshell Postporcessorを使用してポイント応答出力パラメータ値をCSV結果ファイルに出力したいのです。JmeterでBeanshell Postprocessorを使用してCSV結果ファイルにSOAP応答パラメータを出力できませんか?

以下はSOAPの応答です。

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soap:Body> 
     <CardResponse xmlns="http://service.clp.eks.com"> 
     <out> 
      <birthDate xmlns="http://wsform.clp.eks.com">05-04-00</birthDate> 
      <cardno xsi:nil="true" xmlns="http://wsform.clp.eks.com"/> 
      <customerName xmlns="http://wsform.clp.eks.com">krishna singhji</customerName> 
      <flag xmlns="http://wsform.clp.eks.com">TRUE</flag> 
      <memberLevel xsi:nil="true" xmlns="http://wsform.clp.eks.com"/> 
      <points xmlns="http://wsform.clp.eks.com">**500.0**</points> 
      <reason xsi:nil="true" xmlns="http://wsform.clp.eks.com"/> 
     </out> 
     </CardResponse> 
    </soap:Body> 
</soap:Envelope> 

私のBeanShellスクリプトは次のとおりです。私の結果は、ポイントの値を表示し、としてnull値を表示するファイルではなく試験プランを実行した後

import java.io.File; 
import org.apache.jmeter.services.FileServer; 

CardNo =vars.get("cardno"); 

Result = "FAIL"; 
Response = prev.getResponseDataAsString(); 

if(Response.contains("TRUE")) 
    Result = "PASS"; 
Points = vars.get("points"); 

f = new FileOutputStream("F:\\Java_Applications\\apache-jmeter-3.1\\bin\\CardsResults.csv",true); 
p=new PrintStream(f); 

this.interpreter.setOut(p); 

p.println(CardNo + "," + Points + "," + Result); 
f.close(); 

、このissue.ASAP

を解決する方法を私を助けてください

答えて

0

あなたのスクリプトは多かれ少なかれOKなので、問題は${points} JMeter変数であるようです。

Beanshellスクリプトの前のどこかに設定した場合は、この場所をダブルチェックして、Debug SamplerView Results Tree Listenerの組み合わせを使用して期待値を再確認してください。

あなたはこの${points}変数を抽出していない場合 - あなたは次のように構成されたXPath Extractor使用してBeanShellのポストプロセッサすなわち前にこれを実行する必要があります。

  • 参照名:points
  • XPathクエリ://points

XPath Extractor Configuration

XPath Tester Demo

そして、のBeanshell PostProcessorの前にXPath Extractor を配置してください。今後


ではなく、BeanShellので、それはより多くのパフォーマンススクリプトオプションでJSR223 PostProcessor and Groovy languageを使用することを検討してください。

+0

返信いただきありがとうございます。Xpath ExtractorとDebug Samplerを使用していて、csvファイルに2つのレコードが挿入されています.4回繰り返して8レコードがCSVファイルに挿入されている場合は1回繰り返します。 –

関連する問題