jmeter script development: jmeter tool of learning (b)

A. Jmeter environment Installation and Configuration

Free open source tools under the Apache

java development - runtime environment jre, jdk, cross-platform

1. Install jdk1.8

2. Download the free jmeter (greater than 3.2 version), extract

3. Start jmeter

  • jmeter.bat jemter.sh the bin
  • 双击 ApacheJmeter.jar 或 java -jar ApacheJmeter.jar

The same system can start JMeter plurality of (the same version, different versions), not arranged JMETER_HOME

Two. Jmeter file structure

  • bin: startup scripts, configuration files
  • docs: api documentation
  • lib: lib / ext put third-party plug-ins
  • Something other than the extension: extras
  • printable_docs: Offline Documentation

Three. Jmeter GUI tool introduced

Tools menu

  Changing the display language: options> choose language> Chinese simple

  In the language configuration jmeter.properties = zh_CN

Right operation

  run

  Logs \ Empty log

  help

 

III. Jmeter part of the script

1. Thread Group Threads: scene design

2. Sampler Sampler: Scripting

3. Listeners Listener: Result Report

Four. Jmeter works

Simulate multi-user operation sends a request to the server, and collect responses results for data analysis

Five. Jmeter element

Test Plan: script container

  Thread group: for set design

      Sampler: script for the production of different protocols

      Logic Controller: control conditions

      Preprocessor: Pretreatment

        Postprocessor: Information Extraction

      Assertion: information verification

      Timer

      Test clip: Test Case Management

      Configuration element: original device

      Monitor: results of monitoring and analysis

  Configuration elements

  Monitor

  Timer

  Preprocessor

  Postprocessor

  Affirmation

  Test clip

  Non-testing device, the proxy server

Sampling is not shared, the lowest priority

 

Thread Attributes

Ramp-Up时间:代表启动耗时多少。以下场景代表1s内启动100个线程,运行1次就结束。如果Ramp-Up改为5,表示5s内启动100个线程,循环1次。这个不能平均为1s启动20个。注意100以上的线程,建议使用10s以上的时间来启动,如果1s内启动100个线程,很突然并发,服务器的压力会陡然上升

 

 

如果循环次数为4,表示100是这个线程组的包,100这个线程组反复循环4次,不是100中某一个线程循环4次,应该看作一个整体。第0-10s这个时间点已经把100个线程启动好了,已经循环了一次,然后10s后开始循环第二次,第三次...,后面的三次循环的时间看具体使用了多少,有可能1s内完成了300次调用,那么总共耗时等于11s,如果用了2s,那么总共耗时等于12s

 

 

调度器:计划在某个时间点做什么事情。循环次数永远 + 持续时间10s,以下场景表示不限循环次数,在10s内启动100个线程,一直持续10s,总共耗时等于20s,20s之后就会结束,至于结束用了1s还是2s,有可能会变成21s,22s。会超过20s多一点点

 

循环次数=4 + 持续时间10s,以下场景表示10s内启动100个线程,循环一次,10s后开始循环后面三次,有可能后面三次只消耗了1s,但计划的时间是20s,所以剩下9s的时间用来等待结束。一般不会这样使用

 

启动延迟2s,以下场景表示0-2s时间段不做任何事情,从2s-12s,启动100个线程,然后一直运行下去

 

 

线程数10,循环10次和线程数100,循环1次,有什么区别?

前者10个线程一起打包循环,10次循环是循环了10个线程组,后者1次循环只循环了1个线程组,这里面有100个线程,跑了1次

线程组和线程是两个完全不同的东西

 

 

 

 

 

  

 

Guess you like

Origin www.cnblogs.com/my_captain/p/12582468.html