$npx -y skills add kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-advanced.NET 進階測試技能總覽與引導中心。當使用者詢問「整合測試」、「API 測試」、「容器化測試」、「微服務測試」、「測試框架遷移」、「Testcontainers」、「Aspire 測試」等進階測試需求時觸發。會根據具體需求推薦適合的子技能組合,涵蓋整合測試、Testcontainers、Aspire 測試、框架升級等 8 個進階技能。 Make sure to use this skill whenever the user mentions integration testing, API testing, Testcontainers, .NET
| 1 | # .NET 進階測試技能總覽 |
| 2 | |
| 3 | 本檔案是「進階測試導航中心」,幫助找到正確的進階子技能。進階測試涉及容器管理、WebApplicationFactory 設定等複雜細節,子技能包含完整的設定指引和常見問題排解,載入正確的子技能能確保使用者獲得完整指引。 |
| 4 | |
| 5 | 根據使用者需求匹配對應的進階子技能,使用 Skill tool 載入,讓子技能提供專業的整合測試指引。 |
| 6 | |
| 7 | --- |
| 8 | |
| 9 | ## 快速技能對照表 |
| 10 | |
| 11 | **使用者提到的關鍵字 → 應載入的進階子技能** |
| 12 | |
| 13 | ### 整合測試技能 |
| 14 | |
| 15 | | 使用者說... | 載入指令 | 用途說明 | |
| 16 | |------------|----------|----------| |
| 17 | | **API 測試**、Controller 測試、端點測試 | `/skill dotnet-testing-advanced-aspnet-integration-testing` | 基礎 API 整合測試 | |
| 18 | | **完整 CRUD**、WebAPI 測試、業務流程測試 | `/skill dotnet-testing-advanced-webapi-integration-testing` | 完整 API 流程測試 | |
| 19 | | **WebApplicationFactory**、TestServer | `/skill dotnet-testing-advanced-aspnet-integration-testing` | WebApplicationFactory 使用 | |
| 20 | |
| 21 | ### 容器化測試技能 |
| 22 | |
| 23 | | 使用者說... | 載入指令 | 用途說明 | |
| 24 | |------------|----------|----------| |
| 25 | | **SQL Server 容器**、PostgreSQL、MySQL | `/skill dotnet-testing-advanced-testcontainers-database` | 關聯式資料庫容器測試 | |
| 26 | | **MongoDB**、Redis、Elasticsearch | `/skill dotnet-testing-advanced-testcontainers-nosql` | NoSQL 資料庫容器測試 | |
| 27 | | **真實資料庫**、EF Core 測試、Dapper 測試 | `/skill dotnet-testing-advanced-testcontainers-database` | 真實資料庫行為測試 | |
| 28 | | **Testcontainers**、容器測試、Docker 測試 | `/skill dotnet-testing-advanced-testcontainers-database` | Testcontainers 基礎 | |
| 29 | |
| 30 | ### 微服務測試技能 |
| 31 | |
| 32 | | 使用者說... | 載入指令 | 用途說明 | |
| 33 | |------------|----------|----------| |
| 34 | | **.NET Aspire**、微服務測試、分散式測試 | `/skill dotnet-testing-advanced-aspire-testing` | Aspire 微服務測試 | |
| 35 | | **DistributedApplication**、服務間通訊 | `/skill dotnet-testing-advanced-aspire-testing` | Aspire 應用測試 | |
| 36 | |
| 37 | ### 框架升級技能 |
| 38 | |
| 39 | | 使用者說... | 載入指令 | 用途說明 | |
| 40 | |------------|----------|----------| |
| 41 | | **xUnit 升級**、xUnit 3.x、版本升級 | `/skill dotnet-testing-advanced-xunit-upgrade-guide` | xUnit 2.x → 3.x 升級 | |
| 42 | | **TUnit**、新測試框架、TUnit 基礎 | `/skill dotnet-testing-advanced-tunit-fundamentals` | TUnit 基礎與遷移 | |
| 43 | | **TUnit 進階**、TUnit DI、平行執行 | `/skill dotnet-testing-advanced-tunit-advanced` | TUnit 進階功能 | |
| 44 | |
| 45 | --- |
| 46 | |
| 47 | ## 使用流程範例 |
| 48 | |
| 49 | ``` |
| 50 | 使用者:請幫我建立 ProductsController 的 API 整合測試 |
| 51 | |
| 52 | AI:我注意到您需要進行 API 整合測試。根據快速對照表, |
| 53 | 我應該載入 dotnet-testing-advanced-aspnet-integration-testing skill。 |
| 54 | |
| 55 | [使用 Skill tool 載入子技能] |
| 56 | |
| 57 | AI:現在按照 ASP.NET Core Integration Testing skill 的指引為您建立測試... |
| 58 | ``` |
| 59 | |
| 60 | --- |
| 61 | |
| 62 | ## 完整技能清單 |
| 63 | |
| 64 | 如需查看完整的 8 個進階技能清單、詳細決策樹、學習路徑建議,請繼續閱讀本檔案後續內容。 |
| 65 | |
| 66 | --- |
| 67 | |
| 68 | ## 快速決策樹 |
| 69 | |
| 70 | 根據測試情境(API 測試、真實資料庫、微服務、框架遷移)快速找到對應的進階子技能。涵蓋 4 大情境與多個選項分支。 |
| 71 | |
| 72 | > 詳細內容請參閱 [references/decision-tree.md](references/decision-tree.md) |
| 73 | |
| 74 | --- |
| 75 | |
| 76 | ## 技能分類地圖 |
| 77 | |
| 78 | 8 個進階技能分為三大類:整合測試(4 個)、微服務測試(1 個)、框架遷移(3 個),包含各技能的核心價值、適合情境、學習難度與前置技能。 |
| 79 | |
| 80 | > 詳細內容請參閱 [references/skill-classification-map.md](references/skill-classification-map.md) |
| 81 | |
| 82 | --- |
| 83 | |
| 84 | ## 常見任務映射表 |
| 85 | |
| 86 | 7 個常見任務的完整映射,包含情境描述、推薦技能、實施步驟、提示詞範例與預期程式碼結構。 |
| 87 | |
| 88 | > 詳細內容請參閱 [references/task-mapping-table.md](references/task-mapping-table.md) |
| 89 | |
| 90 | --- |
| 91 | |
| 92 | ## 整合測試層級對應 |
| 93 | |
| 94 | 根據專案複雜度,選擇適合的測試策略: |
| 95 | |
| 96 | ### Level 1:簡單的 WebApi 專案 |
| 97 | |
| 98 | **專案特徵**: |
| 99 | - 簡單的 CRUD API |
| 100 | - 無外部依賴或使用記憶體實作 |
| 101 | - 業務邏輯簡單 |
| 102 | |
| 103 | **推薦技能**: |
| 104 | - `dotnet-testing-advanced-aspnet-integration-testing` |
| 105 | |
| 106 | **測試重點**: |
| 107 | - 路由驗證 |
| 108 | - 模型綁定 |
| 109 | - HTTP 回應 |
| 110 | - 基本業務邏輯 |
| 111 | |
| 112 | **範例專案**: |
| 113 | - TodoList API |
| 114 | - 簡單的產品目錄 |
| 115 | |
| 116 | --- |
| 117 | |
| 118 | ### Level 2:相依 Service 的 WebApi 專案 |
| 119 | |
| 120 | **專案特徵**: |
| 121 | - 有業務邏輯層(Services) |
| 122 | - 依賴外部服務(可以 Mock) |
| 123 | - 中等複雜度 |
| 124 | |
| 125 | **推薦技能組合**: |
| 126 | 1. `dotnet-testing-advanced-aspnet-integration-testing`(基礎) |
| 127 | 2. `dotnet-testing-nsubstitute-mocking`(模擬依賴) |
| 128 | |
| 129 | **測試策略**: |
| 130 | - 使用 NSubstitute 建立 Service stub |
| 131 | - 測試 Controller 與 Service 的互動 |
| 132 | - 驗證錯誤處理 |
| 133 | |
| 134 | **範例專案**: |
| 135 | - 電商 API(有庫存、訂單服務) |
| 136 | - CMS 系統 |
| 137 | |
| 138 | --- |
| 139 | |
| 140 | ### Level 3:完整的 WebApi 專案 |
| 141 | |
| 142 | **專案特徵**: |
| 143 | - 複雜的業務邏輯 |
| 144 | - 需要真實資料庫 |
| 145 | - 可能有外部 API 整合 |
| 146 | - 完整的錯誤處理 |
| 147 | |
| 148 | **推薦技能組合**: |
| 149 | 1. `dotnet-testing-advanced-webapi-integration-testing`(完整流程) |
| 150 | 2. `dotnet-testing-advanced-testcontainers-database`(真實資料庫) |
| 151 | 3. `dotnet-testing-advanced-testcontainers-nosql`(如有使用 NoSQL) |
| 152 | |
| 153 | **測試策略**: |
| 154 | - 使用 Testcontainers 建立真實資料庫 |
| 155 | - 完整的端到端測試 |
| 156 | - 測試資料準備與清理 |
| 157 | - 驗證所有錯誤情境 |
| 158 | |
| 159 | **範例專案**: |
| 160 | - 大型電商平台 |
| 161 | - 企業級管理系統 |
| 162 | - SaaS 應用 |
| 163 | |
| 164 | --- |
| 165 | |
| 166 | ## 學習路徑建議 |
| 167 | |
| 168 | 包含整合測試入門(1 週)、微服務測試專精(3-5 天)、框架遷移路徑等完整學習計畫與每日學習重點。 |
| 169 | |
| 170 | > 詳細內容請參閱 [references/learning-paths.md](references/learning-paths.md) |
| 171 | |
| 172 | --- |
| 173 | |
| 174 | ## 技能組合建議 |
| 175 | |
| 176 | 根據不同的專案需求,推薦以下技能組合: |
| 177 | |
| 178 | ### 組合 1:完整 API 測試專案 |
| 179 | |
| 180 | **適合**:建立正式專案的完整測試套件 |
| 181 | |
| 182 | **技能組合**: |
| 183 | 1. `dotnet-testing-advanced-aspnet-integration-testing`(基礎) |
| 184 | 2. `dotnet-testing-advanced-testcontainers-database`(真實資料庫) |
| 185 | 3. `dotnet-testing-advanced-webapi-integration-testing`(完整流程) |
| 186 | |
| 187 | **學習順序**: |
| 188 | 1. 先學 aspnet-integration-testing 理解基礎 |
| 189 | 2. 再學 testcontainers-database 掌握資料庫測試 |
| 190 | 3. 最後學 webapi-integration-testing 整合應用 |
| 191 | |
| 192 | **預期成果**: |
| 193 | - 能為 Web API 專案建立完整測試 |
| 194 | - 使用真實資料庫驗證行為 |
| 195 | - 測試所有 CRUD 端點與錯誤處理 |
| 196 | |
| 197 | --- |
| 198 | |
| 199 | ### 組合 2:微服務測試 |