pytest是python的一种单元测试框架(非自带,需要安装),与python自带的unitest测试框架相比,使用起来更加简洁、效率更高。总之,一句话,pytest优于unitest。

1.安装pytest  (其中-U 指升级原来已经安装的包)查看安装版本

查看安装版本  pip show pytest 或者 pytest --version

2.使用pytest的一个demo

# test_open_url.py
from selenium import webdriver def test_open_url():
try:
driver = webdriver.Chrome()
driver.get("http://www.baidu.com")
title = driver.title
print(driver.title) assert title == '百度一下,你就知道' # pytest允许使用python的标准assert语句进行断言处理 except AssertionError:
raise AssertionError("断言失败!")
driver.quit() def testbaidu():
driver = webdriver.Chrome()
driver.get("http://www.baidu.com")
title = driver.title
print(title)

方式一:进入命令行模式(Terminal):输入pytest 后回车

方式二:(方法二需要设置pycharm执行器为pytest(该执行器支持unitest的代码)pycharm中如何为项目设置默认执行器?

pytest1-Installation and Getting Started的更多相关文章

  1. mysql-5.6.34 Installation from Source code

    Took me a while to suffer from the first successful souce code installation of mysql-5.6.34. Just pu ...

  2. Create an offline installation of Visual Studio 2017 RC

    Create an offline installation of Visual Studio 2017 RC ‎2016‎年‎12‎月‎7‎日                             ...

  3. An error occurred during the installation of assembly 'Microsoft.VC90.CRT……的问题

    有一段时间没有用到AnkhSvn了,今天工作需要安装了一下.结果安装到一半就无法继续了,提示An error occurred during the installation of assembly ...

  4. "Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated )

    "Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated ...

  5. pymol installation

    # download (1) python wget https://www.python.org/ftp/python/2.7.9/python-2.7.9.amd64.msi (2) pymol ...

  6. 安卓真机调试 出现Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE....

    [2016-08-20 14:38:39 - hybrid-android] Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE[2016-0 ...

  7. The Installation and Compilation of OpenCASCADE

    OpenCASCADE的编译 The Installation and Compilation of OpenCASCADE eryar@163.com 一. 安装OpenCASCADE 可以从Ope ...

  8. kali 2.0 U盘安装错误Your installation cd-rom couldn't be mounted

    1.kali 2.0前天(2015.08.11)发布了.果断下载下来换掉本机的1.0版本. 2.用U盘安装的过程中,出现cd-rom无法挂载.提示错误Your installation CD-ROM ...

  9. linuxx virutal machine installation

    1. vmplayer download: https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player ...

  10. linux apt-get install 错误: Package has no installation candidate

    sudo apt-get install vim 在安装vim时报如下错误: Error accoured: This may mean that the package is missing, ha ...

随机推荐

  1. 多事之秋-最近在阿里云上遇到的问题:负载均衡失灵、服务器 CPU 100%、被 DDoS 攻击

    昨天 22:00~22:30 左右与 23:30~00:30 左右,有1台服役多年的阿里云负载均衡突然失灵,造成通过这台负载均衡访问博客站点的用户遭遇 502, 503, 504 ,由此给您带来麻烦, ...

  2. Python3.7.4入门-3函数

    3 函数 3.1 定义函数 def fib(n): # write Fibonacci series up to n """Print a Fibonacci serie ...

  3. Java匹马行天下之 Java国出了个Java——举国欢庆

    Java帝国的崛起 前言: 看庭前花开花落,宠辱不惊, 望天上云卷云舒,去留无意. 闹心的事儿,选择释怀: 纠缠的人儿,试着放下, 生活其实很美. 心若向阳,就无惧悲伤. 愿你明朗坦荡纵情豁达,有得有 ...

  4. 网关鉴权后下游统一filter获取用户信息

    1. 场景描述 最近有点忙,在弄微服务nacos+springcloud gateway这块工作,以前只是简单应用,这次因为要对接10几个系统或者平台,还的鉴权,等后续稍微闲点了,把这块东西总结下. ...

  5. mysql修改数据库的存储引擎(InnoDB)

    查看当前的存储引擎 show engines; 基本的差别:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持.MyISAM类型的表强调的是性能,其执行数度比InnoDB类型更快,但是不 ...

  6. Android导入Burp Suite证书抓包HTTPS

    需求 Android APP安全测试时,主要工作分为: APK安全 业务安全 APK安全这里不讨论,我说说业务安全,因为大部分的业务校验逻辑还是放在Servier端,这里就会涉及到网络通信了.因此网络 ...

  7. 阿里云服务器CentOS6.9安装jenkins

    jenkins安装 jenkins安装方式好几种,此处介绍基于tomcat安装,比较方便. 首先,通过官网下载jenkins.war文件,下载地址:https://jenkins.io/ 下载完成,将 ...

  8. 第一篇:php开发环境

    Window: 1.XAMPPhttps://www.apachefriends.org/index.html 2.WampServerhttp://www.wampserver.com/ Linux ...

  9. IDEA 学习笔记之 Console显示日志大小

    Console显示日志大小: IntelliJ IDEA默认的Output输出缓存区大小只有1024KB,超过大小限制的就会被清除,而且还会显示[too much output to process] ...

  10. 分库分表(4) ---SpringBoot + ShardingSphere 实现分表

    分库分表(4)--- ShardingSphere实现分表 有关分库分表前面写了三篇博客: 1.分库分表(1) --- 理论 2.分库分表(2) --- ShardingSphere(理论) 3.分库 ...