# Generate Perf Report

> Generate a professional Word (.docx) stress test report from k6 boundary performance test results. Triggers: when the user asks to produce a pressure test report, stress test report, or 压力测试报告 from k6 results in perf/results/. Parses per-API step/bisect/repeat JSON files and summary.txt, identifies each API's concurrency limit, and outputs a branded .docx with company header, themed colors, and structured sections. All document text is in Chinese.

- Skill: `playerrch/generate-perf-report` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add playerrch/generate-perf-report`
- Raw SKILL.md: https://api.skillmd.com/api/skills/playerrch/generate-perf-report/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: playerrch (https://skillmd.com/u/playerrch)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/playerrch/generate-perf-report

---


# Generate Stress Test Report (.docx)

Produces `《IR后管平台压力测试报告》` from k6 boundary test results.

## Prerequisites

- Python 3.10+ with `python-docx` (`pip install python-docx`)
- k6 results in `perf/results/<timestamp>/` generated by `run-boundary-all.py`

## Result Directory Structure

```
perf/results/<timestamp>/
  progress.log                # 带时间戳的全程进度日志
  summary.txt                 # 各接口极限并发汇总（权威来源）
  <api>_c<N>.json / .txt      # 阶梯递增 + 二分逼近每轮数据
  <api>_repeat/               # 补充轮次数据
    c<N>_run<M>.json / .txt
  IR后管平台压力测试报告.docx  # 自动生成的报告
```

## Auto-Trigger

`run-boundary-all.py` 在全部接口压测完成后自动调用本脚本生成报告，无需手动操作。

## Manual Usage

```bash
python scripts/generate_report.py <results_dir> [--output <path>]
```

## Report Contents

- Header: "上海南洋万邦软件技术有限公司" (仪电蓝 #005BAC)
- Sections: 项目简介 → 测试目的 → 测试方法 → 测试结果 → 测试总结
- 测试方法：三阶段（阶梯递增无上限 → 二分逼近含初始失败回退 → 补充轮次）+ 交互确认
- 测试结果：总览表 + 逐接口详细表（阶段标注、极限行蓝色高亮、失败行红色、补充轮次灰色）
- 响应指标：`avg/p90/p95/max` 响应时间 + 请求失败率（%）
- 支持 N/A 接口（未通过任何并发）的正确展示
- 测试总结：自动统计分析和优化建议

## Script Reference

- [scripts/generate_report.py](scripts/generate_report.py): Main report generator

