Macaca [基于 Node.js 的自动化测试-Macaca] - 搭建自己的自动化测试平台 [多图]

达峰的夏天 · 2016年03月16日 · 最后由 达峰的夏天 回复于 2019年07月05日 · 2527 次阅读

上一篇 - 配置 Docker 环境

这是 Macaca 的官方 repo alibaba/macaca 欢迎提 issue、star。

Reliable 简介

Reliable 是分布式架构的持续集成系统,由 Macaca 团队的成员开发。适用于集成构建、集成测试等场景。她是典型的主从结构,分为 reliable-masterreliable-slave 两部分。

Reliable 适合对 Node.js 有二次开发能力的用户实践,否则请使用 jenkins。

有以下几个特点:

  • 集群负载,合理调配
  • 提供插件机制,易扩展
  • 部署非常简单
  • 便于接入 Gitlab、Github 等社区化系统

同时,她与 Macaca 无缝融合。

使用 Macaca + Reliable 为自己的团队和公司搭建一个开源的自动化集成平台是个不错的选择。

reliable-1

reliable-2

reliable-3

Master 一键部署

为了更加便捷的安装体验,reliable-master 是使用 Docker 部署。将源码 clone 到服务器或本机,make deploy env=prod 即可,就这么简单。

更详细的配置请见: github/reliable-master/deploy

配置和功能

邮箱

支持简单邮件传输协议,通过配置 smtp 实现通知创建者,订阅者的的邮件推送功能。

多语言

支持多语言,默认为英文,可以通过配置文件将站点设为中文。

添加用户

通过如下命令为站点添加初始化用户或管理员。

$ make adduser

接下来可以用过 8080 端口访问的站点

home

登录已经创建的用户

login

大功告成

Slave 部署

我们使用 zeromq 做消息队列,所以需要先安装 zeromq。

$ brew install pkg-config
$ brew install zeromq

# Then

$ npm install reliable-slave -g

指定已经部署的 Master IP 或 域名即完成部署并挂载:

reliable server -m <reliable-master:port> --verbose

文档详见

多种模式

cloud

  • 单点模式
    • reliable-slave, reliable-master 部署在同一台机器
    • 此模式节省设备,是最省的用法
  • 集群模式
    • reliable-slave 推荐部署在 Windows 系统或 OSX 系统 [推荐 MacMini],reliable-master 部署在专业服务器
  • 众包模式
    • 用户通过使用 reliable-slave 志愿挂载已经部署好的 reliable-master,提供资源

欢迎讨论,互相学习。

微博: http://weibo.com/xudafeng
Github: https://github.com/xudafeng

下一篇 - 使用 Macaca 测试 Android 应用

共收到 26 条回复 时间 点赞

赞,先看看

跟 jenkins 的差别是什么啊

#2 楼 @seveniruby

与 jenkins 的使命的一样的,这里用于与 Macaca 无缝集成。

有特别想使用 jenkins 集成的用户,我也会在后面分享。

界面和 rethinkdb 很像啊,楼主一系列文章还是少一条主线啊,看着有点零散。

#4 楼 @luis 你好,主要是围绕第一篇展开。每篇的主题、主次细节有可能会有一些差异,请见谅

#3 楼 @xdf 既然重做了一个, 应该会有自己的需求点吧. 对比 jenkins, 他的优点在哪?

我的兴趣点也是跟@seveniruby一样。这个既然自己搞一套,那对比 jenkins,差异点在哪?或者对于潜在用户,它的吸引力在哪?

#7 楼 @uncleleung 估计是他们团队在练手, 解决了自己的痛点吧. 整体的竞争力肯定是赶不上 jenkins. 我觉得自己练练手挺好的. 可以增强对架构的理解.

多谢各位前辈的关注,jenkins 是非常优秀的工具,我也在长期使用。

上次在分享会我提到过使用自建CI 的一些原因,后面会分享出来。

提两个问题,1:国内网络环境比较和谐,docker 安装比较坑,能否在有时间的时候补一个比较详细的安装过程?
2.git clone 下源码后,npm install 会报错,npm WARN deprecated native-or-bluebird@1.1.2: 'native-or-bluebird' is deprecated. Please use 'any-promise' instead.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
npm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

#11 楼 @xdf 后续 build 时会出现错误

#11 楼 @xdf SOLINK_MODULE(target) Release/kerberos.node
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/kerberos.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/Cellar/node/5.4.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/yangjing/gitProject/openSource/reliable-master/node_modules/kerberos
gyp ERR! node -v v5.4.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

达峰的夏天 [该话题已被删除] 中提及了此贴 06月27日 11:17
达峰的夏天 [该话题已被删除] 中提及了此贴 06月27日 11:17
达峰的夏天 [该话题已被删除] 中提及了此贴 06月27日 11:17

搭建了 reliable,但是只能在服务器 PC 上访问,在其他 PC 上访问不到,slave 也是,只可以单点模式,所以想放弃 reliable,将 macaca 和 jenkins 集成,希望作者能给个 jenkins 集成的案例,多谢啦

#17 楼 @zwy macaca 可以当成工具直接用,可以参考 ci 配置

https://github.com/macacajs/macaca-test-sample/blob/master/Makefile#L36

#3 楼 @xdf 你好,周末在 TID 大会上听了关于 macaca 的分享,这两天抽时间想搭建一下 reliable+macaca 的环境,目前 reliable-master 已经起来了,reliable-macaca-slave 也可以连上 reliable-master 了,但是后续在 reliable 中新建任务这块目前不知道该怎么操作了,特别是 Android 和 IOS 分别在不同机器上执行的时候,该则么操作。不知道有没有 reliable 的相关操作文档和使用教程可以参考一下。

@julianhuang 287162474 qq 群

你好!reliable-macaca-docker-compose make start 时,遇到这个错误
Pulling slave_1 (reliable-macaca-slave:latest)...
ERROR: Get https://registry-1.docker.io/v2/library/reliable-macaca-slave/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Freliable-macaca-slave%3Apull&service=registry.docker.io: dial tcp: lookup auth.docker.io on 10.0.2.3:53: read udp 10.0.2.15:40034->10.0.2.3:53: i/o timeout

npm install reliable-slave -g 报下面错误也

gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/reliable-macaca-slave/node_modules/zmq
gyp ERR! node -v v6.4.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
/usr/local/lib
└── (empty)

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "reliable-macaca-slave" "-g"
npm ERR! node v6.4.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! zmq@2.13.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zmq@2.13.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the zmq package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs zmq
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls zmq
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/feng/Documents/docker/reliable-macaca-docker-compose/npm-debug.log
npm ERR! code 1

问题麻烦提 issue @fengmiss

这个报告是用的插件吗

你好,请问构建的时候用 jenkins。自动化使用 Reliable 可以吗

求助,pc 桌面版基于 electronjs 的桌面版应用的 UI 页面中,需要使用到鼠标右键的操作,试问鼠标右键的模拟操作 macaca 如何实现呢,api 中未发现,借问求分享哦

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