agentic-qe 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/qx-partner.md +17 -4
- package/.claude/skills/accessibility-testing/SKILL.md +144 -692
- package/.claude/skills/agentic-quality-engineering/SKILL.md +176 -529
- package/.claude/skills/api-testing-patterns/SKILL.md +180 -560
- package/.claude/skills/brutal-honesty-review/SKILL.md +113 -603
- package/.claude/skills/bug-reporting-excellence/SKILL.md +116 -517
- package/.claude/skills/chaos-engineering-resilience/SKILL.md +127 -72
- package/.claude/skills/cicd-pipeline-qe-orchestrator/SKILL.md +209 -404
- package/.claude/skills/code-review-quality/SKILL.md +158 -608
- package/.claude/skills/compatibility-testing/SKILL.md +148 -38
- package/.claude/skills/compliance-testing/SKILL.md +132 -63
- package/.claude/skills/consultancy-practices/SKILL.md +114 -446
- package/.claude/skills/context-driven-testing/SKILL.md +117 -381
- package/.claude/skills/contract-testing/SKILL.md +176 -141
- package/.claude/skills/database-testing/SKILL.md +137 -130
- package/.claude/skills/exploratory-testing-advanced/SKILL.md +160 -629
- package/.claude/skills/holistic-testing-pact/SKILL.md +140 -188
- package/.claude/skills/localization-testing/SKILL.md +145 -33
- package/.claude/skills/mobile-testing/SKILL.md +132 -448
- package/.claude/skills/mutation-testing/SKILL.md +147 -41
- package/.claude/skills/performance-testing/SKILL.md +200 -546
- package/.claude/skills/quality-metrics/SKILL.md +164 -519
- package/.claude/skills/refactoring-patterns/SKILL.md +132 -699
- package/.claude/skills/regression-testing/SKILL.md +120 -926
- package/.claude/skills/risk-based-testing/SKILL.md +157 -660
- package/.claude/skills/security-testing/SKILL.md +199 -538
- package/.claude/skills/sherlock-review/SKILL.md +163 -699
- package/.claude/skills/shift-left-testing/SKILL.md +161 -465
- package/.claude/skills/shift-right-testing/SKILL.md +161 -519
- package/.claude/skills/six-thinking-hats/SKILL.md +175 -1110
- package/.claude/skills/skills-manifest.json +71 -20
- package/.claude/skills/tdd-london-chicago/SKILL.md +131 -448
- package/.claude/skills/technical-writing/SKILL.md +103 -154
- package/.claude/skills/test-automation-strategy/SKILL.md +166 -772
- package/.claude/skills/test-data-management/SKILL.md +126 -910
- package/.claude/skills/test-design-techniques/SKILL.md +179 -89
- package/.claude/skills/test-environment-management/SKILL.md +136 -91
- package/.claude/skills/test-reporting-analytics/SKILL.md +169 -92
- package/.claude/skills/testability-scoring/SKILL.md +172 -538
- package/.claude/skills/testability-scoring/scripts/generate-html-report.js +0 -0
- package/.claude/skills/visual-testing-advanced/SKILL.md +155 -78
- package/.claude/skills/xp-practices/SKILL.md +151 -587
- package/CHANGELOG.md +48 -0
- package/README.md +23 -16
- package/dist/agents/QXPartnerAgent.d.ts +8 -1
- package/dist/agents/QXPartnerAgent.d.ts.map +1 -1
- package/dist/agents/QXPartnerAgent.js +1174 -112
- package/dist/agents/QXPartnerAgent.js.map +1 -1
- package/dist/agents/lifecycle/AgentLifecycleManager.d.ts.map +1 -1
- package/dist/agents/lifecycle/AgentLifecycleManager.js +34 -31
- package/dist/agents/lifecycle/AgentLifecycleManager.js.map +1 -1
- package/dist/cli/commands/init-claude-md-template.d.ts.map +1 -1
- package/dist/cli/commands/init-claude-md-template.js +14 -0
- package/dist/cli/commands/init-claude-md-template.js.map +1 -1
- package/dist/core/SwarmCoordinator.d.ts +180 -0
- package/dist/core/SwarmCoordinator.d.ts.map +1 -0
- package/dist/core/SwarmCoordinator.js +473 -0
- package/dist/core/SwarmCoordinator.js.map +1 -0
- package/dist/core/metrics/MetricsAggregator.d.ts +228 -0
- package/dist/core/metrics/MetricsAggregator.d.ts.map +1 -0
- package/dist/core/metrics/MetricsAggregator.js +482 -0
- package/dist/core/metrics/MetricsAggregator.js.map +1 -0
- package/dist/core/metrics/index.d.ts +5 -0
- package/dist/core/metrics/index.d.ts.map +1 -0
- package/dist/core/metrics/index.js +11 -0
- package/dist/core/metrics/index.js.map +1 -0
- package/dist/core/optimization/SwarmOptimizer.d.ts +5 -0
- package/dist/core/optimization/SwarmOptimizer.d.ts.map +1 -1
- package/dist/core/optimization/SwarmOptimizer.js +17 -0
- package/dist/core/optimization/SwarmOptimizer.js.map +1 -1
- package/dist/core/orchestration/AdaptiveScheduler.d.ts +190 -0
- package/dist/core/orchestration/AdaptiveScheduler.d.ts.map +1 -0
- package/dist/core/orchestration/AdaptiveScheduler.js +460 -0
- package/dist/core/orchestration/AdaptiveScheduler.js.map +1 -0
- package/dist/core/orchestration/WorkflowOrchestrator.d.ts +13 -0
- package/dist/core/orchestration/WorkflowOrchestrator.d.ts.map +1 -1
- package/dist/core/orchestration/WorkflowOrchestrator.js +32 -0
- package/dist/core/orchestration/WorkflowOrchestrator.js.map +1 -1
- package/dist/core/recovery/CircuitBreaker.d.ts +176 -0
- package/dist/core/recovery/CircuitBreaker.d.ts.map +1 -0
- package/dist/core/recovery/CircuitBreaker.js +382 -0
- package/dist/core/recovery/CircuitBreaker.js.map +1 -0
- package/dist/core/recovery/RecoveryOrchestrator.d.ts +186 -0
- package/dist/core/recovery/RecoveryOrchestrator.d.ts.map +1 -0
- package/dist/core/recovery/RecoveryOrchestrator.js +476 -0
- package/dist/core/recovery/RecoveryOrchestrator.js.map +1 -0
- package/dist/core/recovery/RetryStrategy.d.ts +127 -0
- package/dist/core/recovery/RetryStrategy.d.ts.map +1 -0
- package/dist/core/recovery/RetryStrategy.js +314 -0
- package/dist/core/recovery/RetryStrategy.js.map +1 -0
- package/dist/core/recovery/index.d.ts +8 -0
- package/dist/core/recovery/index.d.ts.map +1 -0
- package/dist/core/recovery/index.js +27 -0
- package/dist/core/recovery/index.js.map +1 -0
- package/dist/core/skills/DependencyResolver.d.ts +99 -0
- package/dist/core/skills/DependencyResolver.d.ts.map +1 -0
- package/dist/core/skills/DependencyResolver.js +260 -0
- package/dist/core/skills/DependencyResolver.js.map +1 -0
- package/dist/core/skills/ManifestGenerator.d.ts +114 -0
- package/dist/core/skills/ManifestGenerator.d.ts.map +1 -0
- package/dist/core/skills/ManifestGenerator.js +449 -0
- package/dist/core/skills/ManifestGenerator.js.map +1 -0
- package/dist/core/skills/index.d.ts +9 -0
- package/dist/core/skills/index.d.ts.map +1 -0
- package/dist/core/skills/index.js +24 -0
- package/dist/core/skills/index.js.map +1 -0
- package/dist/mcp/server.d.ts +9 -9
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +1 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/types/qx.d.ts +39 -7
- package/dist/types/qx.d.ts.map +1 -1
- package/dist/types/qx.js.map +1 -1
- package/dist/visualization/api/RestEndpoints.js +1 -1
- package/dist/visualization/api/RestEndpoints.js.map +1 -1
- package/package.json +13 -55
|
@@ -1,187 +1,222 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: contract-testing
|
|
3
|
-
description: Consumer-driven contract testing for microservices using Pact, schema validation, API versioning, and backward compatibility testing. Use when testing API contracts
|
|
3
|
+
description: "Consumer-driven contract testing for microservices using Pact, schema validation, API versioning, and backward compatibility testing. Use when testing API contracts or coordinating distributed teams."
|
|
4
|
+
category: testing-methodologies
|
|
5
|
+
priority: high
|
|
6
|
+
tokenEstimate: 900
|
|
7
|
+
agents: [qe-api-contract-validator, qe-test-generator, qe-security-scanner]
|
|
8
|
+
implementation_status: optimized
|
|
9
|
+
optimization_version: 1.0
|
|
10
|
+
last_optimized: 2025-12-02
|
|
11
|
+
dependencies: []
|
|
12
|
+
quick_reference_card: true
|
|
13
|
+
tags: [contract, pact, consumer-driven, api, microservices, schema-validation]
|
|
4
14
|
---
|
|
5
15
|
|
|
6
16
|
# Contract Testing
|
|
7
17
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
**Contract
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
<default_to_action>
|
|
19
|
+
When testing API contracts or microservices:
|
|
20
|
+
1. DEFINE consumer expectations (what consumers actually need)
|
|
21
|
+
2. VERIFY provider fulfills contracts (Pact verification)
|
|
22
|
+
3. DETECT breaking changes before deployment (CI/CD integration)
|
|
23
|
+
4. VERSION APIs semantically (breaking = major bump)
|
|
24
|
+
5. MAINTAIN backward compatibility for supported versions
|
|
25
|
+
|
|
26
|
+
**Quick Contract Testing Steps:**
|
|
27
|
+
- Consumer: Define expected request/response pairs
|
|
28
|
+
- Provider: Verify against all consumer contracts
|
|
29
|
+
- CI/CD: Block deploys that break contracts
|
|
30
|
+
- Versioning: Document supported versions and deprecation
|
|
31
|
+
|
|
32
|
+
**Critical Success Factors:**
|
|
33
|
+
- Consumers own the contract (they define what they need)
|
|
34
|
+
- Provider must pass all consumer contracts before deploy
|
|
35
|
+
- Breaking changes require coordination, not surprise
|
|
36
|
+
</default_to_action>
|
|
37
|
+
|
|
38
|
+
## Quick Reference Card
|
|
39
|
+
|
|
40
|
+
### When to Use
|
|
41
|
+
- Microservices communication
|
|
42
|
+
- Third-party API integrations
|
|
43
|
+
- Distributed team coordination
|
|
44
|
+
- Preventing breaking changes
|
|
45
|
+
|
|
46
|
+
### Consumer-Driven Contract Flow
|
|
19
47
|
```
|
|
20
|
-
Consumer
|
|
21
|
-
|
|
22
|
-
→
|
|
48
|
+
Consumer → Defines Expectations → Contract
|
|
49
|
+
↓
|
|
50
|
+
Provider → Verifies Contract → Pass/Fail
|
|
51
|
+
↓
|
|
52
|
+
CI/CD → Blocks Breaking Changes
|
|
23
53
|
```
|
|
24
54
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
55
|
+
### Breaking vs Non-Breaking Changes
|
|
56
|
+
| Change Type | Breaking? | Semver |
|
|
57
|
+
|-------------|-----------|--------|
|
|
58
|
+
| Remove field | ✅ Yes | Major |
|
|
59
|
+
| Rename field | ✅ Yes | Major |
|
|
60
|
+
| Change type | ✅ Yes | Major |
|
|
61
|
+
| Add optional field | ❌ No | Minor |
|
|
62
|
+
| Add new endpoint | ❌ No | Minor |
|
|
63
|
+
| Bug fix | ❌ No | Patch |
|
|
64
|
+
|
|
65
|
+
### Tools
|
|
66
|
+
| Tool | Best For |
|
|
67
|
+
|------|----------|
|
|
68
|
+
| **Pact** | Consumer-driven contracts |
|
|
69
|
+
| **OpenAPI/Swagger** | API-first design |
|
|
70
|
+
| **JSON Schema** | Schema validation |
|
|
71
|
+
| **GraphQL** | Schema-first contracts |
|
|
31
72
|
|
|
32
|
-
|
|
73
|
+
---
|
|
33
74
|
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm install --save-dev @pact-foundation/pact
|
|
37
|
-
```
|
|
75
|
+
## Consumer Contract (Pact)
|
|
38
76
|
|
|
39
|
-
**Consumer Test (defines contract):**
|
|
40
77
|
```javascript
|
|
41
|
-
|
|
78
|
+
// Consumer defines what it needs
|
|
79
|
+
const { Pact } = require('@pact-foundation/pact');
|
|
42
80
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
81
|
+
describe('Order API Consumer', () => {
|
|
82
|
+
const provider = new Pact({
|
|
83
|
+
consumer: 'CheckoutUI',
|
|
84
|
+
provider: 'OrderService'
|
|
85
|
+
});
|
|
47
86
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
87
|
+
beforeAll(() => provider.setup());
|
|
88
|
+
afterAll(() => provider.finalize());
|
|
89
|
+
|
|
90
|
+
it('creates an order', async () => {
|
|
91
|
+
await provider.addInteraction({
|
|
92
|
+
state: 'products exist',
|
|
93
|
+
uponReceiving: 'a create order request',
|
|
94
|
+
withRequest: {
|
|
95
|
+
method: 'POST',
|
|
96
|
+
path: '/orders',
|
|
97
|
+
body: { productId: 'abc', quantity: 2 }
|
|
98
|
+
},
|
|
99
|
+
willRespondWith: {
|
|
100
|
+
status: 201,
|
|
101
|
+
body: {
|
|
102
|
+
orderId: like('order-123'), // Any string matching pattern
|
|
103
|
+
total: like(19.99) // Any number
|
|
104
|
+
}
|
|
64
105
|
}
|
|
65
106
|
});
|
|
66
107
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const api = new UserAPI(mockServer.url);
|
|
70
|
-
const user = await api.getUser(123);
|
|
71
|
-
|
|
72
|
-
expect(user.id).toBe(123);
|
|
73
|
-
expect(user.email).toBe('user@example.com');
|
|
108
|
+
const response = await orderClient.create({ productId: 'abc', quantity: 2 });
|
|
109
|
+
expect(response.orderId).toBeDefined();
|
|
74
110
|
});
|
|
75
111
|
});
|
|
76
|
-
|
|
77
|
-
// Generates pact contract file
|
|
78
112
|
```
|
|
79
113
|
|
|
80
|
-
|
|
81
|
-
```javascript
|
|
82
|
-
import { Verifier } from '@pact-foundation/pact';
|
|
83
|
-
|
|
84
|
-
test('provider honors all consumer contracts', async () => {
|
|
85
|
-
const verifier = new Verifier({
|
|
86
|
-
provider: 'UserAPI',
|
|
87
|
-
providerBaseUrl: 'http://localhost:3000',
|
|
88
|
-
|
|
89
|
-
// Load contracts from Pact Broker
|
|
90
|
-
pactBrokerUrl: 'https://pact-broker.example.com',
|
|
91
|
-
pactBrokerToken: process.env.PACT_BROKER_TOKEN,
|
|
114
|
+
---
|
|
92
115
|
|
|
93
|
-
|
|
94
|
-
pactUrls: ['./pacts/UserWebApp-UserAPI.json'],
|
|
116
|
+
## Provider Verification
|
|
95
117
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
118
|
+
```javascript
|
|
119
|
+
// Provider verifies it fulfills all consumer contracts
|
|
120
|
+
const { Verifier } = require('@pact-foundation/pact');
|
|
121
|
+
|
|
122
|
+
describe('Order Service Provider', () => {
|
|
123
|
+
it('fulfills all consumer contracts', async () => {
|
|
124
|
+
await new Verifier({
|
|
125
|
+
provider: 'OrderService',
|
|
126
|
+
providerBaseUrl: 'http://localhost:3000',
|
|
127
|
+
pactUrls: ['./pacts/checkoutui-orderservice.json'],
|
|
128
|
+
stateHandlers: {
|
|
129
|
+
'products exist': async () => {
|
|
130
|
+
await db.products.create({ id: 'abc', price: 9.99 });
|
|
131
|
+
}
|
|
100
132
|
}
|
|
101
|
-
}
|
|
133
|
+
}).verifyProvider();
|
|
102
134
|
});
|
|
103
|
-
|
|
104
|
-
await verifier.verifyProvider();
|
|
105
|
-
// Fails if provider doesn't match consumer expectations
|
|
106
135
|
});
|
|
107
136
|
```
|
|
108
137
|
|
|
109
|
-
|
|
138
|
+
---
|
|
110
139
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const validator = new Ajv();
|
|
129
|
-
const valid = validator.validate(userSchema, user);
|
|
130
|
-
|
|
131
|
-
expect(valid).toBe(true);
|
|
132
|
-
expect(validator.errors).toBeNull();
|
|
133
|
-
});
|
|
140
|
+
## Breaking Change Detection
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
// Agent detects breaking changes
|
|
144
|
+
await Task("Contract Validation", {
|
|
145
|
+
currentContract: 'openapi-v2.yaml',
|
|
146
|
+
previousContract: 'openapi-v1.yaml',
|
|
147
|
+
detectBreaking: true,
|
|
148
|
+
calculateSemver: true,
|
|
149
|
+
generateMigrationGuide: true
|
|
150
|
+
}, "qe-api-contract-validator");
|
|
151
|
+
|
|
152
|
+
// Output:
|
|
153
|
+
// Breaking changes found: 2
|
|
154
|
+
// - Removed field: order.discount
|
|
155
|
+
// - Type change: order.total (number → string)
|
|
156
|
+
// Recommended version: 3.0.0 (major bump)
|
|
134
157
|
```
|
|
135
158
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
**Test backward compatibility:**
|
|
139
|
-
```javascript
|
|
140
|
-
test('v2 API is backward compatible with v1', async () => {
|
|
141
|
-
// v1 client
|
|
142
|
-
const v1Response = await fetch('/api/v1/users/123');
|
|
143
|
-
const v1User = await v1Response.json();
|
|
159
|
+
---
|
|
144
160
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
161
|
+
## CI/CD Integration
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
name: Contract Tests
|
|
165
|
+
on: [push]
|
|
166
|
+
|
|
167
|
+
jobs:
|
|
168
|
+
consumer-tests:
|
|
169
|
+
steps:
|
|
170
|
+
- run: npm run test:contract
|
|
171
|
+
- name: Publish Pacts
|
|
172
|
+
run: npx pact-broker publish ./pacts --broker-base-url $PACT_BROKER
|
|
173
|
+
|
|
174
|
+
provider-verification:
|
|
175
|
+
needs: consumer-tests
|
|
176
|
+
steps:
|
|
177
|
+
- name: Verify Provider
|
|
178
|
+
run: npm run verify:contracts
|
|
179
|
+
- name: Can I Deploy?
|
|
180
|
+
run: npx pact-broker can-i-deploy --pacticipant OrderService --version $VERSION
|
|
181
|
+
```
|
|
148
182
|
|
|
149
|
-
|
|
150
|
-
expect(v2User).toMatchObject(v1User);
|
|
183
|
+
---
|
|
151
184
|
|
|
152
|
-
|
|
153
|
-
expect(v2User.newField).toBeDefined();
|
|
154
|
-
});
|
|
185
|
+
## Agent Coordination Hints
|
|
155
186
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
187
|
+
### Memory Namespace
|
|
188
|
+
```
|
|
189
|
+
aqe/contract-testing/
|
|
190
|
+
├── contracts/* - Current contracts
|
|
191
|
+
├── breaking-changes/* - Detected breaking changes
|
|
192
|
+
├── versioning/* - Version compatibility matrix
|
|
193
|
+
└── verification-results/* - Provider verification history
|
|
194
|
+
```
|
|
159
195
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
196
|
+
### Fleet Coordination
|
|
197
|
+
```typescript
|
|
198
|
+
const contractFleet = await FleetManager.coordinate({
|
|
199
|
+
strategy: 'contract-testing',
|
|
200
|
+
agents: [
|
|
201
|
+
'qe-api-contract-validator', // Validation, breaking detection
|
|
202
|
+
'qe-test-generator', // Generate contract tests
|
|
203
|
+
'qe-security-scanner' // API security
|
|
204
|
+
],
|
|
205
|
+
topology: 'sequential'
|
|
163
206
|
});
|
|
164
207
|
```
|
|
165
208
|
|
|
166
|
-
|
|
209
|
+
---
|
|
167
210
|
|
|
211
|
+
## Related Skills
|
|
168
212
|
- [api-testing-patterns](../api-testing-patterns/) - API testing strategies
|
|
169
|
-
- [
|
|
170
|
-
- [
|
|
213
|
+
- [shift-left-testing](../shift-left-testing/) - Early contract validation
|
|
214
|
+
- [cicd-pipeline-qe-orchestrator](../cicd-pipeline-qe-orchestrator/) - Pipeline integration
|
|
171
215
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
**Breaking API changes break production.**
|
|
216
|
+
---
|
|
175
217
|
|
|
176
|
-
|
|
177
|
-
- Changes propagate across services
|
|
178
|
-
- Integration tests miss distributed issues
|
|
179
|
-
- Contract testing catches breaks early
|
|
218
|
+
## Remember
|
|
180
219
|
|
|
181
|
-
**
|
|
182
|
-
- Consumers define expectations
|
|
183
|
-
- Providers validate before deployment
|
|
184
|
-
- Breaking changes caught in CI
|
|
185
|
-
- Safe, independent deployments
|
|
220
|
+
**Consumers own the contract.** They define what they need; providers must fulfill it. Breaking changes require major version bumps and coordination. CI/CD blocks deploys that break contracts. Use Pact for consumer-driven, OpenAPI for API-first.
|
|
186
221
|
|
|
187
|
-
**With Agents:**
|
|
222
|
+
**With Agents:** Agents validate contracts, detect breaking changes with semver recommendations, and generate migration guides. Use agents to maintain contract compliance at scale.
|