183 lines
3.6 KiB
YAML
183 lines
3.6 KiB
YAML
|
|
# Anti-Fake Testing Configuration for Mosquito Project
|
||
|
|
# Based on 1210 test discoveries
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# 1. Mock Audit Configuration
|
||
|
|
mock_audit:
|
||
|
|
enabled: true
|
||
|
|
max_mock_ratio: 0.5
|
||
|
|
|
||
|
|
banned_mock_patterns:
|
||
|
|
- "com.mosquito.project.service.*"
|
||
|
|
- "com.mosquito.project.controller.*"
|
||
|
|
- "com.mosquito.project.job.*"
|
||
|
|
|
||
|
|
require_real_implementations:
|
||
|
|
- interface: "org.springframework.data.repository.Repository"
|
||
|
|
implementation: "testcontainers"
|
||
|
|
|
||
|
|
- interface: "org.springframework.data.redis.core.RedisTemplate"
|
||
|
|
implementation: "testcontainers-redis"
|
||
|
|
|
||
|
|
- interface: "javax.sql.DataSource"
|
||
|
|
implementation: "testcontainers-postgres"
|
||
|
|
|
||
|
|
allowed_mock_patterns:
|
||
|
|
- "com.mosquito.project.sdk.*"
|
||
|
|
- "javax.mail.*"
|
||
|
|
- "com.thirdparty.*"
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# 2. Assertion Quality Configuration
|
||
|
|
assertion_quality:
|
||
|
|
enabled: true
|
||
|
|
min_assertions_per_test: 2
|
||
|
|
|
||
|
|
required_assertion_types:
|
||
|
|
- type: "not_null"
|
||
|
|
min_count: 0
|
||
|
|
max_ratio: 0.5
|
||
|
|
description: "null checks should not exceed 50%"
|
||
|
|
|
||
|
|
- type: "equals"
|
||
|
|
min_count: 1
|
||
|
|
description: "value equality verification"
|
||
|
|
|
||
|
|
- type: "business_logic"
|
||
|
|
min_count: 1
|
||
|
|
description: "business logic verification"
|
||
|
|
|
||
|
|
- type: "side_effect"
|
||
|
|
min_count: 0
|
||
|
|
description: "side effect verification"
|
||
|
|
|
||
|
|
banned_assertions:
|
||
|
|
- "assertTrue(true)"
|
||
|
|
- "assertFalse(false)"
|
||
|
|
- "assertNotNull(new Object())"
|
||
|
|
- "assertEquals(1, 1)"
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# 3. Branch Coverage Enforcement
|
||
|
|
branch_coverage:
|
||
|
|
enabled: true
|
||
|
|
min_coverage: 60
|
||
|
|
|
||
|
|
required_branch_types:
|
||
|
|
- type: "if_else"
|
||
|
|
priority: 10
|
||
|
|
|
||
|
|
- type: "switch_case"
|
||
|
|
priority: 9
|
||
|
|
|
||
|
|
- type: "exception_handler"
|
||
|
|
priority: 10
|
||
|
|
|
||
|
|
- type: "loop_boundary"
|
||
|
|
priority: 8
|
||
|
|
|
||
|
|
- type: "ternary_operator"
|
||
|
|
priority: 7
|
||
|
|
|
||
|
|
auto_generate:
|
||
|
|
enabled: true
|
||
|
|
max_tests_per_round: 20
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# 4. Real Integration Validation
|
||
|
|
real_integration:
|
||
|
|
enabled: true
|
||
|
|
|
||
|
|
service_startup:
|
||
|
|
required: true
|
||
|
|
timeout_seconds: 30
|
||
|
|
health_check_endpoints:
|
||
|
|
- "/actuator/health"
|
||
|
|
- "/api/v1/health"
|
||
|
|
fail_if_not_running: true
|
||
|
|
|
||
|
|
database_validation:
|
||
|
|
type: "real_write_read"
|
||
|
|
forbid_in_memory: true
|
||
|
|
require_transaction_test: true
|
||
|
|
|
||
|
|
cache_validation:
|
||
|
|
type: "real_cache"
|
||
|
|
forbid_in_memory_cache: true
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# 5. Mutation Testing Configuration
|
||
|
|
mutation_testing:
|
||
|
|
enabled: true
|
||
|
|
min_detection_rate: 70
|
||
|
|
|
||
|
|
mutation_types:
|
||
|
|
- type: "condition_boundary"
|
||
|
|
must_detect: true
|
||
|
|
|
||
|
|
- type: "null_check_removal"
|
||
|
|
must_detect: true
|
||
|
|
|
||
|
|
- type: "arithmetic_change"
|
||
|
|
must_detect: true
|
||
|
|
|
||
|
|
- type: "return_value_change"
|
||
|
|
must_detect: false
|
||
|
|
|
||
|
|
- type: "exception_swallowing"
|
||
|
|
must_detect: true
|
||
|
|
|
||
|
|
execution:
|
||
|
|
max_mutations_per_class: 10
|
||
|
|
timeout_per_mutation: 30
|
||
|
|
parallel_execution: true
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# 6. Scoring and Gates
|
||
|
|
scoring:
|
||
|
|
mock_audit:
|
||
|
|
weight: 20
|
||
|
|
|
||
|
|
assertion_quality:
|
||
|
|
weight: 25
|
||
|
|
|
||
|
|
branch_coverage:
|
||
|
|
weight: 25
|
||
|
|
|
||
|
|
real_integration:
|
||
|
|
weight: 15
|
||
|
|
|
||
|
|
mutation_testing:
|
||
|
|
weight: 15
|
||
|
|
|
||
|
|
gate:
|
||
|
|
min_total_score: 80
|
||
|
|
must_pass:
|
||
|
|
- mock_audit
|
||
|
|
- assertion_quality
|
||
|
|
warning_only:
|
||
|
|
- mutation_testing
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# 7. Reporting and Monitoring
|
||
|
|
reporting:
|
||
|
|
generate_report: true
|
||
|
|
report_path: "target/anti-fake-report.html"
|
||
|
|
log_level: "INFO"
|
||
|
|
progress_log: ".testing-autonomous/anti-fake-progress.log"
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# Usage
|
||
|
|
# 1. Copy this file to: .testing-autonomous/anti-fake.yml
|
||
|
|
# 2. Enable in Testing-Autonomous:
|
||
|
|
# @skill testing-autonomous
|
||
|
|
# optimize --anti-fake-config .testing-autonomous/anti-fake.yml
|
||
|
|
# 3. View report: open target/anti-fake-report.html
|