Giter Club home page Giter Club logo

qt4ademoproj's Introduction

QT4A Demo项目

这是QT4A的Demo使用项目。

安装依赖库

cd /path/to/project
pip install -r requirements.txt

安装被测应用

cd /path/to/project
adb install demo.apk

执行Demo用例

cd /path/to/project
python manage.py runscript demotest/hello.py

qt4ademoproj's People

Contributors

drunkdream avatar hqlian007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

qt4ademoproj's Issues

python manage.py runscript demotest/hello.py

Traceback (most recent call last):
File "manage.py", line 24, in
ManagementTools().run()
File "C:\Users\yostar\PycharmProjects\untitled\venv\lib\site-packages\testbase\management.py", line 626, in run
cmds = self._load_cmds()
File "C:\Users\yostar\PycharmProjects\untitled\venv\lib\site-packages\testbase\management.py", line 579, in _load_cmds
cmds += self._load_cmd_from_module(sys.modules[name])
File "C:\Users\yostar\PycharmProjects\untitled\venv\lib\site-packages\testbase\management.py", line 602, in _load_cmd_from_module
cmds.sort(lambda x, y:cmp_func(x.name, y.name))
TypeError: sort() takes no positional arguments

请问这个问题你们有发现吗 ?

运行webview demo报错

log:

测试用例:WebViewTest 所有者:Administrator 优先级:High 超时:5分钟


步骤1: 1、登录Android demo,进入网页视图
RESOURCE: acquire resource (res_type:android, res_group:None, condition:{}) successfully
172.16.0.227:5555(google Nexus 5 armeabi-v7a Android 6.0.1)
ENVIRONMENT: 申请 Android 设备成功:google Nexus 5(172.16.0.227:5555)
Hello
GetControl
GetControlVisibility
EnableSoftInput
SetControlText
GetControl
GetControlVisibility
EnableSoftInput
SetControlText
GetControl
GetControlVisibility
GetObjectFieldValue
GetControlRect
GetControlRect
Click
INFO: 登录完成
GetControl
GetControlVisibility
GetObjectFieldValue
GetControlRect
GetControlRect
Click

步骤2: 2、检查网页标题
GetControl
EvalScript
CRITICAL: run_test执行失败
Traceback (most recent call last):
File "D:\Python36\lib\site-packages\qt4a\andrcontrols.py", line 1702, in eval_script
return self._driver.eval_script(self.hashcode, frame_xpaths, script)
File "D:\Python36\lib\site-packages\qt4a\androiddriver\androiddriver.py", line 824, in eval_script
result = self.send_command(EnumCommand.CmdEvalScript, Control=control, Script=script, Frame=frame_xpaths)
File "D:\Python36\lib\site-packages\qt4a\androiddriver\androiddriver.py", line 504, in send_command
raise AndroidSpyError(result['Error'])
qt4a.androiddriver.util.AndroidSpyError: java.lang.RuntimeException: java.lang.RuntimeException: Get Field mAwContents Failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Python36\lib\site-packages\testbase\testcase.py", line 701, in _thread_run
getattr(self._testcase, it)()
File "E:/QT4ADemoProj-master/demotest/webview.py", line 35, in run_test
demo_webpage = DemoWebPage(demo_webpanel.Controls["webview"])
File "D:\Python36\lib\site-packages\qt4w\webcontrols.py", line 1058, in init
if wait_for_ready: self.wait_for_ready()
File "D:\Python36\lib\site-packages\qt4w\webcontrols.py", line 1125, in wait_for_ready
if self.ready_state == 'complete': return
File "D:\Python36\lib\site-packages\qt4w\webcontrols.py", line 1100, in ready_state
return self.exec_script('document.readyState')
File "D:\Python36\lib\site-packages\qt4w\util.py", line 144, in wrap_func
ret = func(*args, **kwargs)
File "D:\Python36\lib\site-packages\qt4w\webcontrols.py", line 1147, in exec_script
return self._webdriver.eval_script(self._locator, script)
File "D:\Python36\lib\site-packages\qt4a\androiddriver\webdriver.py", line 2080, in eval_script
raise e
File "D:\Python36\lib\site-packages\qt4a\androiddriver\webdriver.py", line 2065, in eval_script
return super(AndroidWebDriver, self).eval_script(frame_xpaths, script)
File "D:\Python36\lib\site-packages\qt4w\webdriver\webdriver.py", line 412, in eval_script
raise e
File "D:\Python36\lib\site-packages\qt4w\webdriver\webdriver.py", line 395, in eval_script
return self._webview.eval_script(frame_xpaths, script)
File "D:\Python36\lib\site-packages\qt4a\andrcontrols.py", line 1759, in eval_script
return self.webview_impl.eval_script(frame_xpaths, script)
File "D:\Python36\lib\site-packages\qt4a\andrcontrols.py", line 1711, in eval_script
raise JavaScriptError(frame_xpaths, e.args[0])
qt4w.util.JavaScriptError: []java.lang.RuntimeException: java.lang.RuntimeException: Get Field mAwContents Failed

172.16.0.227:5555的截图:E:\QT4ADemoProj-master\demotest\WebViewTest_172.16.0.227_5555_1551148419.4499266.png
CRITICAL: post_test执行失败
Traceback (most recent call last):
File "D:\Python36\lib\site-packages\testbase\testcase.py", line 701, in _thread_run
getattr(self._testcase, it)()
File "E:\QT4ADemoProj-master\demolib\demotestbase.py", line 17, in post_test
super(DemoTestBase, self).post_test()
File "D:\Python36\lib\site-packages\qt4a\androidtestbase.py", line 83, in post_test
self._save_logcat()
File "D:\Python36\lib\site-packages\qt4a\androidtestbase.py", line 250, in _save_logcat
device.adb.save_log(log_path)
File "D:\Python36\lib\site-packages\qt4a\androiddriver\adb.py", line 442, in save_log
f.write('\n'.join(log_list))
UnicodeEncodeError: 'gbk' codec can't encode character '\u0402' in position 88914: illegal multibyte sequence

User-Agent: Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/M4B30X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/72.0.3626.105 Mobile Safari/537.36

找不到控件

============================================================
测试用例:HelloTest 所有者:Administrator 优先级:High 超时:5分钟


步骤1: 1、登录Android demo
RESOURCE: acquire resource (res_type:android, res_group:None, condition:{}) successfully
Coolpad5890-a17c171e(Coolpad 5890 armeabi-v7a Android 4.1.2)
ENVIRONMENT: 申请 Android 设备成功:Coolpad 5890(Coolpad5890-a17c171e)
2020-07-02 01:36:09,655 123145336020992 Take screenshot failed: b"reloc_library[1306]: 20554 cannot locate '_ZN7android21SurfaceComposerClient17getBuiltInDisplayEi'...\nCANNOT LINK EXECUTABLE\n\x00"
2020-07-02 01:36:09,655 123145336020992 pic HelloTest_Coolpad5890-a17c171e_1593624969.5895932.png not exist
CRITICAL: run_test执行失败
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/testbase/testcase.py", line 703, in _thread_run
getattr(self._testcase, it)()
File "/Users/lqc/Working/QT4ADemoProj/demotest/hello.py", line 25, in run_test
app.login(acc, pwd)
File "/Users/lqc/Working/QT4ADemoProj/demolib/demoapp.py", line 36, in login
login_panel.login(acc, pwd)
File "/Users/lqc/Working/QT4ADemoProj/demolib/login.py", line 22, in login
self.wait_for_exist()
File "/usr/local/lib/python3.7/site-packages/qt4a/andrcontrols.py", line 170, in wait_for_exist
raise ControlNotFoundError('窗口:%s 未找到,当前窗口为:%s' % (self.class.Activity, current_activity))
tuia.exceptions.ControlNotFoundError: 窗口:com.qta.qt4a.demo.MainActivity 未找到,当前窗口为:paused=false

INFO: logcat日志
设备:Coolpad5890-a17c171e:/Users/lqc/Working/QT4ADemoProj/demotest/HelloTest_Coolpad5890-a17c171e_1593624969.log
INFO: QT4A日志
qt4a_HelloTest_1593624969.log:/Users/lqc/Working/QT4ADemoProj/demotest/qt4a_HelloTest_1593624969.log
INFO: 释放设备资源
INFO: 释放设备资源

测试用例开始时间: 2020-07-02 01:35:43
测试用例结束时间: 2020-07-02 01:36:09
测试用例执行时间: 00:00:25.89
测试用例步骤结果: 1:失败
测试用例最终结果: 失败

Process finished with exit code 0

不兼容python3,执行demotest/hello.py报编码错误

执行demotest/hello.py报错如下:

2019-01-29 13:26:42,642 7832 thread Thread-2 exit
Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\qt4a\androiddriver\util.py", line 525, in run
    return threading.Thread.run(self)
  File "C:\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python36\lib\site-packages\qt4a\androiddriver\adb.py", line 486, in _logcat_thread_func
    log = self._log_pipe.stdout.readline().decode('utf8').strip()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf4 in position 131: invalid continuation byte

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.