public OutputVariable<T> getVariable(TestSuiteChromosome chromosome) { return new OutputVariable<T>(variable.name(), getData(chromosome)); }
@Override public void evosuite_flushStatisticsForClassChange(String clientRmiIdentifier) throws RemoteException { SearchStatistics.getInstance(clientRmiIdentifier).writeStatisticsForAnalysis(); }
private String[] getTimelineHeaderSuffixes(){ int numberOfIntervals = calculateNumberOfIntervals(); String[] suffixes = new String[numberOfIntervals]; for(int i=0; i<suffixes.length; i++){ /* * NOTE: we start from T1 and not T0 because, by definition, coverage * at T0 is equal to T0, and no point in showing it in a graph */ suffixes[i] = "_T"+(i+1); } return suffixes; }
public void setOutputVariable(OutputVariable<?> variable) { /** * if the output variable is contained in sequenceOutputVariableFactories, * then it must be a DirectSequenceOutputVariableFactory, hence we set its * value so that it can be used to produce the next timeline variable. */ if (sequenceOutputVariableFactories.containsKey(variable.getName())) { if(variable.getValue() instanceof Integer) { DirectSequenceOutputVariableFactory<Integer> v = (DirectSequenceOutputVariableFactory<Integer>) sequenceOutputVariableFactories.get(variable.getName()); v.setValue((Integer) variable.getValue()); } else if(variable.getValue() instanceof Double) { DirectSequenceOutputVariableFactory<Double> v = (DirectSequenceOutputVariableFactory<Double>) sequenceOutputVariableFactories.get(variable.getName()); v.setValue((Double) variable.getValue()); } // v.setValue((Integer)variable.getValue()); } else outputVariables.put(variable.getName(), variable); }
/** * Create default factories */ private void initFactories() { variableFactories.put(RuntimeVariable.Length.name(), new ChromosomeLengthOutputVariableFactory()); variableFactories.put(RuntimeVariable.Size.name(), new ChromosomeSizeOutputVariableFactory()); variableFactories.put(RuntimeVariable.Coverage.name(), new ChromosomeCoverageOutputVariableFactory()); variableFactories.put(RuntimeVariable.Fitness.name(), new ChromosomeFitnessOutputVariableFactory()); }
@Test public void testLineCoverage() { SearchStatistics statistics = this.aux(new Properties.Criterion[] { Properties.Criterion.LINE }); Map<String, OutputVariable<?>> variables = statistics.getOutputVariables(); assertEquals(11, (Integer) variables.get("Total_Goals").getValue(), 0.0); assertEquals(11, (Integer) variables.get("Covered_Goals").getValue(), 0.0); }
public List<OutputVariable<T>> getOutputVariables() { List<OutputVariable<T>> variables = new ArrayList<OutputVariable<T>>(); for(String variableName : getVariableNames()) { OutputVariable<T> variable = new OutputVariable<T>(variableName, getTimeLineValue(variableName)); variables.add(variable); } return variables; }
public List<String> getVariableNames() { List<String> variables = new ArrayList<String>(); for(String suffix : getTimelineHeaderSuffixes()) { variables.add(variable.name() + suffix); } return variables; }
protected Object getOutputVariableValue(Map<String, OutputVariable<?>> data, String key) { OutputVariable<?> ov = data.get(key); return (ov != null) ? ov.getValue() : null; }
@Override public void evosuite_collectStatistics(String clientRmiIdentifier, RuntimeVariable variable, Object value) throws RemoteException { SearchStatistics.getInstance(clientRmiIdentifier).setOutputVariable(variable, value); }
@Override public void evosuite_collectTestGenerationResult( String clientRmiIdentifier, List<TestGenerationResult> results) throws RemoteException { SearchStatistics.getInstance(clientRmiIdentifier).addTestGenerationResult(results); }
/** * Shorthand for getOutputVariables(individual, false) */ private Map<String, OutputVariable<?>> getOutputVariables(TestSuiteChromosome individual) { return getOutputVariables(individual, false); }
@Override public void evosuite_collectStatistics(String clientRmiIdentifier, Chromosome individual) { SearchStatistics.getInstance(clientRmiIdentifier).currentIndividual(individual); }
public static void clearInstance() { clearInstance(ClientProcess.DEFAULT_CLIENT_NAME); }
public OutputVariable<String> getVariable() { try { return new OutputVariable<String>(propertyName, Properties.getStringValue(propertyName)); } catch (Exception e) { // TODO: What would be better? return new OutputVariable<String>(propertyName, "error"); } }
public static SearchStatistics getInstance() { return getInstance(ClientProcess.DEFAULT_CLIENT_NAME); }
public static SearchStatistics getInstance(String rmiClientIdentifier) { SearchStatistics instance = instances.get(rmiClientIdentifier); if (instance == null) { instance = new SearchStatistics(); instances.put(rmiClientIdentifier, instance); } return instance; }
@Test public void testRhoCoverage() { SearchStatistics statistics = this.aux(new Properties.Criterion[] { Properties.Criterion.RHO }); Map<String, OutputVariable<?>> variables = statistics.getOutputVariables(); assertEquals(11, (Integer) variables.get("Total_Goals").getValue(), 0.0); assertEquals(11, (Integer) variables.get("Covered_Goals").getValue(), 0.0); }