# nlpt-ui-autotest **Repository Path**: sunshinlee/nlpt-ui-autotest ## Basic Information - **Project Name**: nlpt-ui-autotest - **Description**: 能力平台系统UI自动化,主要保障公司产品对外演示环境的实时可用,确保系统报错后及有效的反馈处理! - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-01-31 - **Last Updated**: 2024-04-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: autotest ## README # web-UI 自动化测试示例 --- ## 框架设计 - pytest - selenium - POM页面对象模型(Page Object Model) --- ## 目录结构 common ——公共类 Page ——基类 PageElements ——页面元素类 PageObject ——页面对象类 TestCase ——测试用例 conftest.py ——pytest胶水文件 pytest.ini ——pytest配置文件 --- ## 运行 ### 安装依赖 ```shell pip install -r requirements.txt ``` ### 执行主文件 * 在项目根目录执行`run_case.py`文件即可运行项目 # pytest.ini * 用例执行作用范围 - python_files = test_* *_test test* - python_classes = Test* test* - python_functions = test_* test* * 参数 = 运行失败执行次数 详细日志 输出html格式报告 - addopts = --reruns 2 -vvv -s --html=report.html --self-contained-html # allure参数说明 - pytest --alluredir `result-path` - --clean-alluredir 清除历史生成记录 - allure generate `result-path` - -c 生成报告前删除上一次生成的报告 - -o 指定生成的报告目录 - allure open `report-path` - javahome `C:\Program Files\Java\jdk-17` - allure path `C:\Users\Administrator\Desktop\Python37\allure-2.10.0\bin` # pip配置 - pip切换清华源 - python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple ; addopts = --reruns=2 -vvv -s --html=report.html --self-contained-html # driver - https://registry.npmmirror.com/binary.html?path=chromedriver/ - https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.105/win64/chromedriver-win64.zip # 配置 chromedriver 到系统环境变量 path - path C:\Program Files\Google\Chrome\Application - (必配,否则启动 driver service 报错)