zoukankan      html  css  js  c++  java
  • httprunner-1-linux下搭建hrun(上)

    前言

    相信不少小伙伴对开源项目 httprunner 都很感兴趣,我们来看下它的有哪些特点吧:

    • 项目管理:新增项目、列表展示及相关操作,支持用例批量上传(标准化的HttpRunner json和yaml用例脚本)
    • 模块管理:为项目新增模块,用例和配置都归属于module,module和project支持同步和异步方式
    • 用例管理:分为添加config与test子功能,config定义全部变量和request等相关信息 request可以为公共参数和请求头,也可定义全部变量
    • 场景管理:可以动态加载可引用的用例,跨项目、跨模快,依赖用例列表支持拖拽排序和删除
    • 运行方式:可单个test,单个module,单个project,也可选择多个批量运行,支持自定义测试计划,运行时可以灵活选择配置和环境,
    • 分布执行:单个用例和批量执行结果会直接在前端展示,模块和项目执行可选择为同步或者异步方式,
    • 环境管理:可添加运行环境,运行用例时可以一键切换环境
    • 报告查看:所有异步执行的用例均可在线查看报告,可自主命名,为空默认时间戳保存,
    • 定时任务:可设置定时任务,遵循crontab表达式,可在线开启、关闭,完毕后支持邮件通知
    • 持续集成:jenkins对接,开发中。。。

    特点还不错,但是目前此项目已停止维护,作为测开的我们在此基于hrun(httprunner)进行二次开发是个很不错的选择!

    一、预备工作

    1、阿里云服务器,注意:如果重置密码后,需要重启服务器;

    2、注意开放所用到的端口,小编直接暴力开放了全部端口;

    3、远程连接服务器工具:XshellSecureCRTPortable(小编用的就是这个)

    我们hrun所需环境:python3 + mysql5.7(官方推荐)+ Django2 + httprunner==1.58

    二、搭建python3环境

    1、安装环境依赖包,避免后面少出现包的问题(之前试过没运行,导致没有pip3

    命令:yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel mysql-devel

    [root@iZbp19lugf22zbsubsf1y6Z home]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel mysql-devel
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    base | 3.6 kB 00:00:00
    docker-ce-stable | 3.5 kB 00:00:00
    epel | 5.3 kB 00:00:00
    extras | 2.9 kB 00:00:00
    updates | 2.9 kB 00:00:00
    (1/4): extras/7/x86_64/primary_db | 153 kB 00:00:00
    (2/4): epel/x86_64/updateinfo | 1.0 MB 00:00:00
    (3/4): updates/7/x86_64/primary_db | 2.8 MB 00:00:00
    (4/4): epel/x86_64/primary_db | 6.9 MB 00:00:00
    Package zlib-devel-1.2.7-18.el7.x86_64 already installed and latest version
    Package bzip2-devel-1.0.6-13.el7.x86_64 already installed and latest version
    Package 1:openssl-devel-1.0.2k-19.el7.x86_64 already installed and latest version
    Package ncurses-devel-5.9-14.20130511.el7_4.x86_64 already installed and latest version
    Package sqlite-devel-3.7.17-8.el7.x86_64 already installed and latest version
    Package readline-devel-6.2-11.el7.x86_64 already installed and latest version
    Package 1:tk-devel-8.5.13-6.el7.x86_64 already installed and latest version
    Package gdbm-devel-1.10-8.el7.x86_64 already installed and latest version
    Package libdb4-devel-4.8.30-13.el7.x86_64 already installed and latest version
    Package 14:libpcap-devel-1.5.3-11.el7.x86_64 already installed and latest version
    Package xz-devel-5.2.2-1.el7.x86_64 already installed and latest version
    Package 1:mariadb-devel-5.5.64-1.el7.x86_64 already installed and latest version
    Nothing to do

    2、版本你需要安装哪个版本就下载哪个python3以上就行,推荐3.6.5,linux上下载加上后缀就行了。

      python查看版本地址:https://www.python.org/ftp/python/  小编是用独有的wget下载3.6.5(因为我已经安装了),可能下载时间有点长,当然也可以在本地下载好上传至服务器上,如果喜欢用shell脚本一键安装的朋友还是用wget下载给力:wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz

    [root@iZbp19lugf22zbsubsf1y6Z home]# wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
    --2019-10-27 14:43:39-- https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
    Resolving www.python.org (www.python.org)... 151.101.228.223, 2a04:4e42:36::223
    Connecting to www.python.org (www.python.org)|151.101.228.223|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 22994617 (22M) [application/octet-stream]
    Saving to: ‘Python-3.6.5.tgz’
    
    100%[===================================================================================================================================================================================================>] 22,994,617 13.4KB/s in 29m 59s
    
    2019-10-27 15:13:39 (12.5 KB/s) - ‘Python-3.6.5.tgz’ saved [22994617/22994617]

    3、在此包目录下解压tgz包,输入:tar -xvf Python-3.6.5.tgz

    [root@iZbp19lugf22zbsubsf1y6Z home]# tar -xvf Python-3.6.5.tgz
    
    Python-3.6.5/Lib/test/test_wait3.py
    Python-3.6.5/Lib/test/test_ordered_dict.py
    Python-3.6.5/Lib/test/test_exception_variations.py
    Python-3.6.5/Lib/test/test_argparse.py
    Python-3.6.5/Lib/test/test_multibytecodec.py
    Python-3.6.5/Lib/test/test_strftime.py
    Python-3.6.5/Lib/test/tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt
    Python-3.6.5/Lib/test/test_ipaddress.py
    Python-3.6.5/Lib/test/test_mmap.py
    Python-3.6.5/Lib/test/test_ftplib.py
    Python-3.6.5/Lib/test/test_selectors.py
    Python-3.6.5/Lib/test/test_operator.py
    Python-3.6.5/Lib/test/badsyntax_future10.py
    Python-3.6.5/Lib/test/test_decimal.py
    Python-3.6.5/Lib/test/test_popen.py
    Python-3.6.5/Lib/test/test_genexps.py
    Python-3.6.5/Lib/test/test_stat.py
    Python-3.6.5/Lib/test/datetimetester.py
    Python-3.6.5/Lib/test/test_socketserver.py
    Python-3.6.5/Lib/test/test_codecmaps_hk.py
    Python-3.6.5/Lib/test/curses_tests.py
    Python-3.6.5/Lib/test/test_decorators.py
    Python-3.6.5/Lib/test/test_pyclbr.py
    
    ...

    4、在Python-3.6.5目录下指定安装目录:./configure --prefix=/home/python365

    [root@iZbp19lugf22zbsubsf1y6Z Python-3.6.5]# ./configure --prefix=/home/python365
    
    checking stropts.h usability... no
    checking stropts.h presence... no
    checking for stropts.h... no
    checking termios.h usability... yes
    checking termios.h presence... yes
    checking for termios.h... yes
    checking for unistd.h... (cached) yes
    checking utime.h usability... yes
    checking utime.h presence... yes
    checking for utime.h... yes
    checking poll.h usability... yes
    checking poll.h presence... yes
    checking for poll.h... yes
    checking sys/devpoll.h usability... no
    checking sys/devpoll.h presence... no
    
    ...

    5、在Python-3.6.5目录下编译输入:make    编译时间有点长,等几分钟完成后再安装,输入:make install

    [root@iZbp19lugf22zbsubsf1y6Z Python-3.6.5]# make
    gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I. -I./Include -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
    gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I. -I./Include -DPy_BUILD_CORE -o Parser/parser.o Parser/parser.c
    gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I. -I./Include -DPy_BUILD_CORE -o Parser/bitset.o Parser/bitset.c
    gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I. -I./Include -DPy_BUILD_CORE -o
    
    ...省略

    6、设置python365pip365的软链接,这里因为自带了python2.7已有类同的软链接,我们要另设置为 python365 和 pip365,可以随便命名:

    • ln -s /home/python365/bin/python3.6 /usr/bin/python365
    • ln -s /home/python365/bin/pip3 /usr/bin/pip365
    • 注意:我们上面的指定了安装目录为:/home/python365,然而我们设置软链接也是在/home/python365下面。
    [root@iZbp19lugf22zbsubsf1y6Z bin]# ln -s /home/python365/bin/python3.6 /usr/bin/python365
    [root@iZbp19lugf22zbsubsf1y6Z bin]# ln -s /home/python365/bin/pip3 /usr/bin/pip365
    [root@iZbp19lugf22zbsubsf1y6Z bin]#

    7、验证 python 的版本输入:python365 -V

    [root@iZbp19lugf22zbsubsf1y6Z bin]# python365 -V
    Python 3.6.5
    [root@iZbp19lugf22zbsubsf1y6Z bin]# python
    Python 2.7.5 (default, Jul 13 2018, 13:06:57)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>>

    8、验证 pip365 的版本.

    [root@iZbp19lugf22zbsubsf1y6Z bin]# pip365 -V
    pip 9.0.3 from /home/python365/lib/python3.6/site-packages (python 3.6)

    9、上面看到pip365版本为9.0.3,我们将pip365也升级至最新版输入:pip365 install --upgrade pip

    [root@iZbp19lugf22zbsubsf1y6Z bin]# pip365 install --upgrade pip
    Collecting pip
    Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 44.6MB/s
    Installing collected packages: pip
    Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
    Successfully uninstalled pip-9.0.3
    Successfully installed pip-19.3.1

    10、再来查看一下pip365的版本已为最新版。

    [root@iZbp19lugf22zbsubsf1y6Z bin]# pip365 -V
    pip 19.3.1 from /home/python365/lib/python3.6/site-packages/pip (python 3.6)

    这样就完成了python3的安装了,如遇到有问题欢迎留言交流!!!

    欢迎来QQ交流群:482713805

  • 相关阅读:
    软件工程实践第三次作业——原型设计
    第三次作业补充
    软件工程实践之词频统计
    软工实践第一次作业
    B*树索引结构和内部管理(转)
    MySQL索引背后的数据结构及算法原理(转)
    Java编程军规
    差分隐私学习三:实现机制
    万能头文件#include <bits/stdc++.h>
    微信小程序-flex布局中align-items和align-self区别
  • 原文地址:https://www.cnblogs.com/gsxl/p/11747736.html
Copyright © 2011-2022 走看看