开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
forked from TommyLemon/SQLAuto
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
main
分支 (1)
标签 (2)
main
1.1.0
1.0
main
分支 (1)
标签 (2)
main
1.1.0
1.0
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
main
分支 (1)
标签 (2)
main
1.1.0
1.0
SQLAuto
/
js
/
server.js
SQLAuto
/
js
/
server.js
server.js 4.80 KB
一键复制 编辑 原始数据 按行查看 历史
TommyLemon 提交于 2022年10月30日 18:52 +08:00 . 从 APIAuto 同步部分代码
const Koa = require('koa');
// const Vue = require('vue');
const {getRequestFromURL, App} = require('./main');
// const { createBundleRenderer } = require('vue-server-renderer')
// const JSONResponse = require('../apijson/JSONResponse');
const StringUtil = require('../apijson/StringUtil');
var isCrossEnabled = true; // false;
var isLoading = false;
var startTime = 0;
var endTime = 0;
var message = '';
var error = null;
var timeMsg = '';
var progressMsg = '';
var progress = 0;
var accountProgress = 0;
var testCaseProgress = 0;
var deepProgress = 0;
var randomProgress = 0;
function update() {
if (isLoading != true) {
return;
}
if (error != null) {
isLoading = false;
}
var curTime = isLoading ? (new Date()).getTime() : null;
if (endTime <= 0 || isLoading) {
endTime = curTime;
}
var duration = endTime - startTime;
var dd = new Date(duration + 60000*(new Date().getTimezoneOffset()));
timeMsg = '\n\nStart Time: ' + startTime + ' = ' + new Date(startTime).toLocaleString()
+ (isLoading ? '; \nCurrent' : '\nEnd') + ' Time: ' + endTime + ' = ' + new Date(endTime).toLocaleString()
+ '; \nTime Spent: ' + duration + ' = ' + dd.getHours() + ":" + dd.getMinutes() + ":" + dd.getSeconds() + "." + dd.getMilliseconds();
var accountDoneCount = App.currentAccountIndex + 1;
var accountAllCount = App.accounts.length;
accountProgress = isCrossEnabled != true || accountAllCount <= 0 || accountDoneCount >= accountAllCount ? 1 : (accountDoneCount/accountAllCount).toFixed(2);
testCaseProgress = App.doneCount >= App.allCount ? 1 : (App.doneCount/App.allCount).toFixed(2);
deepProgress = App.deepDoneCount >= App.deepAllCount ? 1 : (App.deepDoneCount/App.deepAllCount).toFixed(2);
randomProgress = App.randomDoneCount >= App.randomAllCount ? 1 : (App.randomDoneCount/App.randomAllCount).toFixed(2);
// progress = accountProgress*testCaseProgress*deepProgress*randomProgress;
progress = accountProgress >= 1 ? 1 : (accountProgress + (accountAllCount <= 0 ? 1 : 1/accountAllCount)*(testCaseProgress
+ (App.allCount <= 0 ? 1 : 1/App.allCount)*(deepProgress + (App.deepAllCount <= 0 ? 1 : 1/App.deepAllCount)*randomProgress)));
if (progress >= 1) {
isLoading = false;
}
progressMsg = '\n\nProgress: ' + (100*progress) + '%'
+ '\nTest Account: ' + accountDoneCount + ' / ' + accountAllCount + ' = ' + (100*accountProgress) + '%'
+ '\nTest Case: ' + App.doneCount + ' / ' + App.allCount + ' = ' + (100*testCaseProgress) + '%'
+ '\nDeep Test Case: ' + App.deepDoneCount + ' / ' + App.deepAllCount + ' = ' + (100*deepProgress) + '%'
+ '\nRandom & Order: ' + App.randomDoneCount + ' / ' + App.randomAllCount + ' = ' + (100*randomProgress) + '%';
};
const PORT = 3002;
const app = new Koa();
app.use(async ctx => {
console.log(ctx)
if (ctx.path == '/test/start' || (isLoading != true && ctx.path == '/test')) {
if (isLoading && ctx.path == '/test/start') {
ctx.body = 'Already started auto testing in node, please wait for minutes...';
ctx.status = 200
return
}
App.isCrossEnabled = isCrossEnabled; // isCrossEnabled = App.isCrossEnabled;
if (isCrossEnabled) {
App.currentAccountIndex = -1;
}
isLoading = true;
startTime = (new Date()).getTime();
endTime = startTime;
message = '';
error = null;
timeMsg = '';
progressMsg = '';
progress = 0;
accountProgress = 0;
testCaseProgress = 0;
deepProgress = 0;
randomProgress = 0;
update();
App.key = ctx.query.key;
if (StringUtil.isNotEmpty(App.key, true)) {
App.testCaseCount = App.data.testCaseCount = 1000;
App.randomCount = App.data.randomCount = 200;
App.randomSubCount = App.data.randomSubCount = 500;
}
App.autoTest(function (msg, err) {
message = msg;
error = err;
update();
console.log('autoTest callback(' + msg + ')' + timeMsg + progressMsg);
return Number.isNaN(progress) != true && progress >= 1;
});
isLoading = true;
isCrossEnabled = App.isCrossEnabled;
ctx.status = ctx.response.status = 200; // 302;
ctx.body = 'Auto testing in node...';
// setTimeout(function () { // 延迟无效
ctx.redirect('/test/status');
// }, 1000)
}
else if (ctx.path == '/test/status' || (isLoading && ctx.path == '/test')) {
update();
if (isLoading) {
// ctx.response.header['refresh'] = "1";
// ctx.redirect('/status');
}
ctx.status = ctx.response.status = 200; // progress >= 1 ? 200 : 302;
ctx.body = (message || (progress < 1 || isLoading ? 'Auto testing in node...' : 'Done auto testing in node.')) + timeMsg + progressMsg;
}
});
app.listen(PORT);
console.log(`已启动 Node HTTP 服务,可以
GET http://localhost:${PORT}/test/start
来启动后台回归测试,或者
GET http://localhost:${PORT}/test/status
来查询测试进度。`);
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

🔍 智能零代码自动化测试 SQL 语句执行结果的数据库工具,任意增删改查、任意 SQL 模板变量、一键批量生成参数组合、快速构造大量测试数据,由腾讯工程师开发
暂无标签
Apache-2.0
使用 Apache-2.0 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/bemy/SQLAuto.git
git@gitee.com:bemy/SQLAuto.git
bemy
SQLAuto
SQLAuto
main
点此查找更多帮助

搜索帮助

仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /