自动化工具 ATP - UI 自动化测试用例管理平台

· 2018年06月15日 · 最后由 tangoliver 回复于 2021年02月26日 · 2172 次阅读

将 UI 自动化测试平台化是我很久以前就有的想法,但是个人比较懒,从来没有好好的静下来想要怎么样去做而且想到前端后端什么的都需要自己写,然后就一直不了了之,偶然在某个交流群中看见某位同行截图自己的平台作品提问,就私底下聊了一下,也提供了一下自己的意见和建议,恰好当时项目有个大版本,前期时间比较空闲,就自己瞎折腾了这个东东。
用到的工具:python3 + django2 + mysql + RabbitMQ + celery + selenium

平台功能介绍:

  1. 项目管理:用于管理项目。每个项目可以设置多个环境,例如开发环境,测试环境,预发布环境,生产环境等。

  2. 页面管理:主要用来方便对元素进行管理

  3. 元素管理:在这里实现元素分层,使用一个模块对元素的统一管理

  4. 关键字库:关键字驱动,支持将步骤设置成独立的关键字,遇到无法通过工具设置的步骤可以在后台写成方法再添加成关键字。


  5. 测试用例:一条用例可以添加多条测试数据,同时支持前置登陆操作,能根据所选择的项目环境找到配置执行登陆操作



  6. 登陆配置:将登陆封装成,供测试用例编写时使用。

  7. 测试任务:相当于测试用例集,多线程异步执行,支持定时执行,支持浏览器兼容性测试,执行会遍历浏览器/环境/测试用例/测试数据

  8. 测试结果:测试结果查阅

  9. 源码:https://pan.baidu.com/s/11wannCOAaSKa1loOIe_f7w

交流 Q 群:726249053

共收到 34 条回复 时间 点赞

开源么楼主

#2 · 2018年06月19日 Author
End 回复

思路可以交流,代码写的渣。不好意思搬上来。

#3 · 2018年06月27日 Author
End 回复

已开源、

没有 sql 文件么

我觉得你超级牛🐮了

#6 · 2018年07月03日 Author
Look毛青 回复

能生成数据表。有疑问百度下 django

#7 · 2018年07月03日 Author

谢谢夸奖,但个人对这个项目还不满意。

仅楼主可见
回复

我也想做一个这样的平台展示数据,可能就是前端不太熟吧😄,有点心有余而力不足的感觉,楼主你说学点基础就能搞成这样,很不错了~

这个平台应该对于移动端 UI 自动化的管理也适用吧

#11 · 2018年07月06日 Author
枫叶 回复

思路可以通,但是无法异步多线程跑。

#12 · 2018年07月06日 Author

看看 JS 和 AJAX,然后找的模版自己修改一下。很快上手的。

非常感谢楼主的开源,正好目前准备进入 web 自动化的工作,可能会拿你的项目来参考使用了。

请问有没有相关的部署说明文档?

请问作者开源的地址是? 借鉴一下

请问作者开源的地址是? 借鉴一下

徐汪成 回复

请问开源的代码在哪呢

gaomeijun 回复

你问我 我问谁》?

楼主,求开源的地址=。=

回复

谢谢大佬!最近在做这个的学习,十分感谢!

给大佬点个赞!拿来学习下

感谢大佬,能提供下关键字的 sql 吗?

#24 · 2019年08月27日 Author
lys411 回复

INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (1, 0, '点击', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'click', '[{"type":"element","key":"element"}]', null, '2018-05-08 07:09:56.830000', '点击');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (2, 0, '输入', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'send_keys', '[{"type":"element","key":"element"},{"type":"string","key":"value"}]', null, '2018-05-08 07:09:59.455000', '输入');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (3, 0, '打开网址', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'open_url', '[{"type":"string","key":"url"}]', null, '2018-05-08 07:10:00.616000', '打开网址');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (4, 0, '清空输入', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'clear', '[{"type":"element","key":"element"}]', null, '2018-05-08 07:10:01.424000', '清空输入');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (5, 0, '最大化浏览器', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'max_size', null, null, '2018-05-08 07:10:02.146000', '最大化浏览器');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (6, 0, '确认弹窗', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'alert_accept', null, null, '2018-05-08 07:10:02.776000', '确认弹窗');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (7, 0, '取消弹窗', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'alert_dismiss', null, null, '2018-05-08 07:10:03.365000', '取消弹窗');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (8, 0, '切换 tab 窗口', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'switch_to_window', '[{"type":"string","key":"title"}]', null, '2018-05-08 07:10:04.036000', '切换 tab 窗口');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (9, 0, '切换嵌套', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'switch_to_frame', '[{"type":"element","key":"frame"}]', null, '2018-05-08 07:10:04.746000', '切换嵌套');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (10, 0, '浏览器前进', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'forward', null, null, '2018-05-08 07:10:05.370000', '浏览器前进');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (11, 0, '浏览器返回', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'back', null, null, '2018-05-08 07:10:06.012000', '浏览器返回');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (12, 0, '浏览器刷新', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'refresh', null, null, '2018-05-08 07:10:06.630000', '浏览器刷新');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (13, 0, '关闭页面', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'close', null, null, '2018-05-08 07:10:07.282000', '关闭页面');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (14, 0, '退出浏览器', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'quit', null, null, '2018-05-08 07:10:08.361000', '退出浏览器');
INSERT INTO miduotester.keyword (id, projectId, name, type, package, clazz, method, params, steps, createTime, remark) VALUES (15, 0, '选择下拉框', 1, 'MiDuoTester.PageObject.Base', 'PageObject', 'select_by_text', '[{"type": "element", "key": "下拉框"}, {"type": "string", "key": "文本"}]', '[]', '2018-05-08 07:10:09.214000', '选择下拉框');

HI,可以简单介绍一下怎么部署吗

#26 · 2019年09月20日 Author

准备重构了,有新的动向会再发帖。也可以加下 Q 群(726249053)一起交流。

少年 POM - Web UI 自动化测试平台 中提及了此贴 10月15日 17:47

请问为啥部署后运行报这个错误啊
Traceback (most recent call last):
File "D:/a-autotest/MiDuoTester/MiDuoTester/manage.py", line 16, in
execute_from_command_line(sys.argv)
File "D:\python3\lib\site-packages\django\core\management_init.py", line 381, in execute_from_command_line
utility.execute()
File "D:\python3\lib\site-packages\django\core\management__init
.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\python3\lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "D:\python3\lib\site-packages\django\db\utils.py", line 219, in close_all
for alias in self:
File "D:\python3\lib\site-packages\django\db\utils.py", line 213, in __iter
_
return iter(self.databases)
File "D:\python3\lib\site-packages\django\utils\functional.py", line 80, in get
res = instance.dict[self.name] = self.func(instance)
File "D:\python3\lib\site-packages\django\db\utils.py", line 147, in databases
self.databases = settings.DATABASES
File "D:\python3\lib\site-packages\django\conf__init
.py", line 79, in __getattr_
self.setup(name)
File "D:\python3\lib\site-packages\django\conf__init
.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "D:\python3\lib\site-packages\django\conf__init
.py", line 157, in __init_
mod = importlib.import_module(self.SETTINGS_MODULE)
File "D:\python3\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 953, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'MiDuoTester.MiDuoTester'

29楼 已删除

githu 提交上去 star 一波。。。。谢谢

乐乐 回复

你需要重新构建一下数据库

楼主,浏览器驱动怎么添加的?直接写入数据库吗?brower 的 sql 能否提供下

楼主有详细教程吗?用例一直执行不了,运行用例报错;
Traceback (most recent call last):
File "D:\ProgramFiles\Python385\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "D:\ProgramFiles\Python385\lib\site-packages\django\core\handlers\base.py", line 126, in get_response
response = self.process_exception_by_middleware(e, request)
File "D:\ProgramFiles\Python385\lib\site-packages\django\core\handlers\base.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "d:\projectSpace\Autotest_platform\Autotest_platform\helper\Http.py", line 52, in request
return fn(*args, **kwargs)
File "d:\projectSpace\Autotest_platform\Product\views.py", line 942, in test
SplitTask.delay(r.id)
File "D:\ProgramFiles\Python385\lib\site-packages\celery\app\task.py", line 461, in delay
return self.apply_async(args, kwargs)
File "D:\ProgramFiles\Python385\lib\site-packages\celery\app\task.py", line 570, in apply_async
return app.send_task(
File "D:\ProgramFiles\Python385\lib\site-packages\celery\app\base.py", line 350, in send_task
task_id = P.publish_task(
File "D:\ProgramFiles\Python385\lib\site-packages\celery\app\amqp.py", line 300, in publish_task
self.publish(
File "D:\ProgramFiles\Python385\lib\site-packages\kombu\messaging.py", line 170, in publish
return publish(body, priority, content_type,
File "D:\ProgramFiles\Python385\lib\site-packages\kombu\connection.py", line 466, in _ensured
self.ensure_connection(errback,
File "D:\ProgramFiles\Python385\lib\site-packages\kombu\connection.py", line 380, in ensure_connection
retry_over_time(self.connect, self.recoverable_connection_errors,
File "D:\ProgramFiles\Python385\lib\site-packages\kombu\utils__init
.py", line 246, in retry_over_time
return fun(args, **kwargs)
File "D:\ProgramFiles\Python385\lib\site-packages\kombu\connection.py", line 250, in connect
return self.connection
File "D:\ProgramFiles\Python385\lib\site-packages\kombu\connection.py", line 756, in connection
self._connection = self._establish_connection()
File "D:\ProgramFiles\Python385\lib\site-packages\kombu\connection.py", line 711, in _establish_connection
conn = self.transport.establish_connection()
File "D:\ProgramFiles\Python385\lib\site-packages\kombu\transport\pyamqp.py", line 116, in establish_connection
conn = self.Connection(
*opts)
File "D:\ProgramFiles\Python385\lib\site-packages\amqp\connection.py", line 165, in __init
_
self.transport = self.Transport(host, connect_timeout, ssl)
File "D:\ProgramFiles\Python385\lib\site-packages\amqp\connection.py", line 186, in Transport
return create_transport(host, connect_timeout, ssl)
File "D:\ProgramFiles\Python385\lib\site-packages\amqp\transport.py", line 299, in create_transport
return TCPTransport(host, connect_timeout)
File "D:\ProgramFiles\Python385\lib\site-packages\amqp\transport.py", line 95, in init
raise socket.error(last_err)
OSError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

tangoliver 回复

我也是出现这个

测试小孟 回复

你解决了吗?

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册