美文网首页
JMeter简单使用

JMeter简单使用

作者: nzdxwl | 来源:发表于2019-12-15 00:05 被阅读0次

简单介绍

Apache JMeter是一个开源、纯Java编写,设计来为应用程序进行功能行为测试以及性能衡量的软件。

官网

Apache JMeter may be used to test performance both on static and dynamic resources, Web dynamic applications.
It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.

Apache JMeter features include:

  • Ability to load and performance test many different applications/server/protocol types:
    • Web - HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET, …)
    • SOAP / REST Webservices
    • FTP
    • Database via JDBC
    • LDAP
    • Message-oriented middleware (MOM) via JMS
    • Mail - SMTP(S), POP3(S) and IMAP(S)
    • Native commands or shell scripts
    • TCP
    • Java Objects
  • Full featured Test IDE that allows fast Test Plan recording (from Browsers or native applications), building and debugging.
  • CLI mode (Command-line mode (previously called Non GUI) / headless mode) to load test from any Java compatible OS (Linux, Windows, Mac OSX, …)
  • A complete and ready to present dynamic HTML report
  • Easy correlation through ability to extract data from most popular response formats, HTML, JSON , XML or any textual format
  • Complete portability and 100% Java purity.
  • Full multi-threading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
  • Caching and offline analysis/replaying of test results.
  • Highly Extensible core:
    • Pluggable Samplers allow unlimited testing capabilities.
    • Scriptable Samplers (JSR223-compatible languages like Groovy and BeanShell)
    • Several load statistics may be chosen with pluggable timers.
    • Data analysis and visualization plugins allow great extensibility as well as personalization.
    • Functions can be used to provide dynamic input to a test or provide data manipulation.
    • Easy Continuous Integration through 3rd party Open Source libraries for Maven, Gradle and Jenkins.

简单示例:

下面进行压力测试,模拟100用户同时调用下的运行情况,由于此次关注点在如何使用JMeter,服务接口的内部实现就略过,可自主实现。

前期准备

  • 准备好要测试的服务接口,此次测试地址如下,该接口有两个方法,接收一个整数:


    接口方法
  • 下载并运行JMeter:
    jmeter下载地址
    这里测试环境为windows,下载后解压后运行jmeter.bat

建立和测试计划

  1. 首先选择测试计划,添加线程组:


    添加线程组

    添加后进行配置:


    image.png
    这里配置100并发,只执行一次。
  2. 创建Http请求并配置:


    image.png

    下面配置的是调用/add/{num}使用路径变量形式的url,如果是不是路径参数的话,去掉url后面的${num},在下面Parameters页面添加名称为num的参数,值不用设置,同样使用随后我们创建的随机变量配置来生成即可。


    image.png
  1. 添加随机变量生成配置


    image.png
image.png
  1. 添加结果查看树
image.png
  1. 选中测试计划并执行后,可以到结果查看树查看执行情况:


    image.png

这样一个简单的使用JMeter进行测试的例子就完成了。

相关文章

  • 5. 秒杀-Jmeter压力测试

    1.Jmeter基本使用 为了验证秒杀优化的效果,我们使用了Jmeter进行压力测试。这里就简单总结下Jmeter...

  • jmeter 简单使用

    jmeter简单入门 背景 在工作中总是会遇到一些需要几十或是过百条数据,作为调用方只能调接口,无其他权限。比如,...

  • JMeter简单使用

    简单介绍 Apache JMeter是一个开源、纯Java编写,设计来为应用程序进行功能行为测试以及性能衡量的软件...

  • Jmeter简单使用

    ## 添加线程组 ## 添加http请求 ##配置HTTP请求 ## 压测结果查看 右键HTTP请求 ->监听器-...

  • Postman与Jmeter-----2

    前一节简单的介绍了Postman的使用,现在介绍Jmeter的使用。Jmeter 安装好后,进入bin目录下,找到...

  • JMeter BeanShell简单使用

    背景 使用JMeter进行接口测试,有时候需要编写一些BeanShell脚本语言,或者利用BeanShell调用自...

  • Jmeter之Bean shell使用(二)

    上一篇Jmeter之Bean shell使用(一)简单介绍了下Jmeter中的Bean shell,本文是对上文的...

  • JMeter基础14 -- 时间戳打印

    在使用jMeter做接口测试时,有些时候接口请求参数需要使用时间戳。 JMeter中提供了简单的时间戳函数供调用 ...

  • jmeter学习指南

    jmeter入门1.1. jmeter简介1.2. jmeter安装 jmeter基本使用2.1. jmeter基...

  • 0214--基于Netty的简单WebService以及Jmet

    1.Jmeter的简单使用:http://www.cnblogs.com/TankXiao/p/4059378.h...

网友评论

      本文标题:JMeter简单使用

      本文链接:https://www.haomeiwen.com/subject/qtstnctx.html