pytest

PyTest doesn't run any test

心已入冬 提交于 2020-08-22 04:53:25
问题 PyTest doesn't run any tests and it is not clear why. I tried to use --debug but didn't get any valuable information. It is completely not clear how to debug this sort of issues with pytest (looks like some issue with PyTest configuration / env variables / test names patterns?) Example of test file: $ cat test_sanity.py import pytest @pytest.mark.sanity def test_me(): """ I'm a test. """ assert True But PyTest doesn't run any test: $ pytest ==================================================

PyTest doesn't run any test

喜欢而已 提交于 2020-08-22 04:52:51
问题 PyTest doesn't run any tests and it is not clear why. I tried to use --debug but didn't get any valuable information. It is completely not clear how to debug this sort of issues with pytest (looks like some issue with PyTest configuration / env variables / test names patterns?) Example of test file: $ cat test_sanity.py import pytest @pytest.mark.sanity def test_me(): """ I'm a test. """ assert True But PyTest doesn't run any test: $ pytest ==================================================

pytest+yaml+allure接口自动化测试框架

允我心安 提交于 2020-08-20 08:07:42
前言 趁着这个周末闲来无事,简单的开发了一个接口自动化测试框架。 由于我本人也是接口自动化测试的新手,如有不合理或是不正确的地方请多多指教。 流程说明图 这张图是我的一些设计思路。 在yaml文件中管理相关的数据即可实现接口测试。 采用的接口是 智学网 网站的API。 支持 token 认证 框架体系介绍 目录/文件 说明 是否为 python 包 apiData 存放测试信息和用例的 yaml 文件目录 config 配置目录,目录配置,allure环境变量配置 是 common 公共类,封装读取 yaml 文件 是 core 基类包,封装 requests 等常用方法 是 logs 日志文件 tests 测试用例 是 utils 工具类,日志等 是 pytest.ini pytest配置文件 run.bat 执行脚本 配置用例信息 经过excel和yaml的对比,最终我选择了yaml文件管理用例信息。 BusinessInterface.yaml 业务接口测试 登录验证: method: post route: /loginSuccess/ RequestData: data: userId: "{{data}}" expectcode: 200 regularcheck: resultcheck: '"result":"success"' stand_alone

appium+pytest+allure+jenkins 如何实现多台手机连接

别说谁变了你拦得住时间么 提交于 2020-08-20 08:04:17
使用appium可以实现app自动化测试,我们之前是连接一台手机去运行,如何同时连接多台手机呢?很多人可能想到的是多线程(threading)。今天分享一种比多线程更简单的方法,虽然不是多台手机同时运行,但可以连接多台手机依次运行,大致的运行方式是:001号测试用例:A手机,B手机...,002号测试用例:A手机,B手机... 环境准备 appium的安装 :adt,nodejs,appium的python库,appium server pytest的安装 :pytest allure的安装 :allure的python库pytest-allure-adaptor jenkins上插件的安装- 传送门 jenkins的安装 :windows上的安装- 传送门 手机/模拟器 :华为荣耀畅玩5C,夜神模拟器 框架改造 1. 配置改写 以上课所写的前程贷的自动化框架为主,框架的分层如下(框架分享 - 传送门:提取码: zvry ): 在上述框架中,我们的配置信息存在Caps目录下的Caps.yaml中,譬如这样 - platformName: Android platformVersion: 5.1.1 deviceName: JTG6T16307007427 appPackage: com.xxzb.fenwoo appActivity: .activity.addition

pytest+requests+Python3.7+yaml+Allure+Jenkins+docker实现接口自动化测试

强颜欢笑 提交于 2020-08-20 07:52:50
接口自动化测试框架(用例自动生成) 项目说明 本框架是一套基于 pytest+requests+Python3.7+yaml+Allure+Jenkins+docker 而设计的数据驱动接口自动化测试框架, pytest 作为执行器,本框架无需你使用代码编写用例,那你可能会担心万一有接口之间相互依赖,或者说需要登入的token等之类的接口,该如何编写用例呢,在这里告诉你们本框架已经完美解决此问题,所有的一切将在yaml中进行!!本框架实现了在yaml中进行 接口用例编写,接口依赖关联,接口断言,自定义测试用例运行顺序 ,还有很重要的一点,实现了类 jmeter函数助手 的功能,譬如生成MD5、SHA1、随机定长字符串、时间戳等,只需要你在yaml中使用特殊的写法 $Function(arg)$ ,就能够使用这些函数啦,此外在测试执行过程中,还可以 对失败用例进行多次重试 ,其重试次数和重试时间间隔可自定义;而且可以根据实际需要扩展接口协议,目前已支持 http接口和webservice接口 。 技术栈 requests suds-py3 Allure pytest pytest-html yaml logging Jenkins docker 函数助手 环境部署 命令行窗口执行pip install -r requirements.txt 安装工程所依赖的库文件 解压allure