Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
使用
npm install -g cf-auto
mocdule.exports = {
// 测试文件类型,默认为js
fileType: "ts",
// 测试脚本所在目录
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: {}
}
],
// 自定义替换,配置到这里的键值对,在编译测试任务时,测试脚本中的对应键的内容都会被替换为值的内容
replacements: {
"import * as cf from '../app/services/debug.js';": "var cf = window.CF;"
}
}
测试启动时将读取配置文件,对每个任务进行单独的测试,并报告测试结果。
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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.