Class: SixthSense::Analyzers::AdequacyMutation
- Inherits:
-
SixthSense::Analyzer
- Object
- SixthSense::Analyzer
- SixthSense::Analyzers::AdequacyMutation
- Defined in:
- lib/sixth_sense/analyzers/adequacy_mutation.rb
Instance Method Summary collapse
-
#analyze(test_file, context) ⇒ Object
Paper basis: Jia/Harman 2011 (doi:10.1109/TSE.2010.62) defines mutation score; Just et al.
Methods inherited from SixthSense::Analyzer
analyzer_id, axis, inherited, level, reference, references
Instance Method Details
#analyze(test_file, context) ⇒ Object
Paper basis: Jia/Harman 2011 (doi:10.1109/TSE.2010.62) defines mutation score; Just et al. 2014 (doi:10.1145/2635868.2635929) supports mutants as a proxy for real fault detection.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/sixth_sense/analyzers/adequacy_mutation.rb', line 26 def analyze(test_file, context) matrix = context.kill_matrix_for(test_file) return no_subjects(test_file) if !matrix && test_file.sut_candidates.empty? if matrix && !matrix.mutation_score return result(score: nil, measured: false, confidence: :low, findings: operational_findings(matrix, context)) end return unmeasured(confidence: :low) unless matrix&.mutation_score findings = operational_findings(matrix, context) findings.concat(matrix.surviving_mutants.map do |mutant| finding( rule_id: mutant.status.to_s == "timeout" ? "mutation_timeout" : "surviving_mutant", severity: :warning, location: mutant.location, message: (mutant), suggestion: mutant_suggestion(mutant) ) end) result(score: (matrix.mutation_score * 100.0).round(2), findings: findings, confidence: confidence_for(matrix)) end |