Generates xUnit tests for C#/.NET ABP Framework code using NSubstitute and Shouldly. Use when the user asks to generate tests, create test coverage, write unit tests, write integration tests, fill coverage gaps, or test a class or file. Supports AppServices, Validators, and HTTP API Controllers.
Generate xUnit tests for C#/.NET ABP Framework projects.
# Analyze source and generate tests
python scripts/generate_tests.py src/MyAppService.cs --type unit
Copy this checklist and track progress:
Test Generation Progress:
- [ ] Step 1: Locate source file
- [ ] Step 2: Analyze public methods and dependencies
- [ ] Step 3: Select template based on source type
- [ ] Step 4: Generate test file
- [ ] Step 5: Validate generated tests compile
Step 1: Locate source
| Input | Action |
|-------|--------|
| File path | Read directly |
| Class name | find api/src -name "*ClassName*.cs" -type f |
| gaps | Run scripts/find_coverage_gaps.py |
Step 2: Analyze source
Extract from each public method:
Substitute.For<T>()[Authorize] attributes → add 401/403 test casesStep 3: Select template
| Source Pattern | Reference |
|----------------|-----------|
| *AppService.cs | See reference/appservice-tests.md |
| *Validator.cs | See reference/validator-tests.md |
| *Controller.cs | See reference/integration-tests.md |
Step 4: Generate and write
Output locations:
api/test/[Module].Application.Tests/[Class]Tests.csapi/test/[Module].HttpApi.Tests/[Class]IntegrationTests.csStep 5: Validate
dotnet build api/test/[Module].Application.Tests/
If build fails, fix compilation errors and rebuild.
Use pattern: [Method]_[Scenario]_[Expected]
| Example | Meaning |
|---------|---------|
| Create_ValidInput_ReturnsDto | Happy path |
| Create_MissingName_ThrowsValidation | Validation failure |
| Get_NotFound_ThrowsException | Entity not found |
| Delete_Unauthorized_Returns403 | Permission denied |
npx skills add thapaliyabikendra/generating-tests下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer