Open 1134041701 opened 1 year ago
@1134041701 1.APIJSON 后端设置了必须登录 可以重新登录下; 或者修改 Access 表里关于 Method, TestRecord, Random, Script 的 get,允许角色新增 "UNKNOWN"
2.前后置执行脚本 Script 功能是 APIJSON 6.0.0 及 UnitAuto-Admin 2.8.1 引入的, 可以 UnitAuto-Admin 也要用旧版 2.7.2 以下; https://github.com/TommyLemon/UnitAuto/releases
或者在 Access 表里插入一条记录,允许 LOGIN 角色 get 访问 Script
INSERT INTO `Access` VALUES (1,0,NULL,'Script',NULL,'[\"UNKNOWN\", \"LOGIN\", \"CONTACT\", \"CIRCLE\", \"OWNER\", \"ADMIN\"]')
然后导入 Script.sql https://github.com/APIJSON/APIJSON-Demo/blob/master/MySQL/single/sys_Script.sql
或者自己建表都行
DROP TABLE IF EXISTS `Script`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Script` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`userId` bigint(20) NOT NULL DEFAULT '0' COMMENT '用户 id',
`testAccountId` bigint(20) NOT NULL DEFAULT '0' COMMENT '测试账号 id',
`documentId` bigint(20) NOT NULL DEFAULT '0' COMMENT '测试用例 id',
`simple` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否为可直接执行的简单代码段:0-否 1-是',
`ahead` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否为前置脚本',
`title` varchar(100) DEFAULT NULL COMMENT '函数名',
`name` varchar(100) NOT NULL COMMENT '名称',
`script` text NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`detail` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1671083305190 DEFAULT CHARSET=utf8 COMMENT='脚本,前置预处理脚本、后置断言和恢复脚本等';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Script`
--
LOCK TABLES `Script` WRITE;
/*!40000 ALTER TABLE `Script` DISABLE KEYS */;
INSERT INTO `Script` VALUES (1,0,0,0,0,0,NULL,'getType','function getType(curObj, key) {\n var val = curObj == null ? null : curObj[key];\n return val instanceof Array ? \"array\" : typeof val;\n}','2022-11-16 16:01:23',NULL),(2,0,0,0,0,0,NULL,'isContain','function isContain(curObj, arrKey, valKey) {\n var arr = curObj == null ? null : curObj[arrKey];\n var val = curObj == null ? null : curObj[valKey];\n return arr != null && arr.indexOf(val) >=0;\n}','2022-11-16 16:02:48',NULL),(3,0,0,0,1,0,NULL,'init','var i = 1;\n\"init done \" + i;','2022-11-16 16:41:35',NULL),(4,0,0,0,0,0,NULL,'length','function length(curObj, key) {\n var val = curObj == null ? null : curObj[key];\n return val == null ? 0 : val.length;\n}','2022-11-16 17:18:43',NULL),(1670877704568,82001,0,1560244940013,1,0,'执行脚本 2022-12-13 04:41','','','2022-12-12 20:41:44',NULL),(1670877914051,82001,0,0,1,1,'执行脚本 2022-12-13 04:44','','function assert(assertion, msg) {\n if (assertion === true) {\n return\n }\n if (msg == null) {\n msg = \'assert failed! assertion = \' + assertion\n }\n\n if (isTest) {\n console.log(msg)\n alert(msg)\n } else {\n throw new Error(msg)\n } \n} \n\nif (isTest) {\n assert(true)\n assert(false)\n assert(true, \'ok\')\n assert(false, \'data.User shoule not be null!\') \n}\n\nfunction getCurAccount() {\n return App.getCurrentAccount()\n}','2022-12-12 20:45:14',NULL),(1670878495619,82001,82002,0,1,0,'执行脚本 2022-12-13 04:54','','function getCurAccount() {\n return App.getCurrentAccount()\n}','2022-12-12 20:54:55',NULL),(1670878529042,82001,82001,0,1,1,'执行脚本 2022-12-13 04:55','','function getCurAccount() {\n return App.getCurrentAccount()\n}','2022-12-12 20:55:29',NULL),(1670878622401,82001,82003,0,1,0,'执行脚本 2022-12-13 04:57','','if (isPre) {\n header[\'my-header\'] = \'test\'\n}','2022-12-12 20:57:02',NULL),(1670885503909,82001,0,1657045372046,1,1,'执行脚本 2022-12-13 06:51','','if (isPre) {\n req.User.id = 82005\n}','2022-12-12 22:51:43',NULL),(1670887211207,82001,0,1657045372046,1,0,'执行脚本 2022-12-13 07:20','','','2022-12-12 23:20:11',NULL),(1671083305189,82001,0,0,1,0,NULL,'globalPost0','','2022-12-15 05:48:25',NULL);
/*!40000 ALTER TABLE `Script` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@1134041701 APIJSON 6.1.0 已发布,解决了多表同时增删改的 bug 等问题;新增支持 Snowflake,Databricks,Cassandra;增强条件组合、参数校验等: https://github.com/Tencent/APIJSON/releases/tag/6.1.0
相关 Demo https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource
本地后端部署代码: 1、后端部署了APIJSONBoot5.4.0的代码 2、前端用的是UnitAuto-Admin最新的代码 3、sql执行的是5.4.0版本包里面的sql文件
查看、同步方法文档上传单元测试用例这个问题是正常的,存在以下几个问题点,望指教 1、未登录-点击查用例列表,远程共享数据数据没有展示出来
2、已登录-点击查看用例列表,提示登录用户不能get请求