我想在加载时考虑PHP应用程序的一些指标。 为此,我在我的webapp上产生了很多请求。 在webapp中,我正在收集指标(执行时间,API请求延迟等...),这些指标通过FirePHP标头返回到响应中。 在JMeter计划中,我想收集这些信息,并直接处理它们以生成图形或者将它们存储在日志文件中。
响应标头如下所示:
...
X-Wf-1-1-1-31: 610|[{"Type":"LOG","File":"somescript.php","Line":7},{"duration":"1.7108917236328 ms","notes":{"invokation":["Solr_Connector::exec","somescript2.php line : 42"],"size_download":"2167 bytes","query":"...url data ..."},"name":"[tag1][tag2]SOLR REQUEST 1382626844.906"}]|
X-Wf-1-1-1-32: 611|[{"Type":"LOG","File":"somescript.php","Line":7},{"duration":"1.7011165618896 ms","notes":{"invokation":["Solr_Connector::exec","somescript2.php line : 42"],"size_download":"2590 bytes","query":"...url data ..."},"name":"[tag1][tag3]SOLR REQUEST 1382626844.9079"}]|
X-Wf-1-1-1-33: 611|[{"Type":"LOG","File":"somescript.php","Line":7},{"duration":"1.5978813171387 ms","notes":{"invokation":["Solr_Connector::exec","somescript2.php line : 42"],"size_download":"2452 bytes","query":"...url data ..."},"name":"[tag1][tag3]SOLR REQUEST 1382626844.9097"}]|
X-Wf-1-1-1-34: 610|[{"Type":"LOG","File":"somescript.php","Line":7},{"duration":"1.662015914917 ms","notes":{"invokation":["Solr_Connector::exec","somescript2.php line : 42"],"size_download":"3150 bytes","query":"...url data ..."},"name":"[tag1][tag2]SOLR REQUEST 1382626844.9115"}]|
...
如何设置JMeter正则表达式提取器以提取名称以“X-Wf-”开头的标题的所有值?
答案 0 :(得分:1)
我理解响应标头将是:
回复标题:
HTTP / 1.1 200确定
服务器:Apache-Coyote / 1.1
X-Wf-1-1-1-31:610 | [{“Type”:“LOG”,“File”:“somescript.php”,“Line”:7},{“duration”:“ 1.7108917236328 ms“,”notes“:{”invokation“:[”Solr_Connector :: exec“,”somescript2.php line:42“],”size_download“:”2167 bytes“,”query“:”... url data ...“},”name“:”[tag1] [tag2] SOLR REQUEST 1382626844.906“}] |
X-Wf-1-1-1-32:611 | [{“Type”:“LOG”,“File”:“somescript.php”,“Line”:7},{“duration”:“ 1.7011165618896 ms“,”notes“:{”invokation“:[”Solr_Connector :: exec“,”somescript2.php line:42“],”size_download“:”2590 bytes“,”query“:”... url data ...“},”name“:”[tag1] [tag3] SOLR REQUEST 1382626844.9079“}]
...
以这种方式组织测试计划:
代码:
import org.apache.commons.io.FileUtils;
FileUtils.write(new File(“/ results.csv”),vars [“header”] +“\ r \ n”,“UTF-8”,true);
PS:不确定修改响应以放置此类信息是一个好主意,因为它会影响初始应用的性能。