如何使用Taurus运行依赖properties文件的JMeter脚本并生成日志文件
Taurus运行现有JMeter脚本的实现方法
你可以通过以下两种方式实现和原有JMeter命令完全一致的运行效果:
方式1:通过配置文件运行(更推荐,方便复用)
第一步:编写YAML配置文件
新建配置文件taurus-run.yml,内容如下:
execution: - executor: jmeter scenario: script: ./HTTPS-REST/Done/load-scenario.jmx properties-file: ./config.properties reporting: - module: jtl filename: ./HTTPS-REST/TestResults/load-scenario-log.jtl
第二步:执行运行命令
直接运行以下命令即可启动测试:bzt taurus-run.yml
方式2:直接通过命令行参数运行
如果不想单独维护配置文件,也可以直接在终端执行单行命令实现:
# Linux/Mac环境 bzt \ -execution.executor=jmeter \ -execution.scenario.script=./HTTPS-REST/Done/load-scenario.jmx \ -execution.scenario.properties-file=./config.properties \ -reporting[0].module=jtl \ -reporting[0].filename=./HTTPS-REST/TestResults/load-scenario-log.jtl # Windows CMD环境 bzt ^ -execution.executor=jmeter ^ -execution.scenario.script=./HTTPS-REST/Done/load-scenario.jmx ^ -execution.scenario.properties-file=./config.properties ^ -reporting[0].module=jtl ^ -reporting[0].filename=./HTTPS-REST/TestResults/load-scenario-log.jtl
配置说明
properties-file配置对应原命令的-p参数,用于加载自定义常量配置文件script配置对应原命令的-t参数,用于指定待运行的JMeter脚本路径reporting模块的jtl配置对应原命令的-l参数,会自动将所有请求日志输出到指定的.jtl文件中
内容的提问来源于stack exchange,提问作者JustNatural
相关产品推荐
相关产品推荐

