moon-engine
v0.0.8
Published
性能跑分平台规则模块
Downloads
4
Readme
性能跑分平台得分规则模块调用
调用示例
const RuleEngine = require('@tencent/moon-engine');
const ruleEngine = new RuleEngine();
ruleEngine.getScore(ruleEngine.getResultFields(data));
自定义/组合 规则
const RuleEngine = require('@tencent/moon-engine');
const ruleEngine = new RuleEngine(["rule_default_0"]); // or other rule
ruleEngine.getScore(ruleEngine.getResultFields(data));
返回结果示例
返回结果为一个对象,数据结构示例如下:
{
rule_default_0: {
desc: '图片大小超过50KB', // 对应规则描述
score: 14 // 对应规则所扣分数
},
rule_default_1: {
desc: '小于5KB图片未base64',
score: 18
},
final_score: 68 // 得分
}
data数据结构
{
"data": {
"id": "180910_HC_1",
"url": "http:\/\/now.qq.com",
"summary": "http:\/\/127.0.0.1:4000\/results.php?test=180910_HC_1",
"testUrl": "http:\/\/now.qq.com",
"location": "Test:Chrome",
"from": "Test Location - <b>Chrome<\/b>",
"bwDown": 0,
"bwUp": 0,
"latency": 0,
"plr": "0",
"mobile": 0,
"completed": 1536561514,
"tester": "linuxkit-025000000001-172.17.0.1",
"runs": {},
"fvonly": true,
"successfulFVRuns": 3,
"average": {},
"standardDeviation": {},
"median": {}
},
"statusCode": 200,
"statusText": "Test Complete",
"webPagetestVersion": "18.02"
}