Overview
Domain specialist for testing strategies, test frameworks, TDD/BDD methodologies, and quality assurance. Expertise includes unit testing, integration testing, end-to-end testing, test doubles (mocks, stubs, fakes), test pyramid, coverage strategies, and test quality assessment.
Trigger Words
- testing, test, unit test, integration test, e2e test
- TDD, BDD, test-driven, behavior-driven
- mock, stub, fake, test double
- coverage, test coverage
- PHPUnit, Jest, PyTest, RSpec, Cypress, Playwright
- test pyramid, test smells, test quality
Detection
Framework Detection
PHP:
- PHPUnit (
phpunit.xml, tests/ directory, use PHPUnit\Framework\TestCase)
- Pest (
Pest.php, use PHPUnit\Framework\TestCase with test() functions)
- Codeception (
codeception.yml, _support/ directory)
- Behat/Gherkin (
.feature files, FeatureContext.php)
JavaScript/TypeScript:
- Jest (
__tests__/, *.test.js, *.spec.js, jest.config.js)
- Mocha (
describe(), it(), before(), after())
- Vitest (
vitest.config.ts, import { test, expect } from 'vitest')
- Jasmine (
describe(), it(), spyOn())
- Cucumber.js (
.feature files)
- Cypress (
cypress/, cy. commands)
- Playwright (
playwright.config.ts, test(), page.)
- Puppeteer (
puppeteer imports, page.evaluate())
Python:
- PyTest (
conftest.py, def test_, @pytest.fixture)
- unittest (
unittest.TestCase, self.assertEqual())
- Nose2 (
nose2.cfg)
- Behave (
.feature files, behave command)
- Locust (locustfile.py,
@task)
- Robot Framework (
.robot files)
Ruby:
- RSpec (
spec/ directory, describe(), it(), expect().to)
- Minitest (
test/ directory, class Test* < Minitest::Test)
- Cucumber (
.feature files, Given/When/Then)
Go:
- testing (
_test.go, func Test*, testing.T)
- testify (
assert.Equal(), testify/suite)
- ginkgo (
Describe(), It())
Java:
- JUnit (
@Test, org.junit.jupiter.api.Test)
- TestNG (
@Test, org.testng.annotations.Test)
- Mockito (
Mockito.mock(), when().thenReturn())
C#:
- NUnit (
[Test], Assert.AreEqual())
- xUnit (
[Fact], [Theory], Assert.Equal())
- Moq (
Mock<T>(), .Setup())
Mode Detection
Write Mode (Progressive Guidance)
Trigger: mode=write or no explicit testing task
Load Progressive Files:
TEST-PYRAMID.md - Understand testing strategy
AAA-PATTERNS.md - Learn test structure
UNIT-TESTING.md - Unit testing fundamentals
TEST-FRAMEWORKS.md - Framework-specific guidance
Behavior:
- Provide concise examples
- Focus on getting started quickly
- Progressive complexity (simple → advanced)
- Framework-specific guidance
Review Mode (Exhaustive Checklists)
Trigger: mode=review, "review tests", "audit tests", "check test quality", "assess testing"
Load Review Files:
TEST-QUALITY.md - Quality assessment checklist
TEST-SMELLS.md - Test anti-patterns detection
COVERAGE.md - Coverage metrics and thresholds
COVERAGE-STRATEGIES.md - Coverage strategy assessment
Behavior:
- Exhaustive review checklists
- Identify test smells
- Coverage analysis
- Quality metrics
- Gap identification
Skill Loading Strategy
Initial Load
function loadTestingEngineeringSkill(context) {
const mode = context.mode || 'write';
if (mode === 'review') {
// Load review-mode files
loadProgressive([
'TEST-QUALITY.md',
'TEST-SMELLS.md',
'COVERAGE.md',
'COVERAGE-STRATEGIES.md'
]);
} else {
// Load write-mode files
loadProgressive([
'TEST-PYRAMID.md',
'AAA-PATTERNS.md',
'UNIT-TESTING.md',
'TEST-FRAMEWORKS.md'
]);
}
// Always load core concepts based on query keywords
if (context.query.match(/tdd|test-driven/i)) {
load('TDD.md');
}
if (context.query.match(/bdd|behavior-driven|cucumber|behave|gherkin/i)) {
load('BDD.md');
}
if (context.query.match(/mock|stub|fake|test-double/i)) {
loadProgressive(['TEST-DOUBLES.md', 'MOCKING.md']);
}
if (context.query.match(/coverage/i)) {
loadProgressive(['COVERAGE.md', 'COVERAGE-STRATEGIES.md']);
}
if (context.query.match(/integration/i)) {
load('INTEGRATION-TESTING.md');
}
if (context.query.match(/e2e|end-to-end|cypress|playwright|puppeteer/i)) {
load('E2E-TESTING.md');
}
if (context.query.match(/unit/i)) {
load('UNIT-TESTING.md');
}
}
Progressive Disclosure Files
Philosophies (Progressive)
TDD.md - Test-Driven Development methodology
BDD.md - Behavior-Driven Development methodology
TEST-PYRAMID.md - Testing strategy pyramid (unit > integration > e2e)
Frameworks (Progressive)
TEST-FRAMEWORKS.md - Framework detection and setup (PHPUnit, Jest, PyTest, RSpec)
FRAMEWORK-PATTERNS.md - Common framework patterns
Writing Tests (Progressive)
AAA-PATTERNS.md - Arrange-Act-Assert test structure
MOCKING.md - Mocking frameworks and best practices
TEST-DOUBLES.md - Test doubles (mocks, stubs, fakes, spies)
Test Types (Progressive)
UNIT-TESTING.md - Unit testing fundamentals
INTEGRATION-TESTING.md - Integration testing strategies
E2E-TESTING.md - End-to-end testing with Cypress/Playwright
Coverage & Quality (Progressive)
COVERAGE.md - Coverage metrics and thresholds
COVERAGE-STRATEGIES.md - Coverage strategy and goals
TEST-QUALITY.md - Test quality assessment checklist
TEST-SMELLS.md - Test anti-patterns and refactoring
Quick Reference
Test Pyramid
E2E Tests
(Small %)
↑ Low value
↓ Slow
Integration Tests
(Medium %)
↑ Medium value
↓ Medium speed
Unit Tests
(Largest %)
↑ High value
↓ Fast
Testing Layers
| Layer |
Scope |
Speed |
Cost |
Isolation |
| Unit |
Single function/class |
Fast (<100ms) |
Low |
Yes |
| Integration |
Multiple components |
Medium (<5s) |
Medium |
Partial |
| E2E |
Full user flow |
Slow (>10s) |
High |
No |
Coverage Goals
| Type |
Minimum |
Target |
Notes |
| Statement |
70% |
80% |
Lines executed |
| Branch |
60% |
75% |
Conditional branches |
| Function |
80% |
90% |
Functions/methods called |
| Line |
70% |
80% |
Executable lines |
Common Test Frameworks
| Language |
Unit |
Integration |
E2E |
BDD |
| PHP |
PHPUnit, Pest |
PHPUnit, Codeception |
Codeception |
Behat |
| JS/TS |
Jest, Vitest |
Jest, Supertest |
Cypress, Playwright |
Cucumber.js |
| Python |
PyTest, unittest |
PyTest, Django test |
Playwright |
Behave |
| Ruby |
RSpec, Minitest |
RSpec, Capybara |
Capybara |
Cucumber |
| Go |
testing, testify |
testing, testify |
- |
Ginkgo |
| Java |
JUnit, TestNG |
JUnit, Spring Test |
Selenium |
Cucumber-JVM |
| C# |
xUnit, NUnit |
xUnit, NUnit |
Selenium |
SpecFlow |
Core Concepts
AAA Pattern
// Arrange - Setup test data
const user = { id: 1, name: 'John' };
const expected = 'John';
// Act - Execute code under test
const result = getUserById(user.id);
// Assert - Verify results
expect(result.name).toBe(expected);
Test Doubles
- Stub - Pre-programmed responses
- Mock - Expectations verification
- Fake - Working implementation (in-memory)
- Spy - Record method calls
TDD Cycle
- Red - Write failing test
- Green - Make test pass (minimal code)
- Refactor - Improve code
Common Testing Commands
PHP
# PHPUnit
./vendor/bin/phpunit
./vendor/bin/phpunit --filter testUserLogin
# Pest
./vendor/bin/pest
./vendor/bin/pest --filter testUserLogin
# Codeception
vendor/bin/codecept run
vendor/bin/codecept run functional
# Behat
vendor/bin/behat
JavaScript/TypeScript
# Jest
npm test
npm test -- --watch
npm test -- --coverage
# Vitest
npm run test
npm run test:watch
# Cypress
npx cypress open
npx cypress run
# Playwright
npx playwright test
npx playwright test --headed
Python
# PyTest
pytest
pytest --cov=src
pytest -k test_user_login
# unittest
python -m unittest
python -m unittest discover
# Behave
behave
Ruby
# RSpec
rspec
rspec --format documentation
rspec --only-failures
# Minitest
rails test
rails test:units
# Cucumber
cucumber
cucumber features/login.feature
When to Use This Skill
Use When:
- User mentions testing, tests, TDD, BDD
- Reviewing test quality or coverage
- Setting up test framework
- Writing unit/integration/e2e tests
- Refactoring test code
- Assessing test strategy
Do Not Use For:
- Code refactoring (use
software-engineering)
- Performance optimization (use
performance-engineering)
- Database queries (use
database-engineering)
- Security vulnerabilities (use
secops-engineering)
Internal References
This skill does NOT reference other skills. All testing concepts are self-contained.
File Structure
~/.config/opencode/skill/testing-engineering/
├── SKILL.md (this file)
├── philosophies/
│ ├── TDD.md
│ ├── BDD.md
│ └── TEST-PYRAMID.md
├── frameworks/
│ ├── TEST-FRAMEWORKS.md
│ └── FRAMEWORK-PATTERNS.md
├── patterns/
│ ├── AAA-PATTERNS.md
│ ├── MOCKING.md
│ └── TEST-DOUBLES.md
├── types/
│ ├── UNIT-TESTING.md
│ ├── INTEGRATION-TESTING.md
│ └── E2E-TESTING.md
└── quality/
├── COVERAGE.md
├── COVERAGE-STRATEGIES.md
├── TEST-QUALITY.md
└── TEST-SMELLS.md
1---2name: testing-engineering3description: Domain specialist for testing strategies, test frameworks, TDD/BDD methodologies, and quality assurance. Scope: unit testing, integration testing, end-to-end testing, test doubles, test pyramid, coverage strategies, test quality assessment. Excludes: code implementation, architecture, performance. Triggers: "testing", "test", "unit test", "integration test", "e2e test", "TDD", "BDD", "test-driven", "behavior-driven", "mock", "stub", "fake", "test double", "coverage", "PHPUnit", "Jest", "PyTest", "RSpec", "Cypress", "Playwright", "test pyramid".4---5
6## Overview
7
8Domain specialist for testing strategies, test frameworks, TDD/BDD methodologies, and quality assurance. Expertise includes unit testing, integration testing, end-to-end testing, test doubles (mocks, stubs, fakes), test pyramid, coverage strategies, and test quality assessment.
9
10## Trigger Words
11
12- testing, test, unit test, integration test, e2e test
13- TDD, BDD, test-driven, behavior-driven
14- mock, stub, fake, test double
15- coverage, test coverage
16- PHPUnit, Jest, PyTest, RSpec, Cypress, Playwright
17- test pyramid, test smells, test quality
18
19## Detection
20
21### Framework Detection
22
23**PHP:**
24- PHPUnit (`phpunit.xml`, `tests/` directory, `use PHPUnit\Framework\TestCase`)
25- Pest (`Pest.php`, `use PHPUnit\Framework\TestCase` with `test()` functions)
26- Codeception (`codeception.yml`, `_support/` directory)
27- Behat/Gherkin (`.feature` files, `FeatureContext.php`)
28
29**JavaScript/TypeScript:**
30- Jest (`__tests__/`, `*.test.js`, `*.spec.js`, `jest.config.js`)
31- Mocha (`describe()`, `it()`, `before()`, `after()`)
32- Vitest (`vitest.config.ts`, `import { test, expect } from 'vitest'`)
33- Jasmine (`describe()`, `it()`, `spyOn()`)
34- Cucumber.js (`.feature` files)
35- Cypress (`cypress/`, `cy.` commands)
36- Playwright (`playwright.config.ts`, `test()`, `page.`)
37- Puppeteer (`puppeteer` imports, `page.evaluate()`)
38
39**Python:**
40- PyTest (`conftest.py`, `def test_`, `@pytest.fixture`)
41- unittest (`unittest.TestCase`, `self.assertEqual()`)
42- Nose2 (`nose2.cfg`)
43- Behave (`.feature` files, `behave` command)
44- Locust (locustfile.py, `@task`)
45- Robot Framework (`.robot` files)
46
47**Ruby:**
48- RSpec (`spec/` directory, `describe()`, `it()`, `expect().to`)
49- Minitest (`test/` directory, `class Test* < Minitest::Test`)
50- Cucumber (`.feature` files, `Given/When/Then`)
51
52**Go:**
53- testing (`_test.go`, `func Test*`, `testing.T`)
54- testify (`assert.Equal()`, `testify/suite`)
55- ginkgo (`Describe()`, `It()`)
56
57**Java:**
58- JUnit (`@Test`, `org.junit.jupiter.api.Test`)
59- TestNG (`@Test`, `org.testng.annotations.Test`)
60- Mockito (`Mockito.mock()`, `when().thenReturn()`)
61
62**C#:**
63- NUnit (`[Test]`, `Assert.AreEqual()`)
64- xUnit (`[Fact]`, `[Theory]`, `Assert.Equal()`)
65- Moq (`Mock<T>()`, `.Setup()`)
66
67---
68
69## Mode Detection
70
71### Write Mode (Progressive Guidance)
72
73**Trigger:** `mode=write` or no explicit testing task
74
75**Load Progressive Files:**
761. `TEST-PYRAMID.md` - Understand testing strategy
772. `AAA-PATTERNS.md` - Learn test structure
783. `UNIT-TESTING.md` - Unit testing fundamentals
794. `TEST-FRAMEWORKS.md` - Framework-specific guidance
80
81**Behavior:**
82- Provide concise examples
83- Focus on getting started quickly
84- Progressive complexity (simple → advanced)
85- Framework-specific guidance
86
87### Review Mode (Exhaustive Checklists)
88
89**Trigger:** `mode=review`, "review tests", "audit tests", "check test quality", "assess testing"
90
91**Load Review Files:**
921. `TEST-QUALITY.md` - Quality assessment checklist
932. `TEST-SMELLS.md` - Test anti-patterns detection
943. `COVERAGE.md` - Coverage metrics and thresholds
954. `COVERAGE-STRATEGIES.md` - Coverage strategy assessment
96
97**Behavior:**
98- Exhaustive review checklists
99- Identify test smells
100- Coverage analysis
101- Quality metrics
102- Gap identification
103
104---
105
106## Skill Loading Strategy
107
108### Initial Load
109
110```javascript
111function loadTestingEngineeringSkill(context) {
112 const mode = context.mode || 'write';
113
114 if (mode === 'review') {
115 // Load review-mode files
116 loadProgressive([
117 'TEST-QUALITY.md',
118 'TEST-SMELLS.md',
119 'COVERAGE.md',
120 'COVERAGE-STRATEGIES.md'
121 ]);
122 } else {
123 // Load write-mode files
124 loadProgressive([
125 'TEST-PYRAMID.md',
126 'AAA-PATTERNS.md',
127 'UNIT-TESTING.md',
128 'TEST-FRAMEWORKS.md'
129 ]);
130 }
131
132 // Always load core concepts based on query keywords
133 if (context.query.match(/tdd|test-driven/i)) {
134 load('TDD.md');
135 }
136
137 if (context.query.match(/bdd|behavior-driven|cucumber|behave|gherkin/i)) {
138 load('BDD.md');
139 }
140
141 if (context.query.match(/mock|stub|fake|test-double/i)) {
142 loadProgressive(['TEST-DOUBLES.md', 'MOCKING.md']);
143 }
144
145 if (context.query.match(/coverage/i)) {
146 loadProgressive(['COVERAGE.md', 'COVERAGE-STRATEGIES.md']);
147 }
148
149 if (context.query.match(/integration/i)) {
150 load('INTEGRATION-TESTING.md');
151 }
152
153 if (context.query.match(/e2e|end-to-end|cypress|playwright|puppeteer/i)) {
154 load('E2E-TESTING.md');
155 }
156
157 if (context.query.match(/unit/i)) {
158 load('UNIT-TESTING.md');
159 }
160}
161```
162
163---
164
165## Progressive Disclosure Files
166
167### Philosophies (Progressive)
168
1691. `TDD.md` - Test-Driven Development methodology
1702. `BDD.md` - Behavior-Driven Development methodology
1713. `TEST-PYRAMID.md` - Testing strategy pyramid (unit > integration > e2e)
172
173### Frameworks (Progressive)
174
1754. `TEST-FRAMEWORKS.md` - Framework detection and setup (PHPUnit, Jest, PyTest, RSpec)
1765. `FRAMEWORK-PATTERNS.md` - Common framework patterns
177
178### Writing Tests (Progressive)
179
1806. `AAA-PATTERNS.md` - Arrange-Act-Assert test structure
1817. `MOCKING.md` - Mocking frameworks and best practices
1828. `TEST-DOUBLES.md` - Test doubles (mocks, stubs, fakes, spies)
183
184### Test Types (Progressive)
185
1869. `UNIT-TESTING.md` - Unit testing fundamentals
18710. `INTEGRATION-TESTING.md` - Integration testing strategies
18811. `E2E-TESTING.md` - End-to-end testing with Cypress/Playwright
189
190### Coverage & Quality (Progressive)
191
19212. `COVERAGE.md` - Coverage metrics and thresholds
19313. `COVERAGE-STRATEGIES.md` - Coverage strategy and goals
19414. `TEST-QUALITY.md` - Test quality assessment checklist
19515. `TEST-SMELLS.md` - Test anti-patterns and refactoring
196
197---
198
199## Quick Reference
200
201### Test Pyramid
202
203```
204 E2E Tests
205 (Small %)
206 ↑ Low value
207 ↓ Slow
208 Integration Tests
209 (Medium %)
210 ↑ Medium value
211 ↓ Medium speed
212 Unit Tests
213 (Largest %)
214 ↑ High value
215 ↓ Fast
216```
217
218### Testing Layers
219
220| Layer | Scope | Speed | Cost | Isolation |
221|-------|-------|-------|------|-----------|
222| Unit | Single function/class | Fast (<100ms) | Low | Yes |
223| Integration | Multiple components | Medium (<5s) | Medium | Partial |
224| E2E | Full user flow | Slow (>10s) | High | No |
225
226### Coverage Goals
227
228| Type | Minimum | Target | Notes |
229|------|---------|--------|-------|
230| Statement | 70% | 80% | Lines executed |
231| Branch | 60% | 75% | Conditional branches |
232| Function | 80% | 90% | Functions/methods called |
233| Line | 70% | 80% | Executable lines |
234
235### Common Test Frameworks
236
237| Language | Unit | Integration | E2E | BDD |
238|----------|------|-------------|-----|-----|
239| PHP | PHPUnit, Pest | PHPUnit, Codeception | Codeception | Behat |
240| JS/TS | Jest, Vitest | Jest, Supertest | Cypress, Playwright | Cucumber.js |
241| Python | PyTest, unittest | PyTest, Django test | Playwright | Behave |
242| Ruby | RSpec, Minitest | RSpec, Capybara | Capybara | Cucumber |
243| Go | testing, testify | testing, testify | - | Ginkgo |
244| Java | JUnit, TestNG | JUnit, Spring Test | Selenium | Cucumber-JVM |
245| C# | xUnit, NUnit | xUnit, NUnit | Selenium | SpecFlow |
246
247---
248
249## Core Concepts
250
251### AAA Pattern
252
253```javascript
254// Arrange - Setup test data
255const user = { id: 1, name: 'John' };
256const expected = 'John';
257
258// Act - Execute code under test
259const result = getUserById(user.id);
260
261// Assert - Verify results
262expect(result.name).toBe(expected);
263```
264
265### Test Doubles
266
267- **Stub** - Pre-programmed responses
268- **Mock** - Expectations verification
269- **Fake** - Working implementation (in-memory)
270- **Spy** - Record method calls
271
272### TDD Cycle
273
2741. **Red** - Write failing test
2752. **Green** - Make test pass (minimal code)
2763. **Refactor** - Improve code
277
278---
279
280## Common Testing Commands
281
282### PHP
283```bash
284# PHPUnit
285./vendor/bin/phpunit
286./vendor/bin/phpunit --filter testUserLogin
287
288# Pest
289./vendor/bin/pest
290./vendor/bin/pest --filter testUserLogin
291
292# Codeception
293vendor/bin/codecept run
294vendor/bin/codecept run functional
295
296# Behat
297vendor/bin/behat
298```
299
300### JavaScript/TypeScript
301```bash
302# Jest
303npm test
304npm test -- --watch
305npm test -- --coverage
306
307# Vitest
308npm run test
309npm run test:watch
310
311# Cypress
312npx cypress open
313npx cypress run
314
315# Playwright
316npx playwright test
317npx playwright test --headed
318```
319
320### Python
321```bash
322# PyTest
323pytest
324pytest --cov=src
325pytest -k test_user_login
326
327# unittest
328python -m unittest
329python -m unittest discover
330
331# Behave
332behave
333```
334
335### Ruby
336```bash
337# RSpec
338rspec
339rspec --format documentation
340rspec --only-failures
341
342# Minitest
343rails test
344rails test:units
345
346# Cucumber
347cucumber
348cucumber features/login.feature
349```
350
351---
352
353## When to Use This Skill
354
355**Use When:**
356- User mentions testing, tests, TDD, BDD
357- Reviewing test quality or coverage
358- Setting up test framework
359- Writing unit/integration/e2e tests
360- Refactoring test code
361- Assessing test strategy
362
363**Do Not Use For:**
364- Code refactoring (use `software-engineering`)
365- Performance optimization (use `performance-engineering`)
366- Database queries (use `database-engineering`)
367- Security vulnerabilities (use `secops-engineering`)
368
369---
370
371## Internal References
372
373This skill does NOT reference other skills. All testing concepts are self-contained.
374
375---
376
377## File Structure
378
379```
380~/.config/opencode/skill/testing-engineering/
381├── SKILL.md (this file)
382├── philosophies/
383│ ├── TDD.md
384│ ├── BDD.md
385│ └── TEST-PYRAMID.md
386├── frameworks/
387│ ├── TEST-FRAMEWORKS.md
388│ └── FRAMEWORK-PATTERNS.md
389├── patterns/
390│ ├── AAA-PATTERNS.md
391│ ├── MOCKING.md
392│ └── TEST-DOUBLES.md
393├── types/
394│ ├── UNIT-TESTING.md
395│ ├── INTEGRATION-TESTING.md
396│ └── E2E-TESTING.md
397└── quality/
398 ├── COVERAGE.md
399 ├── COVERAGE-STRATEGIES.md
400 ├── TEST-QUALITY.md
401 └── TEST-SMELLS.md
402```