xiaohongshu
xiaohongshu
dotnet-testing-advanced
.NET 進階測試技能總覽與引導中心。當使用者詢問「整合測試」、「API 測試」、「容器化測試」、「微服務測試」、「測試框架遷移」、「Testcontainers」、「Aspire 測試」等進階測試需求時觸發。會根據具體需求推薦適合的子技能組合,涵蓋整合測試、Testcontainers、Aspire 測試、框架升級等 8 個進階技能。 Keywords: integration testing, 整合測試, API testing, advanced testing, 進階測試, testcontainers, aspire testing, WebApplicationFactory...
Full skill instructions
當您(AI Agent)被載入此進階入口 skill 時,請先閱讀以下指引:
本檔案是「進階測試導航中心」,用於幫助找到正確的進階子技能。
Skill tool 載入具體的子技能使用者提到的關鍵字 → 應載入的進階子技能
| 使用者說... | 載入指令 | 用途說明 |
|---|---|---|
| API 測試、Controller 測試、端點測試 | /skill dotnet-testing-advanced-aspnet-integration-testing | 基礎 API 整合測試 |
| 完整 CRUD、WebAPI 測試、業務流程測試 | /skill dotnet-testing-advanced-webapi-integration-testing | 完整 API 流程測試 |
| WebApplicationFactory、TestServer | /skill dotnet-testing-advanced-aspnet-integration-testing | WebApplicationFactory 使用 |
| 使用者說... | 載入指令 | 用途說明 |
|---|---|---|
| SQL Server 容器、PostgreSQL、MySQL | /skill dotnet-testing-advanced-testcontainers-database | 關聯式資料庫容器測試 |
| MongoDB、Redis、Elasticsearch | /skill dotnet-testing-advanced-testcontainers-nosql | NoSQL 資料庫容器測試 |
| 真實資料庫、EF Core 測試、Dapper 測試 | /skill dotnet-testing-advanced-testcontainers-database | 真實資料庫行為測試 |
| Testcontainers、容器測試、Docker 測試 | /skill dotnet-testing-advanced-testcontainers-database | Testcontainers 基礎 |
| 使用者說... | 載入指令 | 用途說明 |
|---|---|---|
| .NET Aspire、微服務測試、分散式測試 | /skill dotnet-testing-advanced-aspire-testing | Aspire 微服務測試 |
| DistributedApplication、服務間通訊 | /skill dotnet-testing-advanced-aspire-testing | Aspire 應用測試 |
| 使用者說... | 載入指令 | 用途說明 |
|---|---|---|
| xUnit 升級、xUnit 3.x、版本升級 | /skill dotnet-testing-advanced-xunit-upgrade-guide | xUnit 2.x → 3.x 升級 |
| TUnit、新測試框架、TUnit 基礎 | /skill dotnet-testing-advanced-tunit-fundamentals | TUnit 基礎與遷移 |
| TUnit 進階、TUnit DI、平行執行 | /skill dotnet-testing-advanced-tunit-advanced | TUnit 進階功能 |
使用者:請幫我建立 ProductsController 的 API 整合測試
AI:我注意到您需要進行 API 整合測試。根據快速對照表,
我應該載入 dotnet-testing-advanced-aspnet-integration-testing skill。
[使用 Skill tool 載入子技能]
AI:現在按照 ASP.NET Core Integration Testing skill 的指引為您建立測試...
使用者:請幫我建立 ProductsController 的 API 整合測試
AI:好的,我來寫整合測試...(直接開始寫程式碼,沒有載入子技能)
如需查看完整的 8 個進階技能清單、詳細決策樹、學習路徑建議,請繼續閱讀本檔案後續內容。
人類開發者參考:如需快速查找,請查看 SKILLS_QUICK_INDEX.md
當您需要以下進階測試能力時,我會協助您找到正確的技能:
選項 A - 基礎 API 測試
→ dotnet-testing-advanced-aspnet-integration-testing
適合:
涵蓋內容:
選項 B - 完整的 WebAPI 流程測試
→ dotnet-testing-advanced-webapi-integration-testing
適合:
涵蓋內容:
選項 A - 關聯式資料庫(SQL Server、PostgreSQL、MySQL)
→ dotnet-testing-advanced-testcontainers-database
適合:
支援資料庫:
選項 B - NoSQL 資料庫(MongoDB、Redis、Elasticsearch)
→ dotnet-testing-advanced-testcontainers-nosql
適合:
支援資料庫:
→ dotnet-testing-advanced-aspire-testing
適合:
涵蓋內容:
選項 A - xUnit 升級(2.x → 3.x)
→ dotnet-testing-advanced-xunit-upgrade-guide
適合:
涵蓋內容:
選項 B - 遷移到 TUnit(基礎)
→ dotnet-testing-advanced-tunit-fundamentals
適合:
涵蓋內容:
選項 C - TUnit 進階功能
→ dotnet-testing-advanced-tunit-advanced
適合:
涵蓋內容:
| 技能名稱 | 測試範圍 | 資料庫 | 適用場景 |
|---|---|---|---|
dotnet-testing-advanced-aspnet-integration-testing | WebApplicationFactory、TestServer、HTTP 回應 | 記憶體資料庫 | 基礎 API 整合測試 |
dotnet-testing-advanced-webapi-integration-testing | 完整 CRUD、錯誤處理、業務流程 | 記憶體/真實 | 真實 API 專案測試 |
dotnet-testing-advanced-testcontainers-database | SQL Server、PostgreSQL、MySQL | 真實(容器化) | 需要真實資料庫行為 |
dotnet-testing-advanced-testcontainers-nosql | MongoDB、Redis、Elasticsearch | 真實(容器化) | NoSQL 資料庫測試 |
aspnet-integration-testing
核心價值:
適合情境:
學習難度:⭐⭐ 中等
前置技能:
dotnet-testing-unit-test-fundamentals(必須)dotnet-testing-awesome-assertions-guide(建議)webapi-integration-testing
核心價值:
適合情境:
學習難度:⭐⭐⭐ 中高
前置技能:
dotnet-testing-advanced-aspnet-integration-testing(必須)dotnet-testing-nsubstitute-mocking(建議)testcontainers-database
核心價值:
適合情境:
學習難度:⭐⭐⭐ 中高
前置技能:
dotnet-testing-unit-test-fundamentals(必須)技術需求:
testcontainers-nosql
核心價值:
適合情境:
學習難度:⭐⭐⭐ 中高
前置技能:
dotnet-testing-advanced-testcontainers-database(建議)| 技能名稱 | 測試範圍 | 架構 | 適用場景 |
|---|---|---|---|
dotnet-testing-advanced-aspire-testing | .NET Aspire 分散式應用 | 微服務 | 雲原生、微服務架構 |
aspire-testing
核心價值:
適合情境:
學習難度:⭐⭐⭐⭐ 高
前置技能:
dotnet-testing-advanced-aspnet-integration-testing(必須)dotnet-testing-advanced-testcontainers-database(建議)技術需求:
涵蓋內容:
| 技能名稱 | 遷移路徑 | 難度 | 適用場景 |
|---|---|---|---|
dotnet-testing-advanced-xunit-upgrade-guide | xUnit 2.x → 3.x | ⭐⭐ 中等 | 升級現有 xUnit 專案 |
dotnet-testing-advanced-tunit-fundamentals | xUnit → TUnit(基礎) | ⭐⭐ 中等 | 評估或遷移到 TUnit |
dotnet-testing-advanced-tunit-advanced | TUnit 進階功能 | ⭐⭐⭐ 中高 | 深入使用 TUnit |
xunit-upgrade-guide
核心價值:
適合情境:
學習難度:⭐⭐ 中等
涵蓋內容:
何時升級:
tunit-fundamentals
核心價值:
適合情境:
學習難度:⭐⭐ 中等
涵蓋內容:
TUnit 優勢:
tunit-advanced
核心價值:
適合情境:
學習難度:⭐⭐⭐ 中高
前置技能:
dotnet-testing-advanced-tunit-fundamentals(必須)涵蓋內容:
情境:為簡單的 ProductsController 建立整合測試
推薦技能:
dotnet-testing-advanced-aspnet-integration-testing適用條件:
實施步驟:
提示詞範例:
請使用 dotnet-testing-advanced-aspnet-integration-testing skill
為我的 ProductsController 建立整合測試。Controller 有 GetAll 和 GetById 兩個端點。
預期程式碼結構:
public class ProductsControllerTests : IClassFixture<CustomWebApplicationFactory>
{
private readonly HttpClient _client;
public ProductsControllerTests(CustomWebApplicationFactory factory)
{
_client = factory.CreateClient();
}
[Fact]
public async Task GetAll_ShouldReturnProducts()
{
// Act
var response = await _client.GetAsync("/api/products");
// Assert
response.Should().Be200Ok();
var products = await response.Content.ReadFromJsonAsync<List<Product>>();
products.Should().NotBeEmpty();
}
}
情境:為 ShippersController 建立完整的 CRUD 測試
推薦技能:
dotnet-testing-advanced-webapi-integration-testing適用條件:
實施步驟:
提示詞範例:
請使用 dotnet-testing-advanced-webapi-integration-testing skill
為我的 ShippersController 建立完整的 CRUD 測試。需要測試:
- GET /api/shippers(取得所有)
- GET /api/shippers/{id}(取得單一)
- POST /api/shippers(新增)
- PUT /api/shippers/{id}(更新)
- DELETE /api/shippers/{id}(刪除)
並且驗證錯誤情境(如找不到資源)。
預期測試涵蓋:
情境:測試 OrderRepository(使用 SQL Server)
推薦技能:
dotnet-testing-advanced-testcontainers-database適用條件:
實施步驟:
提示詞範例:
請使用 dotnet-testing-advanced-testcontainers-database skill
為我的 OrderRepository 建立測試。Repository 使用 EF Core 連接 SQL Server。
需要測試 GetById、Create、Update、Delete 方法。
預期程式碼結構:
public class OrderRepositoryTests : IAsyncLifetime
{
private MsSqlContainer _container;
private OrderDbContext _context;
private OrderRepository _sut;
public async Task InitializeAsync()
{
// 啟動 SQL Server 容器
_container = new MsSqlBuilder().Build();
await _container.StartAsync();
// 建立 DbContext
var options = new DbContextOptionsBuilder<OrderDbContext>()
.UseSqlServer(_container.GetConnectionString())
.Options;
_context = new OrderDbContext(options);
await _context.Database.MigrateAsync();
_sut = new OrderRepository(_context);
}
[Fact]
public async Task GetById_ExistingOrder_ShouldReturnOrder()
{
// Arrange
var order = new Order { /* ... */ };
await _context.Orders.AddAsync(order);
await _context.SaveChangesAsync();
// Act
var result = await _sut.GetById(order.Id);
// Assert
result.Should().NotBeNull();
result.Id.Should().Be(order.Id);
}
public async Task DisposeAsync()
{
await _container.DisposeAsync();
}
}
情境:測試 CacheService(使用 Redis)
推薦技能:
dotnet-testing-advanced-testcontainers-nosql適用條件:
實施步驟:
提示詞範例:
請使用 dotnet-testing-advanced-testcontainers-nosql skill
為我的 CacheService 建立測試。Service 使用 Redis 做快取。
需要測試 Set、Get、Remove 以及過期時間。
預期測試涵蓋:
情境:測試 .NET Aspire 微服務專案
推薦技能:
dotnet-testing-advanced-aspire-testing適用條件:
實施步驟:
提示詞範例:
請使用 dotnet-testing-advanced-aspire-testing skill
為我的 .NET Aspire 專案建立測試。專案包含 API Service 和 Worker Service。
需要測試兩個服務的協作。
情境:現有專案使用 xUnit 2.9.x,想升級到 3.x
推薦技能:
dotnet-testing-advanced-xunit-upgrade-guide實施步驟:
提示詞範例:
請使用 dotnet-testing-advanced-xunit-upgrade-guide skill
協助我升級專案中的 xUnit 到 3.x 版本。目前使用 2.9.2。
情境:考慮從 xUnit 遷移到 TUnit
推薦技能:
dotnet-testing-advanced-tunit-fundamentals(了解基礎)dotnet-testing-advanced-tunit-advanced(評估進階功能)實施步驟:
提示詞範例:
請使用 dotnet-testing-advanced-tunit-fundamentals skill
評估是否應將專案從 xUnit 遷移到 TUnit。專案目前有 500+ 測試。
根據專案複雜度,選擇適合的測試策略:
專案特徵:
推薦技能:
dotnet-testing-advanced-aspnet-integration-testing測試重點:
範例專案:
專案特徵:
推薦技能組合:
dotnet-testing-advanced-aspnet-integration-testing(基礎)dotnet-testing-nsubstitute-mocking(模擬依賴)測試策略:
範例專案:
專案特徵:
推薦技能組合:
dotnet-testing-advanced-webapi-integration-testing(完整流程)dotnet-testing-advanced-testcontainers-database(真實資料庫)dotnet-testing-advanced-testcontainers-nosql(如有使用 NoSQL)測試策略:
範例專案:
目標:掌握整合測試基礎,能為 Web API 建立測試
技能:dotnet-testing-advanced-aspnet-integration-testing
學習重點:
實作練習:
技能:dotnet-testing-advanced-webapi-integration-testing
學習重點:
實作練習:
技能:dotnet-testing-advanced-testcontainers-database
學習重點:
實作練習:
技能:dotnet-testing-advanced-testcontainers-nosql
學習重點:
實作練習:
前置條件:完成整合測試入門
技能:dotnet-testing-advanced-aspire-testing
學習重點:
實作練習:
技能:dotnet-testing-advanced-xunit-upgrade-guide
學習重點:
實施步驟:
基礎(2-3 天)
技能:dotnet-testing-advanced-tunit-fundamentals
學習重點:
進階(2-3 天)
技能:dotnet-testing-advanced-tunit-advanced
學習重點:
根據不同的專案需求,推薦以下技能組合:
適合:建立正式專案的完整測試套件
技能組合:
dotnet-testing-advanced-aspnet-integration-testing(基礎)dotnet-testing-advanced-testcontainers-database(真實資料庫)dotnet-testing-advanced-webapi-integration-testing(完整流程)學習順序:
預期成果:
適合:微服務架構、分散式系統
技能組合:
dotnet-testing-advanced-aspire-testing(核心)dotnet-testing-advanced-testcontainers-database(資料庫)dotnet-testing-advanced-testcontainers-nosql(NoSQL)學習順序:
預期成果:
適合:測試框架升級或遷移
技能:
dotnet-testing-advanced-xunit-upgrade-guide適合:
技能組合:
dotnet-testing-advanced-tunit-fundamentals(基礎)dotnet-testing-advanced-tunit-advanced(進階)適合:
學習順序:
學習進階技能前,建議先掌握以下基礎技能(來自 dotnet-testing 基礎技能集):
為什麼必須:
為什麼必須:
為什麼必須:
為什麼推薦:
為什麼推薦:
以下範例展示 AI 如何與您互動,幫助您選擇正確的進階技能。
您:我想測試 Web API
AI:我會協助您建立 Web API 測試!請先確認您的測試需求:
1. API 複雜度:
2. 資料庫需求:
3. 資料庫類型(如需要真實資料庫):
請告訴我您的選擇,我會推薦適合的技能組合。
您:中型 API,需要真實的 SQL Server 資料庫
AI:完美!根據您的需求,我推薦以下技能組合:
第一步:學習基礎整合測試(1-2 天)
dotnet-testing-advanced-aspnet-integration-testing
第二步:加入真實資料庫(2 天)
dotnet-testing-advanced-testcontainers-database
第三步:完整流程測試(2-3 天)
dotnet-testing-advanced-webapi-integration-testing
預期成果: 完成後您將能夠為 API 專案建立完整的整合測試套件,使用真實的 SQL Server 資料庫驗證行為。
需要我使用這些 skills 協助您開始嗎?
您:我的專案是 .NET Aspire 微服務架構,要怎麼測試?
AI:.NET Aspire 微服務測試需要特殊的方法!我推薦使用 dotnet-testing-advanced-aspire-testing skill。
前置確認:
您已安裝 .NET Aspire Workload?
dotnet workload install aspire您的專案有哪些服務?
是否使用資料庫?
dotnet-testing-advanced-testcontainers-database測試重點:
需要我使用 dotnet-testing-advanced-aspire-testing skill 協助您建立測試嗎?
您:我的專案使用 xUnit 2.9,應該升級到 3.x 嗎?
AI:這是個好問題!我會協助您評估。讓我先了解您的情況:
1. 升級動機:
2. 專案規模:
3. 升級時程壓力:
您:中型專案,主要是想跟上最新版本,不急
AI:了解!我推薦使用 dotnet-testing-advanced-xunit-upgrade-guide skill。
升級計劃:
階段 1:了解差異(1 天)
階段 2:準備升級(半天)
階段 3:處理相容性(1-2 天)
總工時估計:2-3 天
風險評估:⭐⭐ 中低 xUnit 3.x 升級通常很順利,大部分變更都有向後相容。
需要我使用 dotnet-testing-advanced-xunit-upgrade-guide skill 協助您開始升級嗎?
您:我聽說 TUnit 很不錯,應該遷移嗎?
AI:TUnit 確實是很有潛力的測試框架!讓我協助您評估。
TUnit 主要優勢:
評估重點:
1. 專案狀況:
2. 團隊技能:
3. 遷移成本:
我的建議:
如果是新專案:
使用 dotnet-testing-advanced-tunit-fundamentals skill 了解 TUnit,考慮直接採用。
如果是現有專案:
dotnet-testing-advanced-tunit-fundamentals 了解基礎需要我協助您評估嗎?
進階技能建立在基礎技能之上:
基礎測試能力 → dotnet-testing(基礎技能集)
↓ 進階應用
進階整合測試 → dotnet-testing-advanced(本技能集)
學習建議:
先完成 dotnet-testing 基礎技能集的核心技能,再進入本進階技能集。
iThome 鐵人賽系列文章:老派軟體工程師的測試修練 - 30 天挑戰 🏆 2025 iThome 鐵人賽 Software Development 組冠軍
完整範例程式碼:30Days_in_Testing_Samples 包含所有範例專案的可執行程式碼
整合測試技能:
Aspire 測試技能:
選擇符合您需求的進階技能開始學習,或告訴我您的具體情況,我會推薦最適合的學習路徑!
快速開始:
dotnet-testing-advanced-aspnet-integration-testing 開始dotnet-testing-advanced-testcontainers-database 開始dotnet-testing-advanced-aspire-testingxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience