Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 服务端接口逻辑添加用例增量保存、冲突检测、历史记录diff着色功能 #93

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

chenhengjie123
Copy link

@chenhengjie123 chenhengjie123 commented Jun 16, 2021

主要是对应 基于百度脑图的用例增量保存 + diff 展示整体设计 进行的服务端改动

改动涉及到 case_backup 表的字段增加,请先应用 sql/case-server.sql 末尾新增 # 添加2个字段,记录每次保存的增量修改内容 后的 DDL 修改语句。

增量生成、应用、标记的逻辑全部在 case-server/src/main/java/com/xiaoju/framework/util/MinderJsonPatchUtil.java 这个工具类

配套单测在 case-server/src/test/java/com/xiaoju/framework/util/MinderJsonPatchUtilTest.java

前端由于非基于现有 react 开发,故此 pr 未包含前端改动,逻辑内也对当前未有改动的前端进行了兼容。前端大概需要改动的点:

1、在打开界面/保存成功后,记录一下此刻的用例数据至 baseCaseContent 参数中(请确认保存的是值,非引用。建议直接 JSON.stringify 转为 json 文本存储)。保存时 update 接口带上这个信息。

2、测试任务界面,可以去掉编辑器的 readOnly ,允许修改用例内容。

3、因目前前端未有历史记录的列表页及展示页,有需要请添加。并建议历史记录列表页的接口,不要返回 caseContent、recordContent、jsonPatch 这些大字段,提高性能。服务端已补充单个历史记录的查询接口 /api/backup/getBackupById ,着色规则如下图文字描述所示:
image

特别注意:调整的整体思路是完全不涉及基于 websocket 的用例增量变化同步的,所有 diff 均是服务端基于前端的保存时提供的刚打开时用例内容 baseCaseContent 及保存时的用例内容 caseContent 。基本思想是更改的内容只包含用户想修改的,然后只要和服务端最新的没有冲突,就允许应用。未测试过与 websocket 用例增量变化自动同步的兼容性。

此理念可能和本身 AgileTC 的多人协作理念有一定差异,建议按官方内部实际需要进行取用。

@tanto521
Copy link

有没有前端更改的代码,能pull下嘛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants