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 ...
随机推荐
- 弄懂Java为何只有值传递
最近有同学问我关于Java中值传递与引用传递的问题,在此小结一下 值传递是指在函数调用时将实参内容复制一份传递给形参,这样在函数中改变该参数不会对原参数产生影响. 引用传递是指将对象地址的引用传递给该 ...
- <<构建之法第三版>>读书遇到的5个问题
1.书中第4章4.5节所说的结对编程让我感觉有一点困惑,书中书写的是结对编程,说实话我是第一次接触这个词汇,我能感到这种方式的新特之处,但是对比我现实的编程经历,我很难想象在一般的企业开发中这样的行为 ...
- .Net Core中间件和过滤器实现错误日志记录
1.中间件的概念 ASP.NET Core的处理流程是一个管道,中间件是组装到应用程序管道中用来处理请求和响应的组件. 每个中间件可以: 选择是否将请求传递给管道中的下一个组件. 可以在调用管道中的下 ...
- jQuery常用方法(一)-基础
$("p").addClass(css中定义的样式类型); 给某个元素添加样式 $("img").attr({src:"test.jpg", ...
- FTP协议的主动模式和被动模式的区别
最近准备做一个<FtpCopy系列教程>,主要讲解Ftp协议主动模式和被动模式的区别.以及FTP服务器的安装部署,然后通过几个常用实例演示,详细讲解如何使用FtpCopy进行数据自动备份. ...
- 尝鲜 vue3.x 新特性 - CompositionAPI
0. 基础要求 了解常见的 ES6 新特性 ES6 的导入导出语法 解构赋值 箭头函数 etc... 了解 vue 2.x 的基本使用 组件 常用的指令 生命周期函数 computed.watch.r ...
- Openshift yum安装
Openshift yum安装: Yum 安装docker [root@DockerServer openshift]# yum repolist [root@DockerServer openshi ...
- jq方法写选项卡的基本原理以及三种方法
使用jq写选项卡,告别了繁琐的循环以及命名规范 基本原理: 1.当某一个btn被选中时,将这个btn的背景颜色设为橘色,其余兄弟btn背景颜色设为空(none) 2.如果子div与btn的索引相同,就 ...
- Joomla 3.0.0 -3.4.6远程代码执行(RCE)漏洞复现
Joomla 3.0.0 -3.4.6远程代码执行(RCE)漏洞复现 一.漏洞描述 Joomla是一套内容管理系统,是使用PHP语言加上MYSQL数据库所开发的软件系统,最新版本为3.9.12,官网: ...
- 【Tomcat】tomcat7 设置成系统服务启动
1.启动cmd 2.cd C:\Program Files\tomcat7\bin 3.service.bat install 4.打开tomcat7w.exe可以启动管理服务