單元測試設計 Agent
單元測試設計 Agent
理解既有測試風格,替方法、類別與回歸問題設計單元測試。
.NET · 官方來源 · 測試與除錯
來源狀態
可用來源
資源類型
Skill
與類似 Skill 有什麼不同?
- 系統化除錯
Code Testing Agent 著重測試案例與驗證流程;Systematic Debugging 先收斂故障原因,再決定需要的驗證。
來源描述的能力
這些是來源描述的可能操作,不代表 2lus 已授予權限或已測試。
- 讀取檔案
- 寫入檔案
- Shell 指令
這個 Skill 是什麼?
重點是找出可觀察行為與邊界並新增測試程式,不只是啟動 test runner;最新來源除 .NET 也描述其他語言框架。
可以做什麼?何時適合使用?
- 替既有 method 補缺少的邊界測試。
- 重現修復過的回歸問題。
- 為 class 的錯誤路徑建立明確斷言。
如何使用
- 提供目標程式、相鄰測試與使用的框架。
- 列出正常、邊界與錯誤情境,沿用現有 fixture 和命名。
- 產生聚焦的測試變更並說明未覆蓋部分;執行需遵守專案政策。
使用前你需要準備
- 預期與實際行為
- 去識別化錯誤紀錄和相關程式
你可以替換:
[test framework]、[failure]
環境與相依需求
- .NET 工作需 SDK 與 xUnit/MSTest/NUnit 等現有框架;其他語言需相應工具鏈。
使用範例與 Prompt
以下是 2lus 撰寫的示範需求;請替換為你有權處理的檔案與專案,不代表已執行或保證結果。
入門
沿用目前 MSTest 風格,替這個金額計算 method 設計零值與負值案例,不改 production code。
實務
替曾出現空值錯誤的 class 新增 regression test,解釋每項 assertion 為何可以抓到原始錯誤;只產生程式。
進階
檢閱現有 xUnit 測試的時間與網路相依,設計 deterministic fixtures 和失敗路徑測試,列出執行前需批准的外部操作。
實用提醒
- 先選一個方法與失敗情境,避免無邊界地追求 coverage 百分比。
限制與注意事項
- 來源亦提及 pytest、Vitest/Jest、Go;宿主的代理委派功能不保證跨客戶端可用,Codex 不等同載入 Copilot 的 .agent.md。
安全注意事項
- 禁止為了讓測試變綠而刪除斷言或改寫正式邏輯;測試若會寫資料庫或檔案需事前同意。
使用與設定
此條目不提供已確認的通用安裝指令;請依官方文件與 Agent 版本操作。
支援平台
Claude Code — 文件記載,未做實機相容性測試 官方文件 ↗
GitHub Copilot — 文件記載,未做實機相容性測試 官方文件 ↗
Codex — 文件記載,未做實機相容性測試 官方文件 ↗
來源與授權
來源查核日期(非安全認證): 2026-09-29
MIT
原始來源 ↗ 授權條款 ↗ 官方文件 ↗相關 Skills
使用第三方 Skill 前,請先檢查來源、權限與執行內容。安裝指令只供查看與複製,不會由 2lus 執行。
2lus AI Skills Library 提供 Skill 的整理與使用導覽。第三方 Skill 的內容、授權與可用性以原始來源為準。使用或安裝前,請自行確認其權限與執行內容。
Code Testing Agent
Design unit tests for existing methods, classes and regressions using project conventions.
.NET · Official source · Testing & Debugging
Source status
Active source
Resource type
Skill
How is this different from similar skills?
- Systematic Debugging
Code Testing Agent focuses on test cases and verification workflow; Systematic Debugging narrows failure causes before selecting checks.
Documented capabilities
These are operations described upstream, not permissions granted or tested by 2lus.
- Read files
- Write files
- Shell commands
What is this skill?
Identify observable behavior and boundary cases, then generate tests rather than merely invoking a runner. The current source also covers frameworks beyond .NET.
Use cases and when to use it
- Fill boundary-case gaps around a method.
- Capture a previously fixed regression.
- Assert class error paths explicitly.
How to use it
- Provide target code, neighboring tests and the framework.
- List normal, boundary and failure scenarios using existing fixtures and naming.
- Generate focused test changes and explain remaining gaps; follow project policy before execution.
What you need
- Expected and actual behavior
- Redacted errors and relevant code
You can replace:
[test framework], [failure]
Environment and dependencies
- .NET work needs its SDK and existing xUnit/MSTest/NUnit framework; other languages need their matching toolchains.
Usage and prompt examples
These example requests were written by 2lus. Substitute files and projects you may use; examples are not executed results or guarantees.
Beginner
Follow this project’s MSTest style to design zero and negative amount cases for the method. Do not change production code.
Practical
Add a regression test for the class’s former null-handling bug. Explain how each assertion catches the original failure; generate code only.
Advanced
Review time and network dependencies in our xUnit suite. Design deterministic fixtures and failure-path tests, listing external actions needing approval.
Tips
- Start with one method and failure scenario rather than an unbounded coverage target.
Limitations
- Upstream also describes pytest, Vitest/Jest and Go. Host-specific delegation is not portable; Codex does not load Copilot .agent.md agents equivalently.
Security notes
- Never delete assertions or rewrite production behavior to turn tests green; database/file mutations require authorization.
Usage and setup
No verified universal installation command is provided for this entry. Follow the official documentation for your agent version.
Supported agents
Claude Code — Documented; not runtime-tested Documentation ↗
GitHub Copilot — Documented; not runtime-tested Documentation ↗
Codex — Documented; not runtime-tested Documentation ↗
Sources and license
Source check date (not a safety certification): 2026-09-29
MIT
Original source ↗ License terms ↗ Documentation ↗Related skills
Before using a third-party skill, review its source, permissions and executable content. Commands are for viewing and copying only; 2lus does not execute them.
2lus AI Skills Library provides curated educational guides. Third-party content, licenses and availability are governed by their original sources. Review permissions and executable content before use or installation.