Jmeter可以作為API監(jiān)控測(cè)試的工具,http://jmeter.apache.org/usermanual/index.html 中有非常詳細(xì)使用介紹
分為三個(gè)部分:
1. API的http請(qǐng)求
2.生成測(cè)試報(bào)告,可以通過(guò)修改jmeter-results-detail-report_21.xsl微調(diào)格式
3. 出錯(cuò)發(fā)送告警郵件或短信
這些是周期性運(yùn)行的,所以可以使用jenkins進(jìn)行管理。
使用如果需要驗(yàn)證返回內(nèi)容的正確性,可以同時(shí)保存每次請(qǐng)求的結(jié)果(需要在每個(gè)http請(qǐng)求下添加simple data writer),結(jié)果的格式可以在bin/jmeter.properties下設(shè)置:
jmeter.save.saveservice.output_format=xml
# true when field should be saved; false otherwise
# assertion_results_failure_message only affects CSV output
#jmeter.save.saveservice.assertion_results_failure_message=false
#
# legitimate values: none, first, all
jmeter.save.saveservice.assertion_results=all
#
#jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
#jmeter.save.saveservice.response_data=true
# Save ResponseData for failed samples
#jmeter.save.saveservice.response_data.on_error=false
#jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
#jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=true
#jmeter.save.saveservice.assertions=true
jmeter.save.saveservice.latency=true
#jmeter.save.saveservice.samplerData=false
#jmeter.save.saveservice.responseHeaders=false
#jmeter.save.saveservice.requestHeaders=false
#jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=true
jmeter.save.saveservice.url=true
#jmeter.save.saveservice.filename=false
#jmeter.save.saveservice.hostname=false
#jmeter.save.saveservice.thread_counts=false
#jmeter.save.saveservice.sample_count=false
#jmeter.save.saveservice.idle_time=false