react脚手架有哪些_vue脚手架3搭建项目

react脚手架有哪些_vue脚手架3搭建项目前言如何快速搭建一个httprunner项目呢?我们可以使用脚手架,脚手架就是自动地创建一些目录,形成一个项目的架构,不需要我们再手动的去创建查看创建新项目的命令先来查看一下帮助命令httpr

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

前言

如何快速搭建一个httprunner项目呢?我们可以使用脚手架,脚手架就是自动地创建一些目录,形成一个项目的架构,不需要我们再手动的去创建
 

查看创建新项目的命令

先来查看一下帮助命令

httprunner startproject -h
(httprunner_env) ➜  hrun httprunner startproject -h
usage: httprunner startproject [-h] [project_name]

positional arguments:
  project_name  Specify new project name.

optional arguments:
  -h, --help    show this help message and exit

可以看出,唯一需要指定的就是项目名称。
 

创建新项目

首先在用户目录创建一个hrun文件夹,进入文件夹创建一个名为hrun_demo的新项目

httprunner startproject hrun_demo
(httprunner_env) ➜  ~ mkdir hrun      
(httprunner_env) ➜  ~ cd hrun
(httprunner_env) ➜  hrun httprunner startproject hrun_demo
2021-02-03 11:23:58.081 | INFO     | httprunner.scaffold:create_scaffold:43 - Create new project: hrun_demo
Project Root Dir: /Users/jkc/hrun/hrun_demo

created folder: hrun_demo
created folder: hrun_demo/har
created folder: hrun_demo/testcases
created folder: hrun_demo/reports
created file: hrun_demo/testcases/demo_testcase_request.yml
created file: hrun_demo/testcases/demo_testcase_ref.yml
created file: hrun_demo/debugtalk.py
created file: hrun_demo/.env
created file: hrun_demo/.gitignore

$ tree hrun_demo -a
hrun_demo
├── .env
├── .gitignore
├── debugtalk.py
├── har
├── reports
└── testcases
    ├── demo_testcase_ref.yml
    └── demo_testcase_request.yml

3 directories, 5 files

Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

如果你指定的项目名已存在,会有如下警告:

(httprunner_env) ➜  hrun httprunner startproject hrun_demo
2021-02-03 11:27:16.028 | WARNING  | httprunner.scaffold:create_scaffold:33 - Project folder hrun_demo exists, please specify a new project name.

$ tree hrun_demo -a
hrun_demo
├── .env
├── .gitignore
├── debugtalk.py
├── har
├── reports
└── testcases
    ├── demo_testcase_ref.yml
    └── demo_testcase_request.yml

3 directories, 5 files

Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

 

项目结构

创建完成项目后,查看项目结构有哪些目录?
react脚手架有哪些_vue脚手架3搭建项目

  • har:可以存放录制导出的.har文件
  • reports:存储 HTML 测试报告
  • testcases:存放测试用例
  • .env:放置在项目根目录下,存放环境变量
  • debugtalk.py:放置在项目根目录下(借鉴了pytest的conftest文件的设计),用于写一些公共函数和方法
     

运行用例

创建的新项目中,默认有2个yaml文件形式的用例(demo_testcase_ref.ymldemo_testcase_request.yml),我们运行看看

hrun hrun_demo

运行结果:

(httprunner_env) ➜  hrun hrun hrun_demo
2021-02-03 13:33:58.336 | INFO     | httprunner.make:__make:512 - make path: /Users/jkc/hrun/hrun_demo
2021-02-03 13:33:58.342 | INFO     | httprunner.compat:ensure_testcase_v3:219 - ensure compatibility with testcase format v2
2021-02-03 13:33:58.345 | INFO     | httprunner.loader:load_dot_env_file:127 - Loading environment variables from /Users/jkc/hrun/hrun_demo/.env
2021-02-03 13:33:58.345 | DEBUG    | httprunner.utils:set_os_environ:33 - Set OS environment variable: USERNAME
2021-02-03 13:33:58.345 | DEBUG    | httprunner.utils:set_os_environ:33 - Set OS environment variable: PASSWORD
2021-02-03 13:33:58.347 | INFO     | httprunner.make:make_testcase:349 - start to make testcase: /Users/jkc/hrun/hrun_demo/testcases/demo_testcase_ref.yml
2021-02-03 13:33:58.364 | INFO     | httprunner.compat:ensure_testcase_v3:219 - ensure compatibility with testcase format v2
2021-02-03 13:33:58.365 | INFO     | httprunner.make:make_testcase:349 - start to make testcase: /Users/jkc/hrun/hrun_demo/testcases/demo_testcase_request.yml
2021-02-03 13:33:58.365 | INFO     | httprunner.make:make_testcase:442 - generated testcase: /Users/jkc/hrun/hrun_demo/testcases/demo_testcase_request_test.py
2021-02-03 13:33:58.366 | INFO     | httprunner.make:make_testcase:442 - generated testcase: /Users/jkc/hrun/hrun_demo/testcases/demo_testcase_ref_test.py
2021-02-03 13:33:58.377 | INFO     | httprunner.compat:ensure_testcase_v3:219 - ensure compatibility with testcase format v2
2021-02-03 13:33:58.378 | INFO     | httprunner.make:make_testcase:349 - start to make testcase: /Users/jkc/hrun/hrun_demo/testcases/demo_testcase_request.yml
2021-02-03 13:33:58.378 | INFO     | httprunner.make:format_pytest_with_black:170 - format pytest cases with black ...
reformatted /Users/jkc/hrun/hrun_demo/testcases/demo_testcase_ref_test.py
reformatted /Users/jkc/hrun/hrun_demo/testcases/demo_testcase_request_test.py
All done! ✨ ? ✨
2 files reformatted.
2021-02-03 13:33:58.658 | INFO     | httprunner.cli:main_run:56 - start to run tests with pytest. HttpRunner version: 3.1.4
================================================================================================= test session starts ==================================================================================================
platform darwin -- Python 3.7.6, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
rootdir: /Users/jkc/hrun
plugins: metadata-1.11.0, html-2.1.1
collected 2 items                                                                                                                                                                                                      

hrun_demo/testcases/demo_testcase_request_test.py .                                                                                                                                                              [ 50%]
hrun_demo/testcases/demo_testcase_ref_test.py .                                                                                                                                                                  [100%]

================================================================================================== 2 passed in 4.87s ===================================================================================================

我们再次查看项目结果会发现根目录下多出了logs日志文件夹,testcases中多出了2个py文件
这里应该是作者源码中运行后写的代码结果了
react脚手架有哪些_vue脚手架3搭建项目


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/166289.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • PHP开发api接口安全验证

    PHP开发api接口安全验证

    2021年10月13日
    39
  • mysql数据库面试题目及答案_数据库面试题2021

    mysql数据库面试题目及答案_数据库面试题2021MySQL数据库面试题(2022版)文章目录一、基础基本概念MySQL有哪些数据库类型?CHAR和VARCHAR区别?数据库设计什么是三大范式?什么是范式和反范式,以及各自优缺点?二、索引索引的几种类型或分类?索引的优缺点?索引设计原则?索引的数据结构?Hash和B+树索引的区别?为何使用B+树而非B树做索引?什么是最左匹配原则?什么是覆盖索引?什么是索引下推?三、存储存储引擎有哪些常见的存储引擎?MyISAM和InnoDB的区别?InnoDB的四大特性?InnoDB为.

    2022年10月8日
    3
  • 为什么说Python 是大数据全栈式开发语言

    为什么说Python 是大数据全栈式开发语言欢迎大家访问我的个人网站《刘江的博客和教程》:"www.liujiangblog.com"主要分享Python及Django教程以及相关的博客原文链接http://www

    2022年7月5日
    26
  • vm安装ubuntu时一直没反应_虚拟机安装ubuntu系统要多久

    vm安装ubuntu时一直没反应_虚拟机安装ubuntu系统要多久这**加粗样式**里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML图表FLowchart流程图导出与导入导出导入欢迎使用Markdown编辑器你好!这是你第一次使用Markdown编辑器所展示的欢迎页。如果你想学

    2022年9月30日
    3
  • 安装vmware虚拟机步骤_如何安装vmware虚拟机

    安装vmware虚拟机步骤_如何安装vmware虚拟机一、基础介绍VMWare虚拟机软件是一个“虚拟PC”软件,它使你可以在一台机器上同时运行二个或更多Windows、DOS、LINUX系统。与“多启动”系统相比,VMWare采用了完全不同的概念。多启

    2022年8月2日
    9
  • mysql usegeneratedkeys_Mybatis Generator insert useGeneratedKeys keyProperty[通俗易懂]

    mysql usegeneratedkeys_Mybatis Generator insert useGeneratedKeys keyProperty[通俗易懂]Mybatis自动生成代码,需要用到mybatisGenerator,详见http://mybatis.github.io/generator/configreference/generatedKey.htmlinsert语句如果要返回自动生成的key值,一般会在insert里加入useGeneratedKeys属性,例如insertintosubtasks(SID,TID,RID,S…

    2022年6月26日
    38

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号