testing-pyramid
Test Distribution Analysis Command 🧪
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Test Distribution Analysis Command 🧪
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Biome JavaScript/TypeScript linter and formatter
Hono lightweight web framework on Cloudflare Workers
Cloudflare Workers edge computing platform
Laravel PHP framework best practices
MySQL database best practices and query patterns
Next.js with React 19 App Router patterns
| name | testing-pyramid |
| description | Test Distribution Analysis Command 🧪 |
| disable-model-invocation | true |
This command guides the AI agent to analyze test distribution across unit, integration, and E2E tests, and provide recommendations for increasing test coverage and improving test distribution in line with business and technical strategy.
package.json for test framework dependencies:
jest or @jest/core in dependencies/devDependenciesvitest in dependencies/devDependencies@playwright/test in dependencies/devDependenciescypress in dependencies/devDependenciesmocha in dependencies/devDependenciespackage.json:
test:coverage, coverage, or scripts with --coverage flagsUse framework-specific commands to list all test files:
npx jest --listTests (lists all test files without running)npx vitest list (lists all test files)npx playwright test --list (lists all test specs)cypress.config.js for specPattern or run npx cypress run --dry-runCheckpoint: Verify all test files are discovered and no test directories are missed.
Classify each test file as unit, integration, or E2E based on multiple indicators:
File Path Indicators:
e2e/, tests/e2e/, __e2e__/ → E2E testsintegration/, tests/integration/, __integration__/ → Integration testsunit/, tests/unit/, __tests__/ → Unit tests (if not in e2e/integration folders)Content Keywords:
playwright, cypress, page.goto, browser, user journey, visit, click, filldatabase, api, service, repository, endpoint, http, fetch, axios, click, fillmock, stub, spy, jest.fn(), vi.fn(), isolated function testingTest Framework Indicators:
Checkpoint: Review classification accuracy by sampling test files from each category.
Calculate test distribution:
Count tests by category:
Calculate percentages:
(unit tests / total tests) × 100(integration tests / total tests) × 100(e2e tests / total tests) × 100Compare to ideal ratios:
Checkpoint: Present distribution findings and highlight significant deviations.
Evaluate test quality indicators:
Identify common violations:
Provide actionable recommendations:
Characteristics:
Best Practices:
Example Structure:
describe("User Processing", () => {
it("should process valid user data correctly", () => {
// Arrange
const mockUser = createMockUser()
// Act
const result = processUserData(mockUser)
// Assert
expect(result).toEqual(expected)
})
})
Characteristics:
Best Practices:
Example Structure:
describe("User Authentication Integration", () => {
it("should successfully authenticate valid user", async () => {
// Arrange
const user = await createTestUser()
// Act
const result = await authService.authenticate(user.credentials)
// Assert
expect(result.authenticated).toBe(true)
})
})
Characteristics:
Best Practices:
Example Structure:
describe("Critical User Journey", () => {
it("should allow user to complete checkout process", async () => {
// Arrange
await loginAsTestUser()
// Act
await navigateToProducts()
await addItemToCart()
await proceedToCheckout()
await fillShippingDetails()
await completePayment()
// Assert
await expect(page.locator("#order-confirmation")).toBeVisible()
})
})
When presenting analysis results, include:
## Test Distribution Analysis
### Framework Information
- **Primary Framework**: [Framework name]
- **Coverage Tool**: [Tool name]
- **Total Test Files**: [Number]
### Distribution Breakdown
- **Unit Tests**: [Count] ([Percentage]%) - Target: 70%
- **Integration Tests**: [Count] ([Percentage]%) - Target: 20%
- **E2E Tests**: [Count] ([Percentage]%) - Target: 10%
### Findings
- [Finding 1]
- [Finding 2]
- [Finding 3]
### Violations Detected
1. [Violation description]
2. [Violation description]
### Recommendations
1. [Actionable recommendation]
2. [Actionable recommendation]
3. [Actionable recommendation]
### Priority Actions
- **High Priority**: [Actions]
- **Medium Priority**: [Actions]
- **Low Priority**: [Actions]
# Discover tests
npx jest --listTests
# Run analysis
# Classify tests by path and content
# Calculate distribution
# Provide recommendations
# Discover unit/integration tests
npx vitest list
# Discover E2E tests
npx playwright test --list
# Combine results and analyze