|
本帖最后由 巴黎的灯光下 于 2017-6-30 14:39 编辑
简介
AppiumLich 基于 Appium, python3, Allure.测试case清晰明了,定位元素基于 pageobject的模式,并自动生成 pageobject的相关代码,封装Appium API提供更加实用强大的API.
Link
下面附上几篇学习的系统教程,非常适合新手入门.最后两篇是基于AppiumLich框架的实践.
移动端自动化测试系列之一——Appium环境搭建:http://bbs.51testing.com/thread-1132119-1-1.html
移动端自动化测试系列之二——pytest入门详解:http://bbs.51testing.com/thread-1132120-1-1.html
移动端自动化测试系列之三——Allure测试报告:http://bbs.51testing.com/thread-1132122-1-1.html
移动端自动化测试系列之四——生成定位元素:http://bbs.51testing.com/thread-1132123-1-1.html
移动端自动化测试系列之五——AppiumLich框架使用:http://bbs.51testing.com/thread-1132125-1-1.html
环境要求
Python3:
Python3 Package
.Appium-Python-Client
.Jinja2
.PyYAML
.pytest
.pytest-allure-adaptor
.watchdog
.termcolor (not needed)
Appium
- npm install -g appium
- npm install -g appium-doctor
复制代码- appium-doctor to ensure your system is set up properly
复制代码
Allure-Commandline
Allure Framework is a flexible lightweight multi-language test report tool with the possibility to add screenshots, logs and so on. It provides modular architecture and neat web reports with the ability to store attachments, steps, parameters and many more.
brew tap qatools/formulas
brew install allure-commandline
Run Test
start appium service:
- appium --address 127.0.0.1 --port 4723 --log "log_path" --log-timestamp --local-timezone --session-override
复制代码 run test,
- cd project_path
- python3 run.py
复制代码 Html-Report will be generate on project_path/report/html/index.html
report shot:
Write Test Case
开启watchdog
- cd project_path
- python3 watch_dog.py
复制代码- 打开 project_path/data/pages.yaml,以下面模板定位元素:
复制代码- ---
- LoginPage:
- dec: 登录页面
- locators:
- -
- name: 注册
- timeOutInSeconds: 20
- type: name
- value: 注册
复制代码
写测试case
- class TestLogin:
- def test_login(self, action: ElementActions):
- L.d('test_login')
- account = Steps.get_account()
- action.click(HomePage.登录入口)
- action.text(LoginPage.账户, account[0])
- action.text(LoginPage.密码, account[1])
- action.sleep(1)
- action.click(LoginPage.登录)
- assert action.is_toast_show('欢迎回来')
复制代码
TODO
兼容iOS
集成 stf
|
评分
-
查看全部评分
|