casebook 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- casebook-0.1.0/LICENSE +201 -0
- casebook-0.1.0/PKG-INFO +300 -0
- casebook-0.1.0/README.md +287 -0
- casebook-0.1.0/casebook/__init__.py +3 -0
- casebook-0.1.0/casebook/app.py +175 -0
- casebook-0.1.0/casebook/cli.py +165 -0
- casebook-0.1.0/casebook/editor.py +152 -0
- casebook-0.1.0/casebook/initializer.py +54 -0
- casebook-0.1.0/casebook/marks.py +54 -0
- casebook-0.1.0/casebook/project_template/.agents/skills/casebook-test-cases/SKILL.md +128 -0
- casebook-0.1.0/casebook/project_template/.vscode/settings.json +12 -0
- casebook-0.1.0/casebook/project_template/AGENTS.md +26 -0
- casebook-0.1.0/casebook/project_template/docs/requirements/login.md +73 -0
- casebook-0.1.0/casebook/project_template/releases/example/login.yaml +73 -0
- casebook-0.1.0/casebook/project_template/schema/test-case-schema.json +126 -0
- casebook-0.1.0/casebook/scanner.py +235 -0
- casebook-0.1.0/casebook/static/app.css +1287 -0
- casebook-0.1.0/casebook/static/app.js +643 -0
- casebook-0.1.0/casebook/templates/index.html +149 -0
- casebook-0.1.0/casebook/watcher.py +60 -0
- casebook-0.1.0/casebook.egg-info/PKG-INFO +300 -0
- casebook-0.1.0/casebook.egg-info/SOURCES.txt +26 -0
- casebook-0.1.0/casebook.egg-info/dependency_links.txt +1 -0
- casebook-0.1.0/casebook.egg-info/entry_points.txt +2 -0
- casebook-0.1.0/casebook.egg-info/requires.txt +4 -0
- casebook-0.1.0/casebook.egg-info/top_level.txt +1 -0
- casebook-0.1.0/pyproject.toml +35 -0
- casebook-0.1.0/setup.cfg +4 -0
casebook-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
casebook-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: casebook
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A local browser and editor for YAML test cases.
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: flask>=3.1.3
|
|
9
|
+
Requires-Dist: ruamel.yaml>=0.18.6
|
|
10
|
+
Requires-Dist: typer>=0.12.0
|
|
11
|
+
Requires-Dist: watchdog>=4.0.0
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# Casebook
|
|
15
|
+
|
|
16
|
+
Casebook 是一个面向 AI 时代测试用例工作的本地工具。
|
|
17
|
+
|
|
18
|
+
它把需求文档、AI 测试设计规范、JSON Schema 约束、YAML 用例文件和可视化编辑界面连成一条完整工作流:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
docs/requirements/ 需求文档
|
|
22
|
+
-> AI 按技能包理解需求并生成用例
|
|
23
|
+
-> releases/ YAML 测试用例
|
|
24
|
+
-> casebook serve 本地浏览、标记、编辑
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Casebook 的目标不是替代测试人员,而是把测试人员从重复录入中释放出来:人负责需求理解、风险判断和评审,AI 负责按规范批量生成结构化用例,Casebook 负责可视化查看和编辑。
|
|
28
|
+
|
|
29
|
+
## 核心能力
|
|
30
|
+
|
|
31
|
+
- 一条命令创建标准 Casebook 用例项目。
|
|
32
|
+
- 将需求文档放入 `docs/requirements/`,让 AI 按项目技能包生成测试用例。
|
|
33
|
+
- 使用 `schema/test-case-schema.json` 约束 YAML 用例格式。
|
|
34
|
+
- 在本地 Web UI 中浏览、筛选、展开、标记和编辑 YAML 用例。
|
|
35
|
+
- 保存编辑时直接回写原始 YAML 文件。
|
|
36
|
+
- 使用 `ruamel.yaml` 尽量保留 YAML 注释、字段顺序、缩进和 inline list 风格。
|
|
37
|
+
- 将标记状态保存在 `.casebook/marks.json`,不污染用例文件本身。
|
|
38
|
+
- 监听 YAML 文件变化,并通知浏览器刷新。
|
|
39
|
+
|
|
40
|
+
## 安装
|
|
41
|
+
|
|
42
|
+
Casebook 需要 Python 3.10 或更高版本。
|
|
43
|
+
|
|
44
|
+
在本仓库中安装:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install -e .
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
安装后可以使用:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
casebook --help
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 快速开始
|
|
57
|
+
|
|
58
|
+
创建一个新的 Casebook 项目:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
casebook init my-casebook
|
|
62
|
+
cd my-casebook
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
启动本地用例工作台:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
casebook serve releases
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
默认地址:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
http://127.0.0.1:8089
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
也可以自动打开浏览器:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
casebook serve releases --open
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
指定端口:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
casebook serve releases --port 8090
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 初始化项目
|
|
90
|
+
|
|
91
|
+
`casebook init <project>` 会创建一个完整的用例项目脚手架:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
my-casebook/
|
|
95
|
+
AGENTS.md
|
|
96
|
+
.agents/
|
|
97
|
+
skills/
|
|
98
|
+
casebook-test-cases/
|
|
99
|
+
SKILL.md
|
|
100
|
+
.vscode/
|
|
101
|
+
settings.json
|
|
102
|
+
docs/
|
|
103
|
+
requirements/
|
|
104
|
+
login.md
|
|
105
|
+
releases/
|
|
106
|
+
example/
|
|
107
|
+
login.yaml
|
|
108
|
+
schema/
|
|
109
|
+
test-case-schema.json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
这些文件分别负责:
|
|
113
|
+
|
|
114
|
+
- `docs/requirements/login.md`:示例需求文档。
|
|
115
|
+
- `releases/example/login.yaml`:由示例需求反向配套的 YAML 测试用例。
|
|
116
|
+
- `schema/test-case-schema.json`:测试用例结构约束。
|
|
117
|
+
- `.agents/skills/casebook-test-cases/SKILL.md`:AI 生成用例时需要遵循的技能包。
|
|
118
|
+
- `AGENTS.md`:项目根目录 AI 入口,提示 AI 读取技能包和 schema。
|
|
119
|
+
- `.vscode/settings.json`:让 VS Code YAML 插件自动关联 schema。
|
|
120
|
+
|
|
121
|
+
如果目标目录中已经存在同名文件,`init` 默认跳过,不会覆盖:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
casebook init my-casebook
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
需要重置脚手架文件时,可以使用:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
casebook init my-casebook --force
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`casebook project <project>` 也可用,等价于 `casebook init <project>`。
|
|
134
|
+
|
|
135
|
+
## AI 用例生成工作流
|
|
136
|
+
|
|
137
|
+
推荐工作方式:
|
|
138
|
+
|
|
139
|
+
1. 将产品需求、接口说明、交互规则或业务背景放入 `docs/requirements/`。
|
|
140
|
+
2. 让 AI 阅读 `AGENTS.md` 和 `.agents/skills/casebook-test-cases/SKILL.md`。
|
|
141
|
+
3. AI 根据需求、技能包和 `schema/test-case-schema.json` 生成 YAML 用例。
|
|
142
|
+
4. 将真实项目用例写入 `releases/<版本或模块>/<功能>.yaml`。
|
|
143
|
+
5. 使用 `casebook serve releases` 查看、标记和编辑用例。
|
|
144
|
+
|
|
145
|
+
示例目录中的 `releases/example/` 只用于脚手架演示。真实项目用例建议放在更明确的目录中,例如:
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
releases/v1-auth/login.yaml
|
|
149
|
+
releases/v5-user-backend/package-management.yaml
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## 用例格式
|
|
153
|
+
|
|
154
|
+
Casebook 读取符合以下结构的 YAML 文件:
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
metadata:
|
|
158
|
+
module: "系统认证"
|
|
159
|
+
feature: "用户登录"
|
|
160
|
+
owner: "qa"
|
|
161
|
+
last_reviewed: "2026-06-24"
|
|
162
|
+
tags: [auth, login]
|
|
163
|
+
|
|
164
|
+
test_cases:
|
|
165
|
+
- id: "TC_LOGIN_001"
|
|
166
|
+
title: "有效用户名和密码登录成功"
|
|
167
|
+
description: "验证用户使用正确的登录凭证可以成功进入系统。"
|
|
168
|
+
priority: "P0"
|
|
169
|
+
type: "functional"
|
|
170
|
+
preconditions:
|
|
171
|
+
- 用户已注册并处于正常可登录状态
|
|
172
|
+
steps:
|
|
173
|
+
- 输入有效用户名和对应密码
|
|
174
|
+
- 点击登录按钮
|
|
175
|
+
expected_results:
|
|
176
|
+
- 登录成功,进入系统首页
|
|
177
|
+
- 显示当前用户姓名和欢迎信息
|
|
178
|
+
tags: [smoke, login]
|
|
179
|
+
auto: true
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
字段约束以 `schema/test-case-schema.json` 为准。默认支持的优先级:
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
P0, P1, P2
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
默认支持的类型:
|
|
189
|
+
|
|
190
|
+
```text
|
|
191
|
+
functional, ui, security, performance, accessibility, business, other, data-consistency
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## 本地工作台
|
|
195
|
+
|
|
196
|
+
启动后,Casebook 提供一个本地 Web UI:
|
|
197
|
+
|
|
198
|
+
- 左侧按目录展示 YAML 用例文件。
|
|
199
|
+
- 中间展示当前文件的用例列表、统计、优先级和标签。
|
|
200
|
+
- 用例行可以展开,直接查看前置条件、步骤和预期结果。
|
|
201
|
+
- 可以用 Mark 标记需要关注或后续修改的用例。
|
|
202
|
+
- 点击 Edit 打开右侧编辑抽屉,并保存回 YAML 文件。
|
|
203
|
+
|
|
204
|
+
Casebook 会根据文件修改时间做编辑冲突检查。如果 YAML 文件在页面加载后被外部修改,保存时会提示冲突,避免覆盖他人的改动。
|
|
205
|
+
|
|
206
|
+
## 命令参考
|
|
207
|
+
|
|
208
|
+
创建项目:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
casebook init my-casebook
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
覆盖脚手架文件:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
casebook init my-casebook --force
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
启动默认用例目录:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
casebook serve releases
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
同时扫描多个目录:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
casebook serve releases/v1 releases/v2
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
指定主机和端口:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
casebook serve releases --host 127.0.0.1 --port 8090
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
禁用文件监听:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
casebook serve releases --no-watch
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## 项目状态文件
|
|
245
|
+
|
|
246
|
+
Casebook 的标记数据保存在项目根目录:
|
|
247
|
+
|
|
248
|
+
```text
|
|
249
|
+
.casebook/marks.json
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
示例:
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"releases/example/login.yaml#TC_LOGIN_001": {
|
|
257
|
+
"needs_update": true,
|
|
258
|
+
"updated_at": "2026-06-24T02:00:00+00:00"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
这些状态不写入 YAML 用例文件,因此不会影响用例正文和 schema 校验。
|
|
264
|
+
|
|
265
|
+
## 开发
|
|
266
|
+
|
|
267
|
+
本地开发安装:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
pip install -e .
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
创建演示项目:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
casebook init /tmp/casebook-demo
|
|
277
|
+
cd /tmp/casebook-demo
|
|
278
|
+
casebook serve releases
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
在源码模式下也可以直接运行:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
python -m casebook.cli init /tmp/casebook-demo
|
|
285
|
+
python -m casebook.cli serve releases
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## 设计理念
|
|
289
|
+
|
|
290
|
+
传统测试用例往往散落在表格、文档和测试管理平台里,格式难统一,版本难追踪,AI 也很难稳定复用。
|
|
291
|
+
|
|
292
|
+
Casebook 将用例工程化:
|
|
293
|
+
|
|
294
|
+
- 用 `docs/requirements/` 承载需求输入。
|
|
295
|
+
- 用 `.agents/skills/` 固化测试设计方法。
|
|
296
|
+
- 用 `schema/` 固化结构约束。
|
|
297
|
+
- 用 `releases/` 存放可版本化的 YAML 用例。
|
|
298
|
+
- 用本地 Web UI 完成审阅、标记和编辑。
|
|
299
|
+
|
|
300
|
+
这让测试用例变成可以被 AI 生成、被 schema 校验、被 Git 管理、被人高效评审的工程资产。
|