pycharm中安装playwright、pytest、yaml、Allure及相关配置

本次配置主要是为了搭建环境,playwright+pytest+yaml+allure,用于做UI测试;

1.首先安装pycharm,并且破解成功;

2.修改pip的配置(目的把下载源设置成国内的)
终端执行命令:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
补充:
- 清华:https://pypi.tuna.tsinghua.edu.cn/simple
- 阿里云:http://mirrors.aliyun.com/pypi/simple/
- 中国科技大学 :https://pypi.mirrors.ustc.edu.cn/simple/
- 豆瓣:http://pypi.douban.com/simple/
查看配置好的源
pip config list -v

或者通过配置项中修改,如图:

pycharm中安装playwright、pytest、yaml、Allure及相关配置_第1张图片

pycharm中安装playwright、pytest、yaml、Allure及相关配置_第2张图片 

pycharm中安装playwright、pytest、yaml、Allure及相关配置_第3张图片

配置成功即可;

3.通过命令安装playwright、pytest、yaml、allure
1)playwright:ui自动化工具
安装命令:
pip install playwright
playwright install
2)pytest:单元测试框架
安装命令:
pip install pytest

3)yaml:一种数据文件,与pytest结合使用作为数据源
安装命令:
pip install pyyaml

4)allure:测试报告的功能,结合pytest
allure的安装分为两块:
第一步:先下载allure程序包(allure-2.20.1.zip,苹果电脑解压:allure-2.21.0.tgz),随便放一个路径,解压后,在环境变量-系统变量PATH中配置/bin目录;
下载地址:https://github.com/allure-framework/allure2/releases
cmd输入 
allure -- version 
能够正常打印说明,第一步操作成功;
第二步:插件安装命令:
pip install allure-pytest
补充:
allure 运行需要依赖jdk,所以jdk需要先安装并且配置好环境变量;

补充:mac中allure配置PATH中配置/bin目录

1.首先查看allure解压后的路径,选中文件夹中的bin文件夹右键,选择拷贝,在终端中粘贴,即得文件夹路径;

pycharm中安装playwright、pytest、yaml、Allure及相关配置_第4张图片

2.打开配置文件;

open -t ~/.bash_profile

3.输入配置PATH信息,并保存关闭文件;

# allure
export PATH=${PATH}:/Users/sanary/Downloads/software/allure-2.21.0/bin 

4.让配置的PATH信息生效

source ~/.bash_profile

5.验证allure是否配置成功

allure --version

你可能感兴趣的:(macos,pytest,python)