随笔分类 -  测试开发 / hytest

hytest (黑羽test)是白月黑羽自己研发的自动化测试框架,它非常适合做系统测试自动化,而相比之下,pytest、unittest 更适合白盒的单元测试、集成测试
摘要:参考链接:https://www.byhy.net/auto/pyatframework/hytest-01/#jenkins pipeline { agent any stages { stage('Build') { steps { echo 'build release' } } stage( 阅读全文
posted @ 2025-02-02 15:15 lzp123456 阅读(5) 评论(0) 推荐(0)
摘要:日志报告中加入了时间戳 增加了报告中加入图片的功能 可以使用hytest库中的SELENIUM_LOG_SCREEN函数进行截屏操作,第一个参数是driver对象,第二个参数可以指定宽的百分比 如果想在报告中直接插入已经产生的图片可以使用函数LOG_IMG,参数传入url,可以是网络url,也可以是 阅读全文
posted @ 2025-02-02 15:12 lzp123456 阅读(5) 评论(0) 推荐(0)
摘要:点击扩展,搜索hytest安装,安装完成后右下角点击hytest启用插件助手 左侧目录支持: add case file add suite __str__ debug this suite run this suite Python文件中右键支持: add one case add suite_s 阅读全文
posted @ 2025-02-02 14:43 lzp123456 阅读(4) 评论(0) 推荐(0)
摘要:在pycharm的Terminal输入hytest,其实是输入了python -m hytest.run,意思就是执行了hytest包里面的run.py文件 然后再点击debug按钮的时候就可以进行调试了,相当于执行了cd H:\my\autotest后 python.exe -m hytest.r 阅读全文
posted @ 2025-02-02 12:33 lzp123456 阅读(13) 评论(0) 推荐(0)
摘要:根据用例名称挑选执行 hytest --test testA # 执行名为 testA 的用例 hytest --test testA --test testB # 执行名为 testA 和 testB 的用例 hytest --test test* # 执行名字以 test 开头的用例 hytes 阅读全文
posted @ 2025-02-02 12:00 lzp123456 阅读(8) 评论(0) 推荐(0)
摘要:动态产生数据 1 from hytest import * 2 3 4 class UI_000x: 5 ddt_cases = [] 6 for i in range(10): 7 ddt_cases.append({ 8 'name': f'登录 UI_000{i + 1}', 9 'para' 阅读全文
posted @ 2025-02-02 11:11 lzp123456 阅读(6) 评论(0) 推荐(0)
摘要:__str__.py 1 from lib.webui import * 2 3 4 def suite_setup(): 5 open_browser() 6 7 8 def suite_teardown(): 9 wd = GSTORE['wd'] 10 wd.quit() para为字典的管理 阅读全文
posted @ 2025-02-02 10:48 lzp123456 阅读(4) 评论(0) 推荐(0)
摘要:__str__.py: 1 from lib.webui import * 2 3 4 def suite_setup(): 5 open_browser() 6 7 8 def suite_teardown(): 9 wd = GSTORE['wd'] 10 wd.quit() 管理员登录.py: 阅读全文
posted @ 2025-02-02 10:38 lzp123456 阅读(5) 评论(0) 推荐(0)
摘要:初始化__str__.py 1 from lib.webui import * 2 3 4 def suite_setup(): 5 open_browser() 6 7 8 def suite_teardown(): 9 wd = GSTORE['wd'] 10 wd.quit() 管理员登录.p 阅读全文
posted @ 2025-02-02 10:36 lzp123456 阅读(5) 评论(0) 推荐(0)
摘要:用例文件(也就是Python文件)除了支持suite_setup、suite_teardown 对整个套件进行初始化清除,还支持缺省初始化、清除 定义test_setup、test_teardown全局函数 如果文件中的某个用例本身没有初始化方法,执行自动化就会调用test_setup来初始化 如果 阅读全文
posted @ 2025-02-02 09:35 lzp123456 阅读(2) 评论(0) 推荐(0)
摘要:如果一个用例目录下所有Python文件都需要相同的初始化、清除,就需要在该目录下创建一个__str__.py的文件 公共的代码提取到__str__.py文件中,函数名和单个Python文件初始化、清除时一致 __str__.py文件代码如下: 1 from lib.webui import * 2 阅读全文
posted @ 2025-02-02 09:09 lzp123456 阅读(7) 评论(0) 推荐(0)
摘要:一个Python文件的初始化清除 1 from time import sleep 2 from lib.webui import * 3 4 5 def suite_setup(): 6 INFO('suite_setup') 7 open_browser() 8 mgr_login() 9 10 阅读全文
posted @ 2025-02-02 08:54 lzp123456 阅读(11) 评论(0) 推荐(0)
摘要:上述两条用例打开浏览器、登录做了两遍 测试重点并不是登录功能,比较合适的做法是在执行用例前系统应该处于打开浏览器、登录的状态 1 from time import sleep 2 from lib.webui import * 3 4 5 class UI_0101: 6 name = '检查操作菜 阅读全文
posted @ 2025-02-01 23:26 lzp123456 阅读(8) 评论(0) 推荐(0)
摘要:用例代码:登录测试.py 1 from time import sleep 2 from lib.webui import * 3 4 5 class UI_0101: 6 name = '检查操作菜单 UI_0101' 7 8 def teststeps(self): 9 STEP(1, '登录网 阅读全文
posted @ 2025-02-01 22:58 lzp123456 阅读(6) 评论(0) 推荐(0)
摘要:登录被测系统bysms 双击运行runserver.bat 访问页面:http://127.0.0.1/mgr/sign.html 账号:byhy,密码:88888888 可以直接在pycharm的Terminal中运行hytest,不需要打开命令行窗口 浏览器驱动的打印信息: 禁止 chromed 阅读全文
posted @ 2025-02-01 01:25 lzp123456 阅读(5) 评论(0) 推荐(0)
摘要:用例是怎么标识的: 一般用例编号对应类名,用例名称如果没有默认和类名一样。 类中只有要teststeps方法就会被认为是一个用例 用例执行是否pass的判断标准:只要teststeps方法没有异常抛出就认为是pass 只要有一个检查点FAIL,CHECK_POINT函数就会抛出异常,这条用例的结果就 阅读全文
posted @ 2025-02-01 00:28 lzp123456 阅读(116) 评论(0) 推荐(0)
摘要:参考教程:http://vip3.byhy.net/auto/pyatframework/hytest-01/ 安装:pip3 install hytest hytest对应的python版本要求:Python3.6或者更高版本 运行hytest自动化测试: 打开命令行窗口 切换到自动化代码根目录 阅读全文
posted @ 2025-01-31 23:23 lzp123456 阅读(36) 评论(0) 推荐(0)