pytest1-Installation and Getting Started
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的更多相关文章
- 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 ...
- Create an offline installation of Visual Studio 2017 RC
Create an offline installation of Visual Studio 2017 RC 2016年12月7日 ...
- An error occurred during the installation of assembly 'Microsoft.VC90.CRT……的问题
有一段时间没有用到AnkhSvn了,今天工作需要安装了一下.结果安装到一半就无法继续了,提示An error occurred during the installation of assembly ...
- "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 ...
- pymol installation
# download (1) python wget https://www.python.org/ftp/python/2.7.9/python-2.7.9.amd64.msi (2) pymol ...
- 安卓真机调试 出现Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE....
[2016-08-20 14:38:39 - hybrid-android] Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE[2016-0 ...
- The Installation and Compilation of OpenCASCADE
OpenCASCADE的编译 The Installation and Compilation of OpenCASCADE eryar@163.com 一. 安装OpenCASCADE 可以从Ope ...
- 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 ...
- linuxx virutal machine installation
1. vmplayer download: https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player ...
- 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 ...
随机推荐
- charles 黑名单
本文参考:charles 黑名单 charles 黑名单 功能:阻止对匹配HOST的请求:可以直接把请求丢掉,也可以直接返回403状态码: 我一般用黑名单工具来block一些软件的自动上传功能 黑名单 ...
- Phpstudy被暴存在隐藏后门-检查方法
Phpstudy被暴存在隐藏后门-检查方法 一.事件背景 Phpstudy软件是国内的一款免费的PHP调试环境的程序集成包,通过集成Apache.PHP.MySQL.phpMyAdmin.ZendOp ...
- 【linux】【PostgreSQL】PostgreSQL安装
前言 PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库管理系统.POSTGR ...
- 2018年蓝桥杯java b组第五题
标题:快速排序 以下代码可以从数组a[]中找出第k小的元素. 它使用了类似快速排序中的分治算法,期望时间复杂度是O(N)的. 请仔细阅读分析源码,填写划线部分缺失的内容. 我在使用(a, l, r, ...
- JAVASE知识点总结(三)
第十六章:抽象类和接口 一.抽象方法:在方法面前加了abstract(为了解决,子类必须要覆盖此方法,在定义的时候不要方法体). 特点:1.抽象方法没有方法体. 2.抽象方法必须放在抽象类(类前面加上 ...
- rpm -qa|grep nfs >/dev/null 2>&1作用
在使用一些shell命令是,经常会用到rpm -qa|grep nfs >/dev/null 2>&1之类的命令,该命令干嘛用的呢? 其实这个命令就是将rpm -qa|grep n ...
- Onethink上传服务器后登录不了的问题
本地修改完Onethink后上传到服务器,进入后台登录的时候,发现输入用户名和密码和验证码后,第一次点击登录没反应,第二次点击提示验证码错误. 经过一研究发现 onethink 的登陆是通过API连接 ...
- Vue.js实战学习笔记(中)
1.递归组件给组件设置name属性,组件就可以在它的模板内调用自己,但必须给一个条件来限制递归数量.<div id="app"> <child-component ...
- IDEA 学习笔记之 Console显示日志大小
Console显示日志大小: IntelliJ IDEA默认的Output输出缓存区大小只有1024KB,超过大小限制的就会被清除,而且还会显示[too much output to process] ...
- FFmpeg(二) 解封装相关函数理解
一.解封装基本流程 ①av_register_All()////初始化解封装,注册解析和封装的格式. ②avformat_netword_init()//初始化网络,解析rtsp协议 ③avforma ...