一.GUI mode 图形化界面运行

  to run JMeter, run the jmeter.bat (for Windows) or jmeter (for Unix) file. These files are found in the bin directory.

windows中,bin目录下可用脚本有:

jmeter.bat

  run JMeter (in GUI mode by default)

jmeterw.cmd

  run JMeter without the windows shell console (in GUI mode by default)

jmeter-n.cmd

  drop a JMX file on this to run a non-GUI test

jmeter-n-r.cmd

  drop a JMX file on this to run a non-GUI test remotely

jmeter-t.cmd

  drop a JMX file on this to load it in GUI mode

jmeter-server.bat

  start JMeter in server mode

mirror-server.cmd

  runs the JMeter Mirror Server in non-GUI mode

shutdown.cmd

  Run the Shutdown client to stop a non-GUI instance gracefully

stoptest.cmd

  Run the Shutdown client to stop a non-GUI instance abruptly

Linux/Unix 中,bin目录下可用脚本有:

jmeter

  run JMeter (in GUI mode by default). Defines some JVM settings which may not work for all JVMs.

jmeter-server

  start JMeter in server mode (calls jmeter script with appropriate parameters)

jmeter.sh

  very basic JMeter script (You may need to adapt JVM options like memory settings).

mirror-server.sh

  runs the JMeter Mirror Server in non-GUI mode

shutdown.sh

  Run the Shutdown client to stop a non-GUI instance gracefully

stoptest.sh

  Run the Shutdown client to stop a non-GUI instance abruptly

二.Non-GUI mode( Command-line mode) 非图形化界面运行

  For load testing, you must run JMeter in this mode

命令选项有:

D:\apache-jmeter-3.3\bin>jmeter -?
_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____
/ \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \
/ _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) |
/ ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ <
/_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 3.3 r1808647 Copyright (c) - The Apache Software Foundation --?
print command line options and exit
-h, --help
print usage information and exit
-v, --version
print the version information and exit
-p, --propfile <argument>
the jmeter property file to use
-q, --addprop <argument>
additional JMeter property file(s)
-t, --testfile <argument>
the jmeter test(.jmx) file to run. "-t LAST" will load last
used file
-l, --logfile <argument>
the file to log samples to
-i, --jmeterlogconf <argument>
jmeter logging configuration file (log4j2.xml)
-j, --jmeterlogfile <argument>
jmeter run log file (jmeter.log)
-n, --nongui
run JMeter in nongui mode
-s, --server
run the JMeter server
-H, --proxyHost <argument>
Set a proxy server for JMeter to use
-P, --proxyPort <argument>
Set proxy server port for JMeter to use
-N, --nonProxyHosts <argument>
Set nonproxy host list (e.g. *.apache.org|localhost)
-u, --username <argument>
Set username for proxy server that JMeter is to use
-a, --password <argument>
Set password for proxy server that JMeter is to use
-J, --jmeterproperty <argument>=<value>
Define additional JMeter properties
-G, --globalproperty <argument>=<value>
Define Global properties (sent to servers)
e.g. -Gport=
or -Gglobal.properties
-D, --systemproperty <argument>=<value>
Define additional system properties
-S, --systemPropertyFile <argument>
additional system property file(s)
-f, --forceDeleteResultFile
force delete existing results files before start the test
-L, --loglevel <argument>=<value>
[category=]level e.g. jorphan=INFO, jmeter.util=DEBUG or com
.example.foo=WARN
-r, --runremote
Start remote servers (as defined in remote_hosts)
-R, --remotestart <argument>
Start these remote servers (overrides remote_hosts)
-d, --homedir <argument>
the jmeter home directory to use
-X, --remoteexit
Exit the remote servers at end of test (non-GUI)
-g, --reportonly <argument>
generate report dashboard only, from a test results file
-e, --reportatendofloadtests
generate report dashboard after load test
-o, --reportoutputfolder <argument>
output folder for report dashboard

举例:

jmeter -n -t my_test.jmx -l log.jtl -H my.proxy.server -P 

GUI mode should only be used for creating the test script, NON GUI mode must be used for load testing

三、分布式运行

(1)控制机:也可以参与脚本的运行,同时它也担负着管理远程负载机指挥远程负载机运行的任务,并且收集远程负载机的测试结果。

(2)负载机:向被测应用服务器发起负载的机器。负载机首先要启动一个客户端程序(Agent:jmeter-server.bat),这样控制机才能接管负载机。控制机会把运行的脚本隐蔽地发送到远程负载机,但是如果运行的测试脚本有参数文件及依赖的jar包时,控制机并不能把它们发送到远程负载机,这种情况就需要手动拷贝了。

(3)远程运行逻辑:

  远程负载机首先启动Agent程序,待控制机连接;

  控制机连接上远程负载机;

  控制机发送指令(脚本及启动命令)启动线程;

  负载机运行脚本,回传状态(包括测试结果)

  控制机收集结果并显示。

举例:在10.1.102.68 机器中启动jmeter 作为控制机,在10.1.102.75 机器中启动jmeter作为负载机。

方式一:控制机以GUI方式运行

1.首先在68 jmeter 的jmeter.properties 中指定"remote_hosts" (修改了jmeter.properties 文件需要重新启动JMeter才可以生效)

# Remote Hosts - comma delimited
remote_hosts=10.1.102.75
#remote_hosts=localhost:1099,localhost:2010

2.在75 中,启动JMeter Agent 程序,如

3. 在68中,启动jmeter,做一个简单配置,如下:

点击远程全部启动即可。

此时如果正常运行,则75中的agent 控制台中输出如下:

方式二:控制机通过非GUI方式运行

1. 配置测试计划

2. 在75 中,启动JMeter Agent 程序,如

3. 在68中, 命令行执行如下:

D:\apache-jmeter-3.3\bin>jmeter -n -t F:\jmeter_workspace\测试计划-远程运行实例.jmx -l F:\jmeter_workspace\remote.jtl -R 10.1.102.75
Creating summariser <summary>
Created the tree successfully using F:\jmeter_workspace\测试计划-远程运行实例.jmx
Configuring remote engine: 10.1.102.75
Starting remote engines
Starting the test @ Fri Nov :: CST ()
Remote engines have been started
Waiting for possible Shutdown/StopTestNow/Heapdump message on port

此时如果正常运行,则75中的agent 控制台中输出如下:

四、通过命令行覆盖属性配置

Java system properties and JMeter properties can be overridden directly on the command lin (instead of modifying jmeter.properties). To do so, use the following options:

-D[prop_name]=[value]

  defines a java system property value.

-J[prop_name]=[value]

  defines a local JMeter property.

-G[prop_name]=[value]

  defines a JMeter property to be sent to all remote servers.

-G[propertyfile]

  defines a file containing JMeter properties to be sent to all remote servers.

-L[category]=[priority]

  overrides a logging setting, setting a particular category to the given priority level

举例:

jmeter -Duser.dir=/home/mstover/jmeter_stuff -Jremote_hosts=127.0.0.1 -Ljmeter.engine=DEBUG

实例:从命令行中,指定运行线程数与url

命令行执行命令:

jmeter -n -t "mock_api .jmx" -JthreadCount= -Durl=10.1.102.75

五、命令行选项与properties配置的处理顺序

  1. -p propfile
  2. jmeter.properties (or the file from the -p option) is then loaded
  3. -j logfile
  4. Logging is initialised
  5. user.properties is loaded
  6. system.properties is loaded
  7. all other command-line options are processed

  

***微信扫一扫,关注“python测试开发圈”,了解更多测试教程!***

jmeter-00 JMeter 运行过程的更多相关文章

  1. Jmeter运行过程中如何让Fiddler同时可以抓获到服务器的应答报文

    在默认情况下,Jmeter运行过程中,Fiddler是抓不到对应的应答报文的. 但是,在某些时候,我们希望分析Jmeter执行失败的原因,想了解Jmeter获取到的应答报文是否有问题,就需要同服务器返 ...

  2. jmeter命令行运行-分布式测试

    上一篇文章我们说到了jmeter命令行运行但是是单节点下的, jmeter底层用java开发,耗内存.cpu,如果项目要求大并发去压测服务端的话,jmeter单节点难以完成大并发的请求,这时就需要对j ...

  3. 记录Jmeter集成Jenkins运行Ant做接口监听

    最近在鼓捣Jmeter的接口测试,把他集成到了Jenkins上做自动化接口监听.把操作记录下来. 首先就是进行接口测试的编写.打开Jmeter.主要是把接口的测试逻辑和断言处理调通后就OK了,接口程序 ...

  4. JMeter安装+配置+运行

    环境配置: 操作系统:Win7系统 jdk版本:1.8 JMeter版本:3.0 一  JMeter的安装配置过程 JMeter是100%纯java应用程序,它在任何支持完整java实现的系统上都能正 ...

  5. Jmeter非GUI运行,生成html报告

    一.JMete执行方式 JMeter执行方式有2种,一种是GUI模式,一种是非GUI模式.GUI模式就是界面模式,非GUI模式就是命令行模式.界面模式主要用来编写和调试脚本用的,项目的真正执行最好是采 ...

  6. jmeter的基本使用过程

    jmeter的基本使用过程 接下来几周,我将通过视频的方式,录制下来jmeter的基本用法,方便大家参考学习 可能导图会随时调整

  7. Jmeter命令行运行配置环境变量

    Jmeter命令行运行配置环境变量 在打开jmeter GUI界面时会弹出cmd命令窗口提示:压测时不要用GUI,要用命令行 在cmd命令行里面运行jmeter的话,需要配置jmeter环境变量,下面 ...

  8. JMeter (3) —— JMeter录制脚本并压力测试用户登陆场景以CAS SSO为例(101 Tutorial)

    JMeter (3) -- JMeter录制脚本并压力测试用户登陆场景以CAS SSO为例(101 Tutorial) 主要内容 JMeter录制脚本并进行压力测试用户登陆场景,并以CAS SSO单点 ...

  9. JMeter接口测试-JMeter+ant实现接口自动化测试

    前言 小伙伴们,用python做接口自动化是不是写代码比较繁琐,而且没有python代码基础的小伙伴根本无从下手对吧!今天我们来学习一下如何使用JMeter工具实现接口自动化测试. 1.安装JDK,配 ...

随机推荐

  1. windows平台mongoDB安装配置

    一.首先安装mongodb 1.官网下载mongoDB:http://www.mongodb.org/downloads,选择windows平台.安装时,一路next就可以了.我安装在了F:\mong ...

  2. vue——学习笔记

    1.vue需要在dom加载完成之后实现实例化 eg: window.onload = function(){ new Vue({ el: '#editor', data: { input: '# he ...

  3. 利用google api生成二维码名片

    利用google api生成二维码名片 二维条码/二维码可以分为堆叠式/行排式二维条码和矩阵式二维条码.堆叠式/行排式二维条码形态上是由多行短截的一维条码堆叠而成:矩阵式二维条码以矩阵的形式组成,在矩 ...

  4. Java基础知识陷阱(六)

    本文发表于本人博客. 上次说了下equals跟==的问题,今天再来认识一下这个equals()跟hasCode().上次的代码如下: class Person{ public String name; ...

  5. 『NiFi 学习之路』使用 —— 主要组件的使用

    一.概述 大部分 NiFi 使用者都是通过 NiFi 的 Processor 来实现自己的业务的.因此,我也主要就 NiFi 官方提供的 Porcessor 进行介绍. 二.Processor 如果你 ...

  6. Connecting to a Remote Serial Port over TCP/IP

    https://www.acmesystems.it/socat This article illustrates how to realize a lan to serial gateway Rem ...

  7. SCP命令只能单项拷贝,另一个方向“RSA host key for 172.16.103.176 has changed and you have requested strict checki Host key verification failed. lost connection”问题

    [dinghuaneng@95 move_data]$ scp * dinghuaneng@172.16.103.176:/home/dinghuaneng@@@@@@@@@@@@@@@@@@@@@@ ...

  8. Spring-2-A Magic Grid(SPOJ AMR11A)解题报告及测试数据

    Magic Grid Time Limit:336MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Description Tha ...

  9. 【转】html之file标签 --- 图片上传前预览 -- FileReader

    记得以前做网站时,曾经需要实现一个图片上传到服务器前,先预览的功能.当时用html的<input type="file"/>标签一直实现不了,最后舍弃了这个标签,使用了 ...

  10. js实现excel的解析

    在浏览网页的时候不小心看到了这个github的资源(https://github.com/SheetJS/js-xlsx),真不错.之前在开发的时候曾遇到客户要求在前端解析excel并展示出来.这里记 ...