25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HOW_TO_GENERATE_COMMIT_TEST_PLANS.md 4.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # How to generate commit test plans (Word)
  2. This guide is for QA / deploy teammates. Use it when a build is ready and you need **what changed** and **how to test** for each commit.
  3. ## Easiest: just tell Cursor
  4. In Cursor chat (Agent), say any of:
  5. - `gen test plan`
  6. - `generate test plan for new commits`
  7. - `產測試計畫` / `有新 commit,幫我出 test plan`
  8. - Or use the slash command: **`/gen-commit-test-plans`**
  9. Cursor will run the generator and put Word files in `docs/deploy/commit-plans/`.
  10. You can be more specific:
  11. - `gen test plan for latest commit`
  12. - `gen test plan for HEAD~5..HEAD`
  13. - `gen test plan since abc1234`
  14. ---
  15. ## What you get
  16. Running the generator creates **one Word file per commit** under:
  17. ```
  18. docs/deploy/commit-plans/
  19. YYYY-MM-DD_<shortsha>_<slug>.docx
  20. _index.md ← list of all generated plans
  21. ```
  22. Each `.docx` includes:
  23. - Commit id, date, author, message
  24. - Auto-detected areas (e.g. 送貨出倉, 工單, BOM)
  25. - Files touched
  26. - **Test plan table**: Steps + Expected result
  27. > These plans are a **starting point** (from commit message + file paths). For critical releases, refine steps with the developer or ask the Cursor agent to review the real diff.
  28. ---
  29. ## Prerequisites
  30. 1. Clone / pull latest `FPSMS-backend`.
  31. 2. Install Python 3, then:
  32. ```bash
  33. pip install python-docx
  34. ```
  35. 3. Open a terminal at the **repo root** (`FPSMS-backend`).
  36. ---
  37. ## Basic usage
  38. Generate plans for the last 10 commits:
  39. ```bash
  40. python scripts/generate_commit_test_plans_docx.py HEAD~10..HEAD
  41. ```
  42. Then open the folder:
  43. ```
  44. docs/deploy/commit-plans/
  45. ```
  46. Start from `_index.md` to see the list, then open each `.docx`.
  47. ---
  48. ## Common examples
  49. ### Last N commits on current branch
  50. ```bash
  51. python scripts/generate_commit_test_plans_docx.py HEAD~5..HEAD
  52. ```
  53. ### Only the latest commit
  54. ```bash
  55. python scripts/generate_commit_test_plans_docx.py HEAD~1..HEAD
  56. ```
  57. ### Commits since a known SHA (e.g. last production deploy)
  58. ```bash
  59. python scripts/generate_commit_test_plans_docx.py <last_deployed_sha>..HEAD
  60. ```
  61. Example:
  62. ```bash
  63. python scripts/generate_commit_test_plans_docx.py b12b9a49..HEAD
  64. ```
  65. ### Commits on `production` that are not yet on another branch
  66. ```bash
  67. python scripts/generate_commit_test_plans_docx.py origin/staging..origin/production
  68. ```
  69. (Adjust branch names to match your remote.)
  70. ### Custom output folder
  71. ```bash
  72. python scripts/generate_commit_test_plans_docx.py HEAD~10..HEAD --out-dir docs/deploy/commit-plans/release-2026-08-01
  73. ```
  74. ### Also write Markdown next to Word
  75. ```bash
  76. python scripts/generate_commit_test_plans_docx.py HEAD~10..HEAD --also-md
  77. ```
  78. ### Cap how many commits are processed
  79. ```bash
  80. python scripts/generate_commit_test_plans_docx.py HEAD~50..HEAD --limit 15
  81. ```
  82. ---
  83. ## Suggested team workflow
  84. 1. Developer merges / tags the build to deploy.
  85. 2. QA or release owner runs the generator for **only the commits in this deploy** (use `last_sha..new_sha`).
  86. 3. Share the `docs/deploy/commit-plans/` folder (or zip it) with testers.
  87. 4. Testers follow Steps / Expected result in each Word file; mark pass/fail.
  88. 5. For vague commits (`no message`), ask the author to clarify before sign-off.
  89. 6. Optional: keep a hand-written summary in `docs/deploy/YYYYMMDD_topic.md` (see `TEMPLATE.md`).
  90. ---
  91. ## Related files
  92. | File | Purpose |
  93. |------|---------|
  94. | `scripts/generate_commit_test_plans_docx.py` | Auto Word plans **per commit** |
  95. | `scripts/generate_deploy_test_plan.py` | One Markdown scaffold for a **whole range** |
  96. | `docs/deploy/TEMPLATE.md` | Manual deploy / QA note template |
  97. | `docs/deploy/20260727_isextra_truck_x_ticket_fix.md` | Example of a filled manual note |
  98. ---
  99. ## Troubleshooting
  100. | Problem | What to try |
  101. |---------|-------------|
  102. | `No module named 'docx'` | `pip install python-docx` |
  103. | `No commits in range` | Check the range syntax: `A..B` means commits reachable from B but not from A |
  104. | Word filename looks odd | Filenames are ASCII-only on purpose (Windows-safe). Chinese text is still inside the document |
  105. | Steps look too generic | Commit had `no message` or unusual paths — ask author / refine with agent |
  106. | Need frontend checks | This repo is backend; also check `FPSMS-frontend` if the change is UI |
  107. ---
  108. ## Quick copy-paste (release day)
  109. ```bash
  110. cd /path/to/FPSMS-backend
  111. git fetch
  112. git checkout <deploy-branch>
  113. pip install python-docx
  114. python scripts/generate_commit_test_plans_docx.py <previous_release_sha>..<this_release_sha>
  115. explorer docs\deploy\commit-plans
  116. ```
  117. (On Mac/Linux, open `docs/deploy/commit-plans` in Finder/files instead of `explorer`.)