首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >《 python自动化框架pytest》

《 python自动化框架pytest》

作者头像
上海-悠悠
发布于 2018-09-29 07:02:31
发布于 2018-09-29 07:02:31
3K0
举报

为什么要学pytest?

首先说下为什么要学pytest,在此之前相信大家已经掌握了python里面的unittest单元测试框架,那再学一个框架肯定是需要学习时间成本的。刚开始我的内心是拒绝的,我想我用unittest也能完成自动化测试,干嘛要去学pytest呢?

最近看到越来越多的招聘要求会pytest框架了,也有小伙伴出去面试说会unittest框架被鄙视的。所以学此框架应该至少有以下2个理由,第一条已经足够:

· 学会了可以装逼

· 可以避免被面试官鄙视

pytest简介

pytest是python的一种单元测试框架,与python自带的unittest测试框架类似,但是比unittest框架使用起来更简洁,效率更高。根据pytest的官方网站介绍,它具有如下特点:

· 非常容易上手,入门简单,文档丰富,文档中有很多实例可以参考

· 能够支持简单的单元测试和复杂的功能测试

· 支持参数化parametrize,比unittest的ddt更简单

· 执行测试过程中可以将某些测试skip跳过,或者对某些预期失败的case标记成失败

· 强大的fixture自定义功能,这个是框架的核心亮点功能

· pytest-rerunfailures(失败case重复执行)

· pytest-html(完美html测试报告生成,失败截图展示)

· allure2漂亮的html报告展示

· 方便的和jenkins持续集成工具集成

· 支持运行由nose, unittest, doctest框架编写的测试case

· 可以用来做web和app自动化(pytest+selenium/appnium)、接口(pytest+requests)

为什么这么好的框架没多少人用?

最主要原因是会的人少,网上大部分教程都是python的unittest框架,初学者理所当然都是学习unittest框架了,由于网上中文教程(pytest官方文档英文版还是很全的)资料少,现在可能还不是主流框架,过1-2年会的人多了,也就是主流框架了。

可以毫不夸张的说,pytest框架比unittest先进20年,是未来这2年的趋势!

百度阅读购买

《 python自动化框架pytest》本书已经上架百度阅读,搜索方法

  1. 百度搜索:百度阅读
  2. 再搜索:pytest

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2018-09-11,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 从零开始学自动化测试 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
250205记录 如何记R语言笔记
1、Rmd文件:在R语言里面保存。会把.Rmd,.html,figure文件夹一起保存在setwd的位置
Qianhui Cheng
2025/02/05
2280
NOTE
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
用户10672870
2023/07/24
2010
NOTE2023-5-8-1
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
高乐高1
2024/04/15
1540
20231114_Note_Practice
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
用户10840800
2023/11/14
1800
准备工作
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
Miss_林炎
2023/04/11
3590
准备工作
第二课
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
小王同学@生信
2023/04/06
3690
第二课
R1基础
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
用户10556374
2023/05/09
3130
note
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
AshtonWang
2023/01/02
3190
Jely's Note之生信入门class1
很容易上手,我是自己准备学c语言、Java,但是我对计算机语言都没有基础。我对代码非常感兴趣,第一节课学的都基础,非常容易吸收!
用户10556369
2023/05/08
6620
Jely's Note之生信入门class1
practice-iris-0128
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
用户10947578
2024/01/28
1380
R4R语言作图
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
用户10556374
2023/05/17
8350
71-R分享01-Rmd新手入门指南
参见:https://www.math.pku.edu.cn/teachers/lidf/docs/Rbook/html/_Rbook/rmarkdown.html[1]
北野茶缸子
2021/12/17
8.2K0
71-R分享01-Rmd新手入门指南
R Markdown笔记-33-20240514
代码块部分,在R语言使用快捷键command+option+i,平常写就是英文输入法模式下的3个点`
迟到小王
2024/05/14
1720
生信基础R(1)
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
小小趴菜
2023/05/09
6120
merge 合并问题
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
用户10989719
2024/03/08
3310
R-learn)Day1+Day2
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
用户11184134
2024/06/28
2790
第五课 文件读写
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
小王同学@生信
2023/04/12
2590
第五课 文件读写
R2向量
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
用户10556374
2023/05/10
1.6K0
R沟通|Rmarkdown教程(3)
具体细节可参考:https://bookdown.org/yihui/rmarkdown-cookbook/update-date.html
庄闪闪
2021/04/08
3.7K0
R3数据结构和文件读取
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
用户10556374
2023/05/15
3.3K0
相关推荐
250205记录 如何记R语言笔记
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档