前言

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

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

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

一、预备工作

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

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

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

  我们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

...省略

[root@iZbp19lugf22zbsubsf1y6Z Python-3.6.5]# make install
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 Objects/listobject.o Objects/listobject.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 Objects/longobject.o Objects/longobject.

...省略

  6.设置python365和pip365的软链接,这里因为自带了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的安装了,如遇到有问题欢迎留言交流!!!

httprunner-1-linux下搭建hrun(上)的更多相关文章

  1. [编译] 7、在Linux下搭建安卓APP的开发烧写环境(makefile版-gradle版)—— 在Linux上用命令行+VIM开发安卓APP

    April 18, 2020 6:54 AM - BEAUTIFULZZZZ 目录 0 前言 1 gradle 安装配置 1.1 卸载系统默认装的gradle 1.2 下载对应版本的二进制文件 1.3 ...

  2. MongoDB学习笔记—Linux下搭建MongoDB环境

    1.MongoDB简单说明 a MongoDB是由C++语言编写的一个基于分布式文件存储的开源数据库系统,它的目的在于为WEB应用提供可扩展的高性能数据存储解决方案. b MongoDB是一个介于关系 ...

  3. Linux下搭建个人网站

    前不久在阿里买了一个服务器,然后开始第一次尝试搭建自己的个人网站.前端采用了bootstrap框架,后端采用的是PHP,数据库使用的是Mysql.新手第一次在linux下搭建遇见很多问题,在这里分享一 ...

  4. Ruby学习心得之 Linux下搭建Ruby环境

    作者:枫雪庭 出处:http://www.cnblogs.com/FengXueTing-px/ 欢迎转载 Ruby学习心得之 Linux下搭建Ruby环境1.前言2.Linux下安装Ruby环境 一 ...

  5. Linux下搭建Lotus Domino集群

    Linux下搭建Lotus Domino 集群 本文内容是Linux平台下Lotus Domino服务器部署案例(http://chenguang.blog.51cto.com/350944/1334 ...

  6. Linux下搭建 Cocos2d-x-2.1.4 编译环境

    [tonyfield 2013.09.04 ] 参考 Linux下搭建 Cocos2d-x-2.1.4 编译环境 导入 HelloCpp 例程 1. Java 入口 HelloCpp.java Hel ...

  7. Linux下搭建tomcat集群全记录(转)

    本文将讲述如何在Linux下搭建tomcat集群,以及搭建过程中可能的遇到的问题和解决方法.为简单起见,本文演示搭建的集群只有两个tomact节点外加一个apache组成,三者将安装在同一机器上:ap ...

  8. [编译] 3、在Linux下搭建51单片机的开发烧写环境(makefile版)

    星期二, 10. 七月 2018 01:01上午 - beautifulzzzz 一.SDCC(Small Device C Compiler)编译环境搭建 SDCC是一个小型设备的C语言编译器,该编 ...

  9. linux下搭建lamp环境以及安装swoole扩展

    linux下搭建lamp环境以及安装swoole扩展   一.CentOS 6.5使用yum快速搭建LAMP环境 准备工作:先更新一下yum源  我安装的环境是:apache2.2.15+mysql5 ...

  10. linux下搭建hexo环境

    最近对搭建个人博客比较感兴趣,但是刚搭建好next主题基本博客,电脑就坏了,借了一台电脑继续搞,不想在他电脑中弄太多环境,所以我准备在自己电脑的服务器上搭建hexo环境 服务器环境: (1)cento ...

随机推荐

  1. PTA A1011&A1012

    A1011 World Cup Betting (20 分) 题目内容 With the 2010 FIFA World Cup running, football fans the world ov ...

  2. LayUI 上传IE11上传格式错误之后, layer.load(1)的动画一直在,没有关闭(仅限IE11)

    这个问题,测试反馈的时候,有丝丝的不相信,毕竟layui大家都是那么用的,结果后来用最简单的测试,发现确实会出现动画一直在的情况,如下: 上网搜索,也没发现一些有效的信息,最后就是自己读upload. ...

  3. redis的安装和pip连接

    一.首先说说我的环境.         操作系统:Ubuntu16.04         能联网(使用了桥接方式)   二.安装redis cd进一个文件夹. 控制台输入     weget http ...

  4. Hadoop-1,web页面调用报无hbase.jar包【以解决】 2,报java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem;【以解决】

    1:web页面调用报无hbase.jar包 本来java文件就没有问题,但是jsp一调用那个java文件里的方法就报错,报的无hadoop/hbase相关报的问题. 主要解决方法是: 复制hbase/ ...

  5. 深入理解perf报告中的swapper进程

    一.前言 1.在perf监控进程的系统调用时,会出现大量swapper进程 2.官方描述该进程是当CPU上没有其他任务运行时,就会执行swapper.换句话说swapper意味着CPU啥事也没干,跑去 ...

  6. 两个变量交换数字 不用第三个变量的情况下 int a = 5,b = 6

    今天可是涨见识额 记录一下 第一种方法: a=a+bb=a-ba=a-b 第二种: b= a+(a=b)*0 一句话搞定

  7. ZooKeeper单机服务端的启动源码阅读

    程序的入口QuorumPeerMain public static void main(String[] args) { // QuorumPeerMain main = new QuorumPeer ...

  8. ibatis 学习

    1.$与#的区别: 用到#和$来获取传的参数值,其中#是将传来的值替换(如果是字符串,会将‘’带着替换,比如上面$value$,用#value#的话,就会出错.#与$的使用区别:$中间的变量就是直接替 ...

  9. Hibernate教程 ---简单易懂

    1 web内容回顾 (1)javaee三层结构 (2)mvc思想 2 hibernate概述 3 hibernate入门案例 4 hibernate配置文件 5 hibernate的api使用 Hib ...

  10. .Net Core自动化部署系列(三):使用GitLab CI/CD 自动部署Api到Docker

    之前写过使用Jenkins实现自动化部署,最近正好没事研究了下GitLab的自动化部署,顺便记录一下. 使用GitLab部署我们需要准备两件事,第一个起码你得有个GitLab,自己搭建或者使用官方的都 ...