AppiumLich
基于 Appium
, python3
, Allure
.测试 case 清晰明了,定位元素基于 pageobject
的模式,并自动生成 pageobject
的相关代码,封装Appium API
提供更加实用强大的 API.
源码地址: https://github.com/mio4kon/appium-lich
运行效果: http://mio4kon.qiniudn.com/case-2.gif
brew install python3
pip3 install <package>
npm install -g appium
npm install -g appium-doctor
appium-doctor
to ensure your system is set up properly
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
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:
cd project_path
python3 watch_dog.py
打开 project_path/data/pages.yaml
,以下面模板定位元素:
---
LoginPage:
dec: 登录页面
locators:
-
name: 注册
timeOutInSeconds: 20
type: name
value: 注册
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('欢迎回来')