@Test public void testGetFrameDistance_differentMethod() { StackTraceElement generated = new StackTraceElement("eu.stamp.ClassA", "method2", "ClassA", 10); StackTraceElement target = new StackTraceElement("eu.stamp.ClassA", "method1", "ClassA", 10); double distance = calculator.getFrameDistance(generated, target); assertEquals(2.0 / 3.0, distance, 0.000001); }
public double getFrameDistance(StackTraceElement targetFrame, StackTraceElement generatedFrame){ String className =targetFrame.getClassName(); if(className.contains("$") & !className.equals(generatedFrame.getClassName())){ className = targetFrame.getClassName().split("\\$")[0]; } double elementDistance; if (!className.equals(generatedFrame.getClassName())){ elementDistance = 3.0; }else if (!targetFrame.getMethodName().equals(generatedFrame.getMethodName())) { elementDistance = 2.0; }else{ elementDistance = normalize(Math.abs(targetFrame.getLineNumber() - generatedFrame.getLineNumber())); } return normalize(elementDistance); }
CrashCoverageFitnessCalculator { public double getFrameDistance(StackTraceElement targetFrame, StackTraceElement generatedFrame){ String className =targetFrame.getClassName(); if(className.contains("$") & !className.equals(generatedFrame.getClassName())){ className = targetFrame.getClassName().split("\\$")[0]; } double elementDistance; if (!className.equals(generatedFrame.getClassName())){ elementDistance = 3.0; }else if (!targetFrame.getMethodName().equals(generatedFrame.getMethodName())) { elementDistance = 2.0; }else{ elementDistance = normalize(Math.abs(targetFrame.getLineNumber() - generatedFrame.getLineNumber())); } return normalize(elementDistance); } }
CrashCoverageFitnessCalculator { public double getFrameDistance(StackTraceElement targetFrame, StackTraceElement generatedFrame){ String className =targetFrame.getClassName(); if(className.contains("$") & !className.equals(generatedFrame.getClassName())){ className = targetFrame.getClassName().split("\\$")[0]; } double elementDistance; if (!className.equals(generatedFrame.getClassName())){ elementDistance = 3.0; }else if (!targetFrame.getMethodName().equals(generatedFrame.getMethodName())) { elementDistance = 2.0; }else{ elementDistance = normalize(Math.abs(targetFrame.getLineNumber() - generatedFrame.getLineNumber())); } return normalize(elementDistance); } CrashCoverageFitnessCalculator(StackTrace crash); }
CrashCoverageFitnessCalculator { public double getFrameDistance(StackTraceElement targetFrame, StackTraceElement generatedFrame){ String className =targetFrame.getClassName(); if(className.contains("$") & !className.equals(generatedFrame.getClassName())){ className = targetFrame.getClassName().split("\\$")[0]; } double elementDistance; if (!className.equals(generatedFrame.getClassName())){ elementDistance = 3.0; }else if (!targetFrame.getMethodName().equals(generatedFrame.getMethodName())) { elementDistance = 2.0; }else{ elementDistance = normalize(Math.abs(targetFrame.getLineNumber() - generatedFrame.getLineNumber())); } return normalize(elementDistance); } CrashCoverageFitnessCalculator(StackTrace crash); double getLineCoverageFitness( ExecutionResult result , int lineNumber); double getLineCoverageForFrame( ExecutionResult result, int frameLevel); double calculateFrameSimilarity( StackTraceElement[] trace); double getFrameDistance(StackTraceElement targetFrame, StackTraceElement generatedFrame); }
CrashCoverageFitnessCalculator { public double getFrameDistance(StackTraceElement targetFrame, StackTraceElement generatedFrame){ String className =targetFrame.getClassName(); if(className.contains("$") & !className.equals(generatedFrame.getClassName())){ className = targetFrame.getClassName().split("\\$")[0]; } double elementDistance; if (!className.equals(generatedFrame.getClassName())){ elementDistance = 3.0; }else if (!targetFrame.getMethodName().equals(generatedFrame.getMethodName())) { elementDistance = 2.0; }else{ elementDistance = normalize(Math.abs(targetFrame.getLineNumber() - generatedFrame.getLineNumber())); } return normalize(elementDistance); } CrashCoverageFitnessCalculator(StackTrace crash); double getLineCoverageFitness( ExecutionResult result , int lineNumber); double getLineCoverageForFrame( ExecutionResult result, int frameLevel); double calculateFrameSimilarity( StackTraceElement[] trace); double getFrameDistance(StackTraceElement targetFrame, StackTraceElement generatedFrame);  }