前言

相信不少小伙伴对开源项目 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. Linux线程唤醒与等待

    生产者消费者模式在程序设计中出现频率非常高,经常会有线程间通过消息队列或其他共享变量进行交互的场景.而这时就会出现一个问题,消费者如何知道生产者已经生产了数据呢?有的程序会采取消费者循环判断消息队列大 ...

  2. unzip 命令指定解压路径

    在使用unzip进行文件包解压,可以用来解压zip/jar/war包类型,有时解压时需要解压到指定路径时可以使用参数 -d 来指定,例如: unzip services-bak.jar -d ./we ...

  3. spring后台重定向方式

    1.直接返回值中加重定向:"redirect:要访问的网址"; public String updateOrAddProject() { return "redirect ...

  4. 应用角度看kafka的术语和功能

    kafka的术语(Terminology) Topic 和Consumer Group Topic 每条发布到 Kafka 集群的消息都有一个类别,这个类别被称为 Topic.(物理上不同 Topic ...

  5. JavaScript系列:函数式编程(开篇)

    前言: 上一篇介绍了 函数回调,高阶函数以及函数柯里化等高级函数应用,同时,因为正在学习JavaScript·函数式编程,想整理一下函数式编程中,对于我们日常比较有用的部分. 为什么函数式编程很重要? ...

  6. [LeetCode] 1137. N-th Tribonacci Number

    Description e Tribonacci sequence Tn is defined as follows: T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + ...

  7. Docker5-docker私库的搭建及常用方法-harbor-registry方式

    一.简介 1.官方已经提供registry镜像为什么还需要用harbor 1)registry缺少镜像清理机制,可以push但是不能删除,耗费空间 2)registry缺乏相应的扩展机制 3)harb ...

  8. 【流畅的python】16.1 - 生成器如何进化成协程

    在生成器中加入yield关键字后,生成器调用方可以向生成器传入值,只需要使用.send(...)方法就可以传送数据.发送的数据会成为生成器函数中yield表达式的值.所以生成器可以作为协程使用. 协程 ...

  9. webpack loader实现

    正值前端组件化开发时代,那么必然离不开目前最火的构建工具--webpack(grunt,gulp等暂且不谈).说到这里,刚好有几个问题: 为什么运行打包命令之后,.vue 文件可以转成 .js 文件 ...

  10. 52个有效方法(1) - 了解Objective-C语言的起源

    Objective-C语言使用的是"消息结构"而非"函数调用" "消息结构"和"函数调用"之间的区别 "消息结 ...