Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. ---
  2. name: 'step-03e-subagent-performance'
  3. description: 'Subagent: Check test performance (speed, efficiency, parallelization)'
  4. subagent: true
  5. outputFile: '/tmp/tea-test-review-performance-{{timestamp}}.json'
  6. ---
  7. # Subagent 3E: Performance Quality Check
  8. ## SUBAGENT CONTEXT
  9. This is an **isolated subagent** running in parallel with other quality dimension checks.
  10. **Your task:** Analyze test files for PERFORMANCE violations only.
  11. ---
  12. ## MANDATORY EXECUTION RULES
  13. - ✅ Check PERFORMANCE only (not other quality dimensions)
  14. - ✅ Output structured JSON to temp file
  15. - ❌ Do NOT check determinism, isolation, maintainability, or coverage
  16. ---
  17. ## SUBAGENT TASK
  18. ### 1. Identify Performance Violations
  19. **HIGH SEVERITY Violations**:
  20. - Tests not parallelizable (using test.describe.serial unnecessarily)
  21. - Slow setup/teardown (creating fresh DB for every test)
  22. - Excessive navigation (reloading pages unnecessarily)
  23. - No fixture reuse (repeating expensive operations)
  24. **MEDIUM SEVERITY Violations**:
  25. - Hard waits >2 seconds (waitForTimeout(5000))
  26. - Inefficient selectors (page.$$ instead of locators)
  27. - Large data sets in tests without pagination
  28. - Missing performance optimizations
  29. **LOW SEVERITY Violations**:
  30. - Could use parallelization (test.describe.configure({ mode: 'parallel' }))
  31. - Minor inefficiencies
  32. - Excessive logging
  33. ### 2. Calculate Performance Score
  34. ```javascript
  35. const severityWeights = { HIGH: 10, MEDIUM: 5, LOW: 2 };
  36. const totalPenalty = violations.reduce((sum, v) => sum + severityWeights[v.severity], 0);
  37. const score = Math.max(0, 100 - totalPenalty);
  38. ```
  39. ---
  40. ## OUTPUT FORMAT
  41. ```json
  42. {
  43. "dimension": "performance",
  44. "score": 80,
  45. "max_score": 100,
  46. "grade": "B",
  47. "violations": [
  48. {
  49. "file": "tests/e2e/search.spec.ts",
  50. "line": 10,
  51. "severity": "HIGH",
  52. "category": "not-parallelizable",
  53. "description": "Tests use test.describe.serial unnecessarily - reduces parallel execution",
  54. "suggestion": "Remove .serial unless tests truly share state",
  55. "code_snippet": "test.describe.serial('Search tests', () => { ... });"
  56. },
  57. {
  58. "file": "tests/api/bulk-operations.spec.ts",
  59. "line": 35,
  60. "severity": "MEDIUM",
  61. "category": "slow-setup",
  62. "description": "Test creates 1000 records in setup - very slow",
  63. "suggestion": "Use smaller data sets or fixture factories",
  64. "code_snippet": "beforeEach(async () => { for (let i=0; i<1000; i++) { ... } });"
  65. }
  66. ],
  67. "passed_checks": 13,
  68. "failed_checks": 2,
  69. "violation_summary": {
  70. "HIGH": 1,
  71. "MEDIUM": 1,
  72. "LOW": 0
  73. },
  74. "performance_metrics": {
  75. "parallelizable_tests": 80,
  76. "serial_tests": 20,
  77. "avg_test_duration_estimate": "~2 seconds",
  78. "slow_tests": ["bulk-operations.spec.ts (>30s)"]
  79. },
  80. "recommendations": [
  81. "Enable parallel mode where possible",
  82. "Reduce setup data to minimum needed",
  83. "Use fixtures to share expensive setup across tests",
  84. "Remove unnecessary .serial constraints"
  85. ],
  86. "summary": "Good performance with 2 violations - 80% tests can run in parallel"
  87. }
  88. ```
  89. ---
  90. ## EXIT CONDITION
  91. Subagent completes when JSON output written to temp file.
  92. **Subagent terminates here.**