Testing pyramid and test writing standards for UT/IT/ST/E2E. Use when: writing tests, discussing test coverage, test strategy, or test naming. Keywords: test, unit, integration, e2e, coverage, mock, 測試, 單元, 整合, 端對端.
This skill provides testing pyramid standards and best practices for systematic testing.
┌─────────┐
│ E2E │ ← Fewer, slower (3%)
─┴─────────┴─
┌─────────────┐
│ ST │ ← System (7%)
─┴─────────────┴─
┌─────────────────┐
│ IT │ ← Integration (20%)
─┴─────────────────┴─
┌─────────────────────┐
│ UT │ ← Unit (70%)
└─────────────────────┘
| Level | Scope | Speed | Dependencies | |-------|-------|-------|-------------| | UT | Single function/class | < 100ms | Mocked | | IT | Component interaction | 1-10s | Real DB (containerized) | | ST | Full system | Minutes | Production-like | | E2E | User journeys | 30s+ | Everything real |
| Metric | Minimum | Recommended | |--------|---------|-------------| | Line | 70% | 85% | | Branch | 60% | 80% | | Function | 80% | 90% |
For complete standards, see:
[ClassName]Tests.cs # C#
[ClassName].test.ts # TypeScript
[class_name]_test.py # Python
[class_name]_test.go # Go
[MethodName]_[Scenario]_[ExpectedResult]()
should_[behavior]_when_[condition]()
test_[method]_[scenario]_[expected]()
| Type | Purpose | When to Use | |------|---------|-------------| | Stub | Returns predefined values | Fixed API responses | | Mock | Verifies interactions | Check method called | | Fake | Simplified implementation | In-memory database | | Spy | Records calls, delegates | Partial mocking |
test('method_scenario_expected', () => {
// Arrange - Setup test data
const input = createTestInput();
const sut = new SystemUnderTest();
// Act - Execute behavior
const result = sut.execute(input);
// Assert - Verify result
expect(result).toBe(expected);
});
This skill supports project-specific configuration.
CONTRIBUTING.md for "Disabled Skills" section
CONTRIBUTING.md for "Testing Standards" sectionIf no configuration found and context is unclear:
CONTRIBUTING.md:## Testing Standards
### Coverage Targets
| Metric | Target |
|--------|--------|
| Line | 80% |
| Branch | 70% |
| Function | 85% |
In project's CONTRIBUTING.md:
## Testing Standards
### Coverage Targets
| Metric | Target |
|--------|--------|
| Line | 80% |
| Branch | 70% |
| Function | 85% |
### Testing Framework
- Unit Tests: Jest
- Integration Tests: Supertest
- E2E Tests: Playwright
License: CC BY 4.0 | Source: universal-dev-standards
npx skills add AsiaOstrich/testing-guide下载完整 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