51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1191|回复: 1
打印 上一主题 下一主题

【转帖】性能测试与持续集成

[复制链接]
  • TA的每日心情
    无聊
    2024-7-12 13:16
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    跳转到指定楼层
    1#
    发表于 2017-7-20 11:15:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

    目的

    1.将性能测试与持续集成挂接起来

    2.性能测试: JMeter

    3.持续集成: Jenkins

    JMeter

    1.下载JMeter,官网: http://jmeter.apache.org/
    2.创建测试计划: 访问 http://www.cnblog.com ,验证Response的返回值中存在cnblog

    Thread组配制

    Http请求

    Response断言

    3.使用GUI的JMeter查看运行测试结果

    GUI JMeter测试结果

    4.使用命令行执行测试

    -J 指定生成的结果格式为xml,-t 指定测试文件,-l 测试结果


    java -jar ApacheJMeter.jar -Jjmeter.save.saveservice.output_format=xml -n -t

    /Users/yjshi/Downloads/TestPlan.jmx -l TestPlan.jtl


    结果


    Writing log file to: /Users/yjshi/Downloads/apache-jmeter-3.0/bin/jmeter.log

    Creating summariser <summary>

    Created the tree successfully using /Users/yjshi/Downloads/TestPlan.jmx

    Starting the test @ Thu Aug 04 18:41:43 CST 2016 (1470307303526)

    Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445

    summary = 10 in 00:00:01 = 8.3/s Avg: 333 Min: 183 Max: 539 Err: 0 (0.00%)

    Tidying up ... @ Thu Aug 04 18:41:44 CST 2016 (1470307304767)

    ... end of run


    JMeter已经可以通过命令行来执行

    Jenkins

    配制JMeter

    1.下载Jenkins包,官网: https://jenkins.io/

    2.启动Jenkins


    Running from: /Users/yjshi/Downloads/All/Software/jenkins/jenkins.war

    webroot: $user.home/.jenkins

    Aug 04, 2016 5:52:13 PM winstone.Logger logInternal

    INFO: Beginning extraction from war file

    Aug 04, 2016 5:52:13 PM org.eclipse.jetty.util.log.JavaUtilLog info

    INFO: jetty-winstone-2.9

    Aug 04, 2016 5:52:19 PM org.eclipse.jetty.util.log.JavaUtilLog info

    INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet

    Jenkins home directory: /Users/yjshi/.jenkins found at: $user.home/.jenkins

    Aug 04, 2016 5:52:26 PM org.eclipse.jetty.util.log.JavaUtilLog info

    INFO: Started SelectChannelConnector@0.0.0.0:8080

    Aug 04, 2016 5:52:26 PM winstone.Logger logInternal

    INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled

    Aug 04, 2016 5:52:26 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Started initialization

    Aug 04, 2016 5:52:32 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Listed all plugins

    Aug 04, 2016 5:52:32 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Prepared all plugins

    Aug 04, 2016 5:52:32 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Started all plugins

    Aug 04, 2016 5:52:32 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Augmented all extensions

    Aug 04, 2016 5:52:35 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Loaded all jobs

    Aug 04, 2016 5:52:35 PM hudson.model.AsyncPeriodicWork$1 run

    INFO: Started Download metadata

    Aug 04, 2016 5:52:35 PM org.jenkinsci.main.modules.sshd.SSHD start

    INFO: Started SSHD at port 54488

    Aug 04, 2016 5:52:35 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Completed initialization

    Aug 04, 2016 5:52:35 PM hudson.UDPBroadcastThread run

    INFO: Cannot listen to UDP port 33,848, skipping: java.net.SocketException: Can't assign requested address

    Aug 04, 2016 5:52:35 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Started initialization

    Aug 04, 2016 5:52:35 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Listed all plugins

    Aug 04, 2016 5:52:35 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Prepared all plugins

    Aug 04, 2016 5:52:35 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Started all plugins

    Aug 04, 2016 5:52:35 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Augmented all extensions

    Aug 04, 2016 5:52:35 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Loaded all jobs

    Aug 04, 2016 5:52:35 PM jenkins.InitReactorRunner$1 onAttained

    INFO: Completed initialization

    Aug 04, 2016 5:52:35 PM hudson.WebAppMain$3 run

    INFO: Jenkins is fully up and running


    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

    x
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    无聊
    2024-7-12 13:16
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    2#
     楼主| 发表于 2017-7-20 11:17:30 | 只看该作者

    3.安装Performance plugin插件: Performance Plugin

    .Performance plugin

    4.配制Jenkins中的JOB


    echo 'begin testing'

    java -jar /Users/yjshi/Downloads/apache-jmeter-3.0/bin/ApacheJMeter.jar -Jjmeter.save.saveservice. output_format=xml -n -t /Users/yjshi/Downloads/TestPlan.jmx -l TestPlan.jtl

    echo 'testing end'


    5.运行JOB,查看结果


    Jenkins执行结果

    6.在JOB的workspace下会生成两个文件jmeter.log TestPlan.jtl

    jmeter.log TestPlan.jtl

    配制运行报告

    1.添加测试报告

    报告读取

    2.查看统计结果

    统计结果

    后续

    1.可将jmx文件存放到仓库中,便于维护和管理

    2.将JOB添加到版本构建中,在版本构建完成后,自动执行性能,确保每次的版本Build均满足性能需求

    参考

    1.JMeter

    2.Jenkins

    3.Performance Plugin

    4.Continuous Integration 101: How to Run JMeter With Jenkins


    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

    x
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-20 05:38 , Processed in 0.065701 second(s), 24 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表