

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
12345678910# Testing Strategy & Test Generation Protocol1112## Objective1314Guide Cline to proactively generate, maintain, and improve test suites as a first-class development activity — not an afterthought. Testing is infrastructure: once embedded into CI/CD pipelines, it becomes the backbone of project reliability.1516---1718## Core Directive1920You **MUST** treat tests as mandatory deliverables. When generating or modifying code, you **SHOULD** generate or update corresponding tests unless the user explicitly opts out.2122Before using `attempt_completion`, verify:23- [ ] New/modified code has corresponding test coverage24- [ ] Tests pass (or user has been informed of expected failures)25- [ ] Edge cases and error paths are covered2627---2829## 1. Test Pyramid Strategy3031Follow the test pyramid to allocate effort appropriately:3233```34 / E2E \ <- Few, slow, high-confidence35 /----------\36 / Integration \ <- Moderate, test boundaries37 /----------------\38 / Unit Tests \ <- Many, fast, isolated39 /____________________\40```4142### Unit Tests (Foundation — 70% of tests)43- Test individual functions, methods, and classes in isolation44- Mock external dependencies (databases, APIs, file system)45- **MUST** be fast (< 100ms each)46- **MUST** be deterministic — no flaky tests4748### Integration Tests (Middle — 20% of tests)49- Test interactions between modules, services, or layers50- Use real dependencies where practical (test databases, in-memory stores)51- Verify API contracts, database queries, and service boundaries5253### End-to-End Tests (Top — 10% of tests)54- Test critical user journeys through the full stack55- Use sparingly — they are slow and brittle56- Focus on happy paths and critical business flows5758---5960## 2. Test-Driven Development (TDD) Workflow6162When the user requests TDD or when building new features:6364```651. RED -> Write a failing test that defines the desired behavior662. GREEN -> Write the minimum code to make the test pass673. REFACTOR -> Clean up code while keeping tests green684. REPEAT69```7071**MUST** present each step clearly to the user. Do not skip ahead.7273---7475## 3. Framework-Specific Patterns7677### JavaScript/TypeScript (Jest / Vitest)78```typescript79describe('UserService', () => {80 describe('createUser', () => {81 it('should create a user with valid input', async () => {82 const user = await userService.createUser({ name: 'Alice', email: 'alice@example.com' });83 expect(user.id).toBeDefined();84 expect(user.name).toBe('Alice');85 });8687 it('should throw on duplicate email', async () => {88 await userService.createUser({ name: 'Alice', email: 'alice@example.com' });89 await expect(90 userService.createUser({ name: 'Bob', email: 'alice@example.com' })91 ).rejects.toThrow('Email already exists');92 });9394 it('should reject invalid email format', async () => {95 await expect(96 userService.createUser({ name: 'Alice', email: 'not-an-email' })97 ).rejects.toThrow('Invalid email');98 });99 });100});101```102103### Python (pytest)104```python105import pytest106from services.user_service import UserService107108class TestUserService:109 def test_create_user_with_valid_input(self, user_service):110 user = user_service.create_user(name="Alice", email="alice@example.com")111 assert user.id is not None112 assert user.name == "Alice"113114 def test_create_user_duplicate_email_raises(self, user_service):115 user_service.create_user(name="Alice", email="alice@example.com")116 with pytest.raises(ValueError, match="Email already exists"):117 user_service.create_user(name="Bob", email="alice@example.com")118119 def test_create_user_invalid_email_raises(self, user_service):120 with pytest.raises(ValueError, match="Invalid email"):121 user_service.create_user(name="Alice", email="not-an-email")122```123124### C# (xUnit)125```csharp126public class UserServiceTests127{128 [Fact]129 public async Task CreateUser_WithValidInput_ReturnsUser()130 {131 var service = new UserService(mockRepo.Object);132 var user = await service.CreateUserAsync("Alice", "alice@example.com");133 Assert.NotNull(user.Id);134 Assert.Equal("Alice", user.Name);135 }136137 [Fact]138 public async Task CreateUser_DuplicateEmail_ThrowsException()139 {140 var service = new UserService(mockRepo.Object);141 await service.CreateUserAsync("Alice", "alice@example.com");142 await Assert.ThrowsAsync<DuplicateEmailException>(143 () => service.CreateUserAsync("Bob", "alice@example.com"));144 }145}146```147148---149150## 4. What to Test — Mandatory Coverage Areas151152For every function or module, **MUST** consider:153154| Category | Examples |155|----------|----------|156| **Happy path** | Valid inputs produce expected outputs |157| **Edge cases** | Empty strings, zero, null, boundary values, max-length |158| **Error handling** | Invalid inputs, network failures, timeouts, permission errors |159| **State transitions** | Before/after mutations, side effects |160| **Concurrency** | Race conditions, parallel execution (when applicable) |161162---163164## 5. Mocking & Test Doubles Strategy165166- **MUST** mock external services (APIs, databases, file system) in unit tests167- **SHOULD** use dependency injection to make code testable168- **MUST NOT** mock the system under test — only its dependencies169- **SHOULD** prefer fakes over mocks when the dependency is complex170171```172Stub -> Returns canned data (simplest)173Mock -> Verifies interactions (use sparingly)174Fake -> Simplified working implementation (e.g., in-memory DB)175Spy -> Records calls for later assertion176```177178---179180## 6. Test Quality Checklist181182Before completing any testing task, verify:183184- [ ] **Descriptive names**: Test names describe the scenario, not the implementation (`should_reject_expired_token` not `test1`)185- [ ] **Arrange-Act-Assert**: Each test follows the AAA pattern clearly186- [ ] **One assertion per concept**: Tests verify one behavior (multiple `expect` calls are fine if they verify one logical outcome)187- [ ] **No test interdependence**: Tests can run in any order188- [ ] **No hardcoded sleep/delays**: Use polling, events, or test clocks189- [ ] **Meaningful assertions**: Assert specific values, not just "no error thrown"190191---192193## 7. Coverage Analysis194195When asked about coverage or when completing a testing task:196197- **SHOULD** suggest running coverage tools (`jest --coverage`, `pytest --cov`, `dotnet test --collect:"XPlat Code Coverage"`)198- **Target**: 80%+ line coverage for business logic, 90%+ for critical paths199- **MUST NOT** chase 100% — focus on meaningful coverage, not vanity metrics200- Uncovered code **SHOULD** be flagged with rationale (e.g., "UI rendering — covered by E2E tests")201202---203204## 8. CI/CD Integration Guidance205206When setting up or advising on CI/CD:207208- Tests **MUST** run on every PR/push209- Fast unit tests run first; slow integration/E2E tests run after210- Failed tests **MUST** block merge211- Coverage reports **SHOULD** be posted as PR comments212- Flaky tests **MUST** be quarantined and fixed, not ignored213214<!--215Enterprise Considerations:216- Team-wide configurable coverage thresholds enforced across all repositories217- Test health dashboards showing pass rates, flakiness trends, and coverage gaps218- Shared test fixture and pattern libraries distributed across teams219- Automated test quality scoring and team benchmark comparisons220-->221
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| cline/prompts.clinerules/ai-dlc-adaptive-workflow.md · 1.2k | Cline rules | agent-behaviour | 54/100 | today | |
| cline/prompts.clinerules/audio-plugin-developer.md · 1.2k | Cline rules | styleperformancedo-notagent-behaviour | 57/100 | today | |
| cline/prompts.clinerules/ba.md · 1.2k | Cline rules | archgitagent-behaviour | 50/100 | today | |
| cline/prompts.clinerules/baby-steps.md · 1.2k | Cline rules | do-notagent-behaviour | 50/100 | today | |
| cline/prompts.clinerules/c#-guide.md · 1.2k | Cline rules | style | 27/100 | today | |
| cline/prompts.clinerules/claude-code-subagents.md · 1.2k | Cline rules | testarchdo-notagent-behaviour | 77/100 | today | |
| cline/prompts.clinerules/cline-architecture.md · 1.2k | Cline rules | archtypesapi | 54/100 | today | |
| cline/prompts.clinerules/cline-continuous-improvement-protocol.md · 1.2k | Cline rules | testgitperformance | 58/100 | today | |
| cline/prompts.clinerules/cline-for-research.md · 1.2k | Cline rules | agent-behaviour | 34/100 | today | |
| cline/prompts.clinerules/cline-for-slides.md · 1.2k | Cline rules | setupbuildstylearch+1 | 86/100 | today | |
| cline/prompts.clinerules/cline-for-webdev-ui.md · 1.2k | Cline rules | archagent-behaviour | 58/100 | today | |
| cline/prompts.clinerules/code-review.md · 1.2k | Cline rules | lint-formatgitsecurityperformance | 48/100 | today | |
| cline/prompts.clinerules/codebase-onboarding.md · 1.2k | Cline rules | lint-formatstylearchdependencies | 56/100 | today | |
| cline/prompts.clinerules/comprehensive-slide-dev-guide.md · 1.2k | Cline rules | buildarchtypesui | 62/100 | today | |
| cline/prompts.clinerules/create-documentation.md · 1.2k | Cline rules | apidocs | 44/100 | today | |
| cline/prompts.clinerules/gemini-comprehensive-software-engineering-guide.md · 1.2k | Cline rules | buildstyletesting-strategysecurity+4 | 36/100 | today | |
| cline/prompts.clinerules/general-development-rules.md · 1.2k | Cline rules | stylegitdeploymentdo-not | 73/100 | today | |
| cline/prompts.clinerules/google-apps-script-developer.md · 1.2k | Cline rules | setupstylegitsecurity+3 | 66/100 | today | |
| cline/prompts.clinerules/helm-chart-developer.md · 1.2k | Cline rules | setuplint-formatstylearch+6 | 81/100 | today | |
| cline/prompts.clinerules/mcp-development-protocol.md · 1.2k | Cline rules | setupteststyle | 73/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/cline-prompts-clinerules-testing-strategy)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.