<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                >[info] 圖形化運行有助于調試;非圖形化運行做性能測試更準確! [TOC] <br> ### 一.GUI mode 圖形化界面運行 JMeter運行腳本,存放在安裝目錄下的bin文件夾下 對于windows環境,啟動腳本文件是 `jmeter.bat` 對于linux環境,啟動腳本文件是`jmeter` #### 常用的腳本 - jmeter:啟動 JMeter (默認圖形化界面) - jmeter-server:啟動JMeter 服務模式 ### 二、Non-GUI mode( 命令行模式) 非圖形化界面運行 在負載測試中,我們必須使用非圖形化界面運行的模式 #### 命令選項 ```cmd D:\apache-jmeter-3.3\bin>jmeter -? _ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____ / \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \ / _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) | / ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ < /_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 3.3 r1808647 Copyright (c) 1999-2017 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=123 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 ``` #### 命令行模式運行舉例 ```cmd jmeter -n -t my_test.jmx -l log.jtl -H my.proxy.server -P 8000 ``` -n: 非圖形化運行 -t: 指定jmx腳本文件 -l: 指定log文件 -H: 指定代理服務器 -P: 指定代理服務器端口 ### 三、分布式運行 (1)**控制機**:也可以參與腳本的運行,同時它也擔負著管理遠程負載機指揮遠程負載機運行的任務,并且收集遠程負載機的測試結果。 (2)**負載機**:向被測應用服務器發起負載的機器。負載機首先要啟動一個客戶端程序(Agent:jmeter-server.bat),這樣控制機才能接管負載機。控制機會把運行的腳本隱蔽地發送到遠程負載機,但是如果運行的測試腳本有參數文件及依賴的jar包時,控制機并不能把它們發送到遠程負載機,這種情況就需要手動拷貝了。 (3)**遠程運行邏輯**: 1. 遠程負載機首先啟動Agent程序,待控制機連接; 2. 控制機連接上遠程負載機; 3. 控制機發送指令(腳本及啟動命令)啟動線程; 4. 負載機運行腳本,回傳狀態(包括測試結果) 5. 控制機收集結果并顯示。 >實例:在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 程序,如 ![](https://box.kancloud.cn/17ac8961c98c21608186fa1f7d66b8d4_860x77.jpg) 3. 在68中,啟動jmeter,做一個簡單配置,如下: ![](https://box.kancloud.cn/94b40d3817cf8c46fb2e110c63753b9b_901x389.jpg) 4. 點擊遠程全部啟動 ![](https://box.kancloud.cn/26fd8f967f7e7785e051060625f1ee7e_134x79.jpg) 如果運行正常,在75中的agent 控制臺中輸出如下: ![](https://box.kancloud.cn/20dc88de0a69d293cb40e1672ad0eb08_661x78.jpg) #### 方式二:控制機通過非GUI方式運行 1. 配置測試計劃 ![](https://box.kancloud.cn/bc5fb5400b60aa020a42cc91c4af47e9_972x430.jpg) 2. 在75 中,啟動JMeter Agent 程序,如 ![](https://box.kancloud.cn/d484de13680710be7ae78d9e636392e6_640x52.jpg) 3. 在68中, 命令行執行如下: ```cmd jmeter -n -t F:\jmeter_workspace\測試計劃-遠程運行實例.jmx -l F:\jmeter_workspace\remote.jtl -R 10.1.102.75 ``` 此時如果正常運行,則75中的agent 控制臺中輸出如下: ![](https://box.kancloud.cn/1258e559a7dfa808ba868b84b3f4bc83_769x116.jpg) ### 四、通過命令行覆蓋屬性配置 #### 參數選項 在運行jmeter的命令行中,可以傳入指定參數(非修改jmeter.properties配置文件)可以覆蓋配置文件中的參數。可用的參數選項有: -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 **例子**: ```cmd jmeter -Duser.dir=/home/mstover/jmeter_stuff -Jremote_hosts=127.0.0.1 -Ljmeter.engine=DEBUG ``` #### 實例:從命令行中,指定運行線程數與url 1. 設置線程數:`${__P(threadCount,)}` ![](https://box.kancloud.cn/ff5ad49ec51ee5e3dee227565ebce399_830x437.jpg) 2. 設置服務器名稱:`${__property(url,,)}` ![](https://box.kancloud.cn/8fef5df188e1d4ffe3baf875ac02d003_924x431.jpg) 3. 命令行執行命令: ```cmd jmeter -n -t "mock_api .jmx" -JthreadCount=5 -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 <hr style="margin-top:100px"> :-: ![](https://box.kancloud.cn/331f659e8e6cddb0d9f182e00e32803f_258x258.jpg) ***微信掃一掃,關注“python測試開發圈”,獲取更多測試開發分享!***
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看