Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
使用
npm install -g cf-auto
mocdule.exports = {
// 测试脚本所在目录
"auto": "auto",
// 项目在本地运行时所在的目录
"dist": "dist",
// 自动测试运行时的临时目录
"temp": "auto_temp",
// 自动测试服务运行的端口
"serverPort": "12345",
// 自动测试监听状态下的自动更新监听端口
"liveReloadPort": "12346",
// 测试目标地址,花括号中的参数将会被taskList的项目中的属性替代
// auto_path为必须项目
"target": "http://localhost:4400/?{{sid}}&auto_path={{path}}",
// 任务列表,可以配置多个
"taskList": [
{
// 任务要使用的问卷id
"sid": "9f7026db-f762-4709-a1ed-35c689625164",
// 任务测试脚本坐在路径,起始于auto参数指定的文件夹
"path": "basic/index",
// 可选的参数,将会解开后拼接到target url之后
"query_params": {}
}
]
}
测试启动时将读取配置文件,对每个任务进行单独的测试,并报告测试结果。
temp
| assist // 这个就是src/assist转移过去的,
| // 里面的文件将会以模块方式注入到被测试网站中
|------test.js
|------tool.js
| tasks // 这个就是auto目录中的测试脚本转移到了这里
| chai.js // 测试断言库,将会注入到被测试网站中
| index.html // 启动测试的页面,将会以iframe的方式打开每个测试任务
| index.js // 启动页面的依赖脚本
import {tester, deepEqual} from '../assist/test'
// init可以配置一下这才整个测试的标题
// 多次init的话将以最后一次为准
tester.init('title')
// 链式调用开始测试
// assert是chai单元库的的assert风格断言对象
// deepEqual是自定义的一个深对比断言方法,相对于assert.deepEqual来说
// 前者会具体深入报考那一层那个属性没有断言成功,利于观察,后者则不会
.test('测试1',(assert) => {
assert.equal(1, 2, '1===2')
deepEqual({a:{a:1}}, {a:{b:1}}, assert, 'deep equal');
})
// 测试可以返回一个promise,如果返回了promise
// 则后续的测试将会等待promise被resolve之后才执行
// 这种方式在模拟人为操作的时候,
// 或者测试间状态互相依赖的场合非常有用
.test('测试2',(assert) => {
assert.equal(1, 2, '1===2')
return new Promise(resolve => {
setTimeout(resolve, 2000)
})
})
// 这个测试将等到'测试2'执行完两秒后才被执行
.test('测试3',(assert) => {
assert.equal('1', '1', '1===1')
})
// 暂时跳过的测试
.skip('测试4',(assert) => {
// 这个测试将会被跳过
})
// 将要做的测试
.todo('测试5',(assert) => {
// 这个测试也会被跳过
})
cf-auto
即可开始跑起测试
FAQs
test runner
The npm package cf-auto receives a total of 1 weekly downloads. As such, cf-auto popularity was classified as not popular.
We found that cf-auto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.