totorojs / totoro Goto Github PK
View Code? Open in Web Editor NEWA simple and stable cross-browser testing tool. 简单稳定的跨浏览器测试工具。
Home Page: http://totorojs.org
A simple and stable cross-browser testing tool. 简单稳定的跨浏览器测试工具。
Home Page: http://totorojs.org
问题:
依赖thrill和queen
解决:
根据原思路重构
关联issue: #23 使用 totoro 测试 arale 基础模块
这是一套和浏览器交互的解决方案,目前所有号称能搞定浏览器兼容性测试和功能测试的都是基于这个东东,阿里系的测试系统也一样。
更多移步 #6
totoro test -b
totoro test --browsers
info: Chrome 25.0.1364 (Windows XP)
info: Chrome 26.0.1410 (Mac OS X)
info: Firefox 18.0.0 (Mac OS X)
info: Firefox 19.0.0 (Windows 7)
info: IE 6.0.0 (Windows XP)
info: IE 7.0.0 (Windows XP)
info: IE 8.0.0 (Windows 7)
info: IE 9.0.0 (Windows 7)
info: Opera 12.14.0 (Windows XP)
info: Safari 5.1.7 (Windows 7)
暂定申请2台服务器
需满足如下条件:
如果有多个同样的浏览器可用,则只选择负载最小的一个发送任务
比较 iframe 和 new window 模式,两者的测试效率和稳定性
将前端测试系统的方案做个总结,做成 PPT
然后订个会议室讨论下
除了我们自己:
totoro-test --list
相关代码: static/constractor.html
window.report = function(data){
52 console.info('report---', data.action)
53 reports.push(data)
54
55 if(data.action === 'end'){
56 var orderId = data.orderId
57 console.log('finish order: ' + orderId)
58 //setTimeout(function() {
59 removeOrder(orderId)
60 //}, 0);
61 }
62 }
如果 remoteOrder 异步执行,就是加上 setTimeout 程序没有问题.
下面是 ie9 下面的打印信息.
考虑过两种方式:
结论:
使用方式2
这个先不提供配置,使用driver的默认配置即可
之前有讨论过用 engines,platform之类,仅参考
这些配置项在spm2中需要重新设置到 totoro 字段中
下面两个地方需要进行过滤:
npm name: totoro
domain name: totorojs.org
来自宫崎骏的动画《龙猫》中的主角名:豆豆龙
当 queen 服务停止时可以给用户进行反馈
中文文档
client driver 相关
grid 相关
待研究的点
问题:目前只要有消息就会发送,测试用例数量较多且测试效率较高时,多个socket同时发送会造成内存溢出。
解决:labor和client都控制发送频率
如题
totoro-test 目前充当了 server 和 client 双重角色。分别通过 --server 和 --client 来启动.默认是 client
totoro-test
--server
--serverHost
--serverPort
totoro-test
--runner
--adapter
--platforms
totoro-test
--list
**注意:**简单起见,文中都给出了推荐端口,如有必要,可自行替换。
1、下载最新的 selenium-server-standalone-{{version}}.jar(本文档使用 2.29.0 版本) 到任意目录,本文档假定该目录为 totoro-server 。
2、在同目录下创建 hub.json 配置文件。
{
"host": "{{grid-hub-host}}",
"port": 4444,
"newSessionWaitTimeout": -1,
"servlets" : [],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 5000,
"cleanUpCycle": 5000,
"timeout": 300000,
"browserTimeout": 0,
"maxSession": 5
}
更多 hub 配置项请参见 Selenium Wiki
3、命令行启动 selenium-grid hub
java -jar selenium-server-standalone-2.29.0.jar -role hub -hubConfig hub.json
1、下载最新的 selenium-server-standalone-{{version}}.jar 到任意目录。如果 node 和 hub 在同一台机器上,则可跳过此步骤。
2、在同目录下创建 node.json:
{
"capabilities": [
{
"browserName": "iexplorer",
"version": "9",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "firefox",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
}
],
"configuration": {
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 5555,
"host": "{{grid-hub-host}}",
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "{{grid-node-host}}"
}
}
你可以修改 capabilities 中的选项以确保符合你的要求。其中:
firefox
外,一般其他浏览器都需要 安装驱动程序,包括 chrome 和 ie。
更多 node 配置项请参见 Selenium Wiki
3、命令行启动 selenium-grid node
java -jar selenium-server-standalone-2.29.0.jar -role node -nodeConfig node.json
打开 {{grid-hub-host}}:4444/grid/console,如果正常的话,应该能看到连接上的 node 的浏览器信息。
1、下载 queen 到任意目录,为方便调试,使用的是源码。如和 hub 是同一台机器,建议下载到同一目录。
2、安装依赖。进入 queen/ 目录运行:
npm update
3、修改 queenConfig.js,确保符合你的需求:
module.exports = {
capture:"{{queen-host}}:9000",
populator: {
type: "selenium",
config: {
host: '{{selenium-hub-host}}',
port: 4444
},
clients: [
{ browserName: "iexplorer", version: "6" },
{ browserName: "iexplorer", version: "7" },
{ browserName: "iexplorer", version: "8" },
{ browserName: "iexplorer", version: "9" },
{ browserName: "chrome"},
{ browserName: "firefox"},
{ browserName: "opera"},
{ browserName: "safari"}
]
}
};
注意:
4、 命令行运行:
node ../../bin/queen
如启动成功,则 selenium-grid 会自动打开 url:http://{{queen-host}}:9000/?clientId={{selenium-id}}
注意:此步骤以后会由 totoro 客户端替换掉
1、客户端机器安装 thrill
sudo npm install -g thrill
2、运行测试
thrill -h {{queen-host}}:9200 path/to/runner.html
注意:thrill 运行的位置没有特别的要求,只要 runner 的路径传递正确即可。
{
"serverHost": "xxx",
"serverPort": "xxx"
}
可在全局配置中进行配置
不支持命令行参数配置,仅支持模块调用
new Client({report: fn(labors)})
是否可以不需要为性能测试特意进行编码,仅通过运行单元测试,通过某种方法,判定一个方法的执行效率?
mocha 测试框架中有整体测试慢的时间测试,但对于单个方法是否可行,需要再考察。
或者可以仅监控整体测试时间,对于耗时超过一定程度的,予以警告。
如一个测试在多个浏览器中运行的时间为:30ms, 35ms, 40ms, 120ms,就认为120ms 是不正常的,需要警告
totoro test --browsers=ie,chrome,firefox
totoro test -b ie/6,ie/7
totoro 将会根据用户的输入匹配相应的浏览器进行测试。
目前还不支持针对某个操作系统的浏览器进行指定。
如题
如题
见2楼
如题,需考虑:
同时需考虑命令行选项:参考 #8
配置文件的规范需要先在小组达成共识
暂不提供配置,也进行探测,只提供 mocha + expect.js + sinon + event-simulate 的组合方案
mocha 使用原文件
其他封装成 cmd 模块,使用时需要 require
否则就需要开发者自己生成 runner
如题
测试前8个浏览器正常,但是返回结果只有6-7个浏览器信息,是否增加一种机制可以确保用户能够得到所有浏览器的结果,比如在返回结果前如果发现缺失,我们可以和之前的对比,重新对剩余的浏览器发起再次请求,或者就是更明确的对用户进行提示?
如题
totoro test --mapping=tests/runner.html,seajs
通过这个配置可以在指定的测试页面中添加 seajs 测试适配器。目前还没有想到更好的方式,暂时先通过这个方式啊。
在 thrill 模块中修改代码增加了下面这个配置:
adaptMapping: ['**.html', 'adapt']
通过这个来对指定页面添加适配器,适配器将会添加到 head 最后面。
see 9af6c94
注意,这个和测试超时没有关系,测试超时是又测试套件本身指定的。客户端到达该时间后,会自动停止测试,以防浏览器卡死等情况出现。
由于在某些测试用例中存在请求 GBK 的资源(如: seajs config tests). 这个时候我们对请求的内容没有进行编码转换就直接缓存了,所以会造成代理的结果不正确。
但是目前获取资源请求的编码暂时没有找到,所以对目前代理的处理方式进行了修改,并且暂时也先不缓存资源了。
totoro-test --adapter=tests/adapter.js
如题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.