@autotest/agent 0.0.9 → 0.0.10
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.
- package/README.md +36 -0
- package/dist/api/types.d.ts +2 -2
- package/dist/autotest-cli.js +1 -1
- package/dist/common/config/config.yaml +1 -0
- package/dist/common/config/types.d.ts +5 -0
- package/dist/index.js +1 -1
- package/dist/tools/batch_runner.d.ts +2 -2
- package/dist/tools/batch_runner.js +1 -1
- package/dist/tools/case_runner/runner.js +1 -1
- package/dist/tools/config/config_tool.js +1 -1
- package/dist/tools/prompt_compare/compare_runner.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -296,8 +296,22 @@ device:
|
|
|
296
296
|
# keepalive_process_whitelist:
|
|
297
297
|
# - "com.hm.screenrecorder"
|
|
298
298
|
# - "com.hm.keeprunning"
|
|
299
|
+
skip_clear_process: false # true=每次用例执行前跳过清理后台进程(等价于 --skip-clear-process)
|
|
299
300
|
```
|
|
300
301
|
|
|
302
|
+
### 进程清理与白名单
|
|
303
|
+
|
|
304
|
+
每次用例执行前,Agent 会调用 `adapter.reset()` 执行设备重置:回到主页 + 清理后台进程。通过以下配置控制行为:
|
|
305
|
+
|
|
306
|
+
- **`reset_device: true`**(默认):回到主页,清理所有后台进程(白名单内除外)
|
|
307
|
+
- **`reset_device: false`**:完全跳过重置
|
|
308
|
+
- **`reset_device: ["pkg1", "pkg2"]`**:仅 force-stop 指定包名
|
|
309
|
+
- **`keepalive_process_whitelist`**:白名单内的进程不会被 force-stop(仅在 `reset_device: true` 模式下生效)
|
|
310
|
+
- **`skip_clear_process: true`** 或 CLI `--skip-clear-process`:完全跳过 `adapter.reset()`,不清理任何进程
|
|
311
|
+
- CLI **`--keepalive pkg1 pkg2`**:运行时设置白名单(别名 `--keepalive-process-whitelist`),与 `keepalive_process_whitelist` 配置等价
|
|
312
|
+
|
|
313
|
+
> 白名单在 `reset()` 执行时从 ConfigManager 动态读取,因此 CLI `--keepalive` 和 config.yaml 中的 `keepalive_process_whitelist` 均能实时生效,无需关心 adapter 初始化顺序。
|
|
314
|
+
|
|
301
315
|
### 日志 / 输出 / 网络配置
|
|
302
316
|
|
|
303
317
|
```yaml
|
|
@@ -440,8 +454,28 @@ npm run batchCaseTest cases.jsonl smoke
|
|
|
440
454
|
|
|
441
455
|
# 显式用 -- 标志(等价写法)
|
|
442
456
|
npm run batchCaseTest -- --testcases cases.jsonl --category smoke
|
|
457
|
+
|
|
458
|
+
# 跳过清理后台进程(保留上条用例的进程状态)
|
|
459
|
+
npm run batchCaseTest -- --testcases cases.jsonl --skip-clear-process
|
|
460
|
+
|
|
461
|
+
# 指定最大执行用例数
|
|
462
|
+
npm run batchCaseTest -- --testcases cases.jsonl --max-cases 5
|
|
443
463
|
```
|
|
444
464
|
|
|
465
|
+
#### 批量执行参数
|
|
466
|
+
|
|
467
|
+
| 参数 | 说明 |
|
|
468
|
+
|------|------|
|
|
469
|
+
| `--testcases <path>` | 用例文件路径(JSON/JSONL) |
|
|
470
|
+
| `--category <name>` | 用例分类名(默认 `default`,用于报告与回写) |
|
|
471
|
+
| `--task-dir <dir>` | 报告输出目录(默认 `reports/<date>/<time>/`) |
|
|
472
|
+
| `--testset-root <dir>` | 用例集根目录,用于回写 `auto_result` 到原始 JSON |
|
|
473
|
+
| `--config <path>` | 配置文件路径 |
|
|
474
|
+
| `--mode <m>` | Agent 模式:single / layered |
|
|
475
|
+
| `--prompt-name <name>` | 按名称加载提示词 |
|
|
476
|
+
| `--max-cases <n>` | 限制执行用例数量 |
|
|
477
|
+
| `--skip-clear-process` | 每条用例执行前跳过清理后台进程 |
|
|
478
|
+
|
|
445
479
|
作为已安装的 npm 包使用时,也可调用发布的 `autotest-batch` 二进制:
|
|
446
480
|
|
|
447
481
|
```bash
|
|
@@ -502,6 +536,7 @@ Run options:
|
|
|
502
536
|
--keepalive-process-whitelist <pkg1> <pkg2> ...
|
|
503
537
|
Keep these processes alive during device reset (alias: --keepalive)
|
|
504
538
|
e.g. --keepalive com.hm.screenrecorder com.hm.app
|
|
539
|
+
--skip-clear-process Skip clearing background processes before each test case
|
|
505
540
|
|
|
506
541
|
Analyze options:
|
|
507
542
|
--task-id <id> Task ID to analyze
|
|
@@ -608,6 +643,7 @@ const result = await agent.runTask(task: string, options?: RunTaskOptions);
|
|
|
608
643
|
| `taskName` | `string` | 用例名称 |
|
|
609
644
|
| `caseNum` | `string` | 用例编号 |
|
|
610
645
|
| `maxSteps` | `number` | 覆盖最大步数 |
|
|
646
|
+
| `skipClearProcess` | `boolean` | 跳过清理后台进程(等价 `--skip-clear-process`) |
|
|
611
647
|
| `configOverrides` | `Record<string, unknown>` | 运行时配置覆盖 |
|
|
612
648
|
|
|
613
649
|
### 其他方法
|
package/dist/api/types.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ export interface TaskOptions {
|
|
|
28
28
|
promptName?: string;
|
|
29
29
|
/** app→bundle 映射配置文件路径(--app-config)。 */
|
|
30
30
|
appConfig?: string;
|
|
31
|
-
/** 跳过清理后台进程(--
|
|
32
|
-
|
|
31
|
+
/** 跳过清理后台进程(--skip-clear-process / config device.skip_clear_process),true 时跳过 adapter.reset()。 */
|
|
32
|
+
skipClearProcess?: boolean;
|
|
33
33
|
}
|
|
34
34
|
export interface CaseResult {
|
|
35
35
|
execIndex: number;
|