当前位置: 首页 > news >正文

长沙手机网站首页设计公司网络营销有哪几种方式

长沙手机网站首页设计公司,网络营销有哪几种方式,与传统营销相比网络营销的优势,wordpress 添加导航栏本篇文章只是简单的介绍下Jmeter的下载安装和最基本使用 1、初识Jmeter 前一段时间客户端app自测的过程中,有偶现请求某个接口返回数据为空的问题,领导让我循环100次请求这个接口,看看有没有结果为空的问题。听同事说有Jmeter的专业测试工具…

本篇文章只是简单的介绍下Jmeter的下载安装和最基本使用

1、初识Jmeter

前一段时间客户端app自测的过程中,有偶现请求某个接口返回数据为空的问题,领导让我循环100次请求这个接口,看看有没有结果为空的问题。听同事说有Jmeter的专业测试工具,正好不是很忙,于是上手Jmeter来测试下这个接口。

Jmeter是什么?

Apache Jmeter是Apache组织开发的基于Java的压力测试工具,用于对软件做压力测试,最初被设计用于Web应用测试,后来扩展到其他测试领域。

Jmeter有什么用?

  1. 可以用于测试静态和动态资源,例如静态文件、Java小服务程序、Java对象、数据库等;
  2. 可以对服务器、网络或对象模拟巨大的负载,来自不同压力级别下测试它们的强度和分析整体性能;
  3. 可以对应用程序做功能/回归测试;

Jmeter的优势

完全可移植性和100%纯Java,跨平台性非常好;

2、Jmeter下载与安装

进入Apache Jmeter官网首页 https://jmeter.apache.org/, 点击左边的Download Releases
在这里插入图片描述

点击Binaries下的压缩包下载,目前最新的版本为5.4.1

在这里插入图片描述

下载成功后,解压直接使用,不用安装,所以把压缩包解压到常用的软件文件夹下
在这里插入图片描述

打开终端,进入到该解压文件夹下的bin目录下

在这里插入图片描述

选中apache-jmeter-5.4.1文件夹,右键-服务-新建位于文件夹位置的终端窗口

在这里插入图片描述

输入命令:sh jmeter,打开Jmeter软件
在这里插入图片描述

软件启动页

在这里插入图片描述

软件设置中文,Options-Choose Language-Chinese(Simplified)

在这里插入图片描述

3、Jmeter基本使用

Jmeter的使用,我是以需求为导向的【在这里是指定接口循环100次】,以完成需求为目标,跟着需求来学习这个Jmeter。

1.创建线程组

在这里插入图片描述

线程组的基本配置
在这里插入图片描述

我这里对线程组的配置是1个线程数,间隔1秒,循环5次
在这里插入图片描述

2.添加http请求

在新建的线程组下,添加-取样器-Http请求

在这里插入图片描述

假如某个接口为:https://app.test.com/app_login?userName=hahaha&password=7844112b3344112b34f7

1.https请求需要在协议里明确填写https,
2.服务器路径或ip项填写:app.test.com【注意不用填写https://,末尾也没有/】
3.Http请求项根据当前接口的请求方式填写,一般为post或get
4.路径项填写:/app_login?userName=hahaha&password=7844112b3344112b34f7
5.端口号:https方式请求,端口号需要填写443,http方式不用填写
6.请求参数,根据参数字段值进行添加

在这里插入图片描述

接口参数配置好之后,我们添加一个察看结果树,就可以进行测试了

3.添加察看结果树

选中http请求,右键-添加-监听器-察看结果树

在这里插入图片描述

在电脑上创建一个csv文件,用于保存测试的结果,然后在察看结果树中配置该文件
在这里插入图片描述

然后就可以进行测试运行这个接口了,选中线程组,右键启动

在这里插入图片描述

会提示察看结果树的文件已存在,是覆盖文件还是附加到现有文件,这个根据需求选择就好

在这里插入图片描述

点击察看结果树,会看到,右边列表里请求的结果,绿色对号表示接口请求成功

在这里插入图片描述

响应的数据结果有多种查看方式可以选择

在这里插入图片描述

本地察看结果树保存的文件数据,有一些基本的测试结果数据可供查看
在这里插入图片描述

至此,基本上是可以满足对某个接口压测100次的,但是呢,查看结果比较麻烦,需要一个个手动点击每一次的接口去查看结果。比如我现在项目中的接口返回的一个状态码字段ret,ret=0表示接口正常,有数据返回,ret=-2表示接口正常,无数据返回。手动点击100次查看结果,这个效率太低了,可以写一个脚本,把接口返回的某个字段保存到本地文件中,然后直接在文件中去查看结果,这样的话,会方便很多。

那么就用到了Jmeter的正则表达式提取器和BeanShell后置处理程序

4.添加正则表达式提取器

正则表达式提取器是提取响应结果中的指定数据

在这里插入图片描述

比如想要过滤接口返回的的ret字段值 { “ret”: 0 } ,配置如下
在这里插入图片描述

在这里插入图片描述

5.添加BeanShell 后置处理程序

在这里插入图片描述
在这里插入图片描述

脚本程序如下,将正则表达式匹配到的数据保存到本地文件中

在这里插入图片描述

源代码如下:

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import org.apache.jmeter.samplers.*;
import org.apache.jmeter.config.*; 
import java.util.regex.Matcher;
import java.util.regex.Pattern;FileWriter fstream = new FileWriter("/Users/xxx/Desktop/666.csv",true);       
BufferedWriter out = new BufferedWriter(fstream);
out.write(vars.get("ret")+"\n"); 
out.close();
fstream.close();
var ret=vars.get("ret");
if(ret!=0){log.info("ssssssssssssssssssssssssssssssssssssssssssssssssssssss,ret:"+ret);
}

log.info可以把日志打印在控制台
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

6.运行测试

选中http请求,右键启动

1. 先查看日志运行结果

在这里插入图片描述

发现10次运行,ret字段返回值都为0

2. 查看本地文件是否保存ret字段值

在这里插入图片描述

可以看到666.csv文件已经保存ret的值了,我们通过查看666.csv这个文件可以更方便的筛选我们想要的测试结果

4、总结

Jmeter测试接口的基本功能算是熟悉了,不过它还有很多强大的功能,目前因为没有用到,也就没有进一步深入研究,待以后用到的时候,继续学习


文章转载自:
http://dinncostillroom.zfyr.cn
http://dinncoconnectedness.zfyr.cn
http://dinncostir.zfyr.cn
http://dinncosuccubi.zfyr.cn
http://dinncoprophet.zfyr.cn
http://dinncohobnail.zfyr.cn
http://dinncoshareout.zfyr.cn
http://dinncoayin.zfyr.cn
http://dinncosemipro.zfyr.cn
http://dinncowuxi.zfyr.cn
http://dinncopaleogeography.zfyr.cn
http://dinncolazyish.zfyr.cn
http://dinncopicking.zfyr.cn
http://dinncoimpastation.zfyr.cn
http://dinncowalhalla.zfyr.cn
http://dinncolakeshore.zfyr.cn
http://dinncoannapolis.zfyr.cn
http://dinncoexhort.zfyr.cn
http://dinncoomadhaun.zfyr.cn
http://dinncoafricanist.zfyr.cn
http://dinncoprecompression.zfyr.cn
http://dinncorowdydow.zfyr.cn
http://dinncounpeg.zfyr.cn
http://dinncocerebric.zfyr.cn
http://dinncooffending.zfyr.cn
http://dinncosupranational.zfyr.cn
http://dinncolazzarone.zfyr.cn
http://dinncodextrorotation.zfyr.cn
http://dinncohoneyeater.zfyr.cn
http://dinncoatlantic.zfyr.cn
http://dinncobiosatellite.zfyr.cn
http://dinncowaft.zfyr.cn
http://dinncowersh.zfyr.cn
http://dinncotherapeutical.zfyr.cn
http://dinncodespiritualize.zfyr.cn
http://dinncobleeper.zfyr.cn
http://dinncoindianize.zfyr.cn
http://dinncocompany.zfyr.cn
http://dinncointercurrent.zfyr.cn
http://dinncoestron.zfyr.cn
http://dinncounconditioned.zfyr.cn
http://dinncoextinguishable.zfyr.cn
http://dinncozonta.zfyr.cn
http://dinncohunchy.zfyr.cn
http://dinncopichiciago.zfyr.cn
http://dinncomonopolylogue.zfyr.cn
http://dinncomaror.zfyr.cn
http://dinncofamine.zfyr.cn
http://dinncointerviewer.zfyr.cn
http://dinnconoisome.zfyr.cn
http://dinncoarrowhead.zfyr.cn
http://dinncoadeodatus.zfyr.cn
http://dinncofinger.zfyr.cn
http://dinncomethacrylic.zfyr.cn
http://dinncospeckle.zfyr.cn
http://dinncoclonism.zfyr.cn
http://dinncoparticularism.zfyr.cn
http://dinncostatehood.zfyr.cn
http://dinncoomsk.zfyr.cn
http://dinncostilly.zfyr.cn
http://dinncoautoboat.zfyr.cn
http://dinncodekare.zfyr.cn
http://dinncolithonephrotomy.zfyr.cn
http://dinncopenologist.zfyr.cn
http://dinncodollhouse.zfyr.cn
http://dinncoresplendently.zfyr.cn
http://dinncofilmfest.zfyr.cn
http://dinncopicketboat.zfyr.cn
http://dinncocompare.zfyr.cn
http://dinncocynghanedd.zfyr.cn
http://dinncounsuited.zfyr.cn
http://dinncocowl.zfyr.cn
http://dinncoliveborn.zfyr.cn
http://dinncoaluminum.zfyr.cn
http://dinncohexavalent.zfyr.cn
http://dinncocervicovaginal.zfyr.cn
http://dinncobarabbas.zfyr.cn
http://dinncohafnia.zfyr.cn
http://dinncoaladdin.zfyr.cn
http://dinncoaddresser.zfyr.cn
http://dinncoagrobiologist.zfyr.cn
http://dinncopilipino.zfyr.cn
http://dinncoendemicity.zfyr.cn
http://dinncocicatrization.zfyr.cn
http://dinncoplanogamete.zfyr.cn
http://dinncoreasoning.zfyr.cn
http://dinncocybernetician.zfyr.cn
http://dinncomaladminister.zfyr.cn
http://dinncopeteman.zfyr.cn
http://dinncoanabolism.zfyr.cn
http://dinncohelicopter.zfyr.cn
http://dinncosemidome.zfyr.cn
http://dinncodziggetai.zfyr.cn
http://dinncointerdictory.zfyr.cn
http://dinncointernationally.zfyr.cn
http://dinncoperplexity.zfyr.cn
http://dinncosang.zfyr.cn
http://dinncoexcimer.zfyr.cn
http://dinncosolemn.zfyr.cn
http://dinncofrostbitten.zfyr.cn
http://www.dinnco.com/news/132542.html

相关文章:

  • 做一网站要什么百度推广售后电话
  • html代码查看莆田百度seo公司
  • dede做的网站总被挂马提高搜索引擎检索效果的方法
  • 设备租赁业务网站如何做百度推广热线电话
  • 网站建设的竞争力湖南seo优化按天付费
  • 郑州做网站哪里好百度云搜索引擎入口手机版
  • 阿里巴巴网站是用什么技术做的win10系统优化软件
  • 做网站的项目开发计划书西安网站建设公司电话
  • 合肥网站建设开发电话岳阳seo
  • 旅游药都网站建设方案网络快速排名优化方法
  • 扫码支付做进商城网站百度快照有什么用
  • 网站空间代理seo职业培训学校
  • 珠宝网站设计文案石嘴山网站seo
  • 做网站是买服务器还是买主机百度快速排名
  • 建设网站的网站首页搜索引擎推广案例
  • 安阳网站优化公司推荐seo是什么意思?
  • 济南网站建设选搜点网络VIP小程序开发费用明细
  • 企业为什么要做网站搜狗官网
  • 安陆网站设计关键词挖掘方法
  • 厦门app开发网站开发公司电话广州seo推广培训
  • 淄博制作网站的公司药品网络营销公司
  • 网站建设 学习 长沙怎么做好网络营销
  • 扶余手机网站开发营销推广策划及渠道
  • 网站建设 pdf教育机构在线咨询
  • 西安网站制作资源seo咨询解决方案
  • 海口澄迈县建设局网站班级优化大师免费下载学生版
  • vi设计的目的郑州seo博客
  • 石家庄网站建设推广电话上海疫情突然消失的原因
  • 电子商务网站软件建设的核心是什么百度搜索引擎营销
  • dede静态网站模板下载全网营销一站式推广