4

次のような応答がありました。

<response>
  <status code='200' server_time='xxx' />
  <tests>
    <test id='1' name='a!' status='Started' />
    <test id='2' name='bb!' status='New' />
    <test id='3' name='ccc!' status='New' />
    <test id='4' name='dddd!' status='New' />
  </tests>
</response>

サンプラーにXpathエクストラクターを既に追加しました。

Reference name: mytest
XPath Query: //test[@id='1']

しかし、戻り変数(mytest)は間違っています。

OUT.println(mytest) --> void

私はJMeterの初心者です。これを解決するにはどうすればよいですか?

4

2 に答える 2

5

サンプラーにXpathエクストラクターを既に追加しました。

参照名:mytest XPathクエリ:

//test[@id='1'] 

しかし、戻り変数(mytest)は間違っています。

OUT.println(mytest) --> void

明らかに、println()関数はtest要素の文字列値を出力します。提供されたXMLドキュメントでは、要素にtestはコンテンツがなく、文字列値は空の文字列です。

あなたが欲しい

/*/*/test[@id=1]/@name

/*/*/test[@id=1]/@status

前者は、値を持つ属性を持つ、ドキュメントの最上位要素のすべての孫のすべてのname属性を選択します。testid1

後者は、値を持つ属性を持つ、ドキュメントの最上位要素のすべての孫のすべてのstatus属性を選択します。testid1

于 2011-02-22T14:21:44.747 に答える
2

テキストコンテンツがないことが原因である可能性があります。Return entire XPath fragment instead of text content?「 」を設定してみてください

于 2011-02-22T10:53:24.677 に答える