use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class ReadProperties method detectVersionProperty.
private int detectVersionProperty(final File projectFolder, final File viewFolder, final BufferedWriter csvWriter, final VersionChangeProperties versionProperties, final Entry<String, Changes> versionChanges, final String predecessor, final ExecutionData data) throws IOException, JsonGenerationException, JsonMappingException {
final File methodFolder = new File(out.getParentFile(), "methods");
methodFolder.mkdirs();
final String version = versionChanges.getKey();
final ChangeProperties changeProperties = new ChangeProperties();
changeProperties.setCommitText(GitUtils.getCommitText(projectFolder, version));
changeProperties.setCommitter(GitUtils.getCommitter(projectFolder, version));
versionProperties.getVersions().put(version, changeProperties);
int count = 0;
for (final Entry<String, List<Change>> changes : versionChanges.getValue().getTestcaseChanges().entrySet()) {
final String testclazz = changes.getKey();
String module = null;
for (TestCase test : data.getVersions().get(versionChanges.getKey()).getTests()) {
if (test.getClazz().equals(testclazz)) {
module = test.getModule();
}
}
final List<ChangeProperty> properties = new LinkedList<>();
changeProperties.getProperties().put(testclazz, properties);
for (final Change testcaseChange : changes.getValue()) {
ExecutionConfig config = new ExecutionConfig();
config.setVersion(version);
config.setVersionOld(predecessor);
ChangedEntity entity = new ChangedEntity(testclazz, module);
final PropertyReadHelper reader = new PropertyReadHelper(config, entity, testcaseChange, projectFolder, viewFolder, methodFolder, null);
final ChangeProperty currentProperty = reader.read();
// if (currentProperty != null) {
properties.add(currentProperty);
Constants.OBJECTMAPPER.writeValue(out, versionProperties);
writeCSVLine(csvWriter, currentProperty, projectFolder.getName());
// }
count++;
}
}
return count;
}
use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class ChangeReader method getIsChange.
public void getIsChange(final String fileName, final Kopemedata data, final ProjectChanges changeKnowledge, final ProjectStatistics info, final String[] versions, final DescribedChunk describedChunk) {
LOG.debug(data.getTestcases().getClazz());
final TestcaseStatistic statistic = describedChunk.getStatistic(config);
statistic.setPredecessor(versions[0]);
// if (! (statistic.getTvalue() == Double.NaN)){
CompareData cd = new CompareData(describedChunk.getPrevious(), describedChunk.getCurrent());
final Relation confidenceResult = ConfidenceIntervalInterpretion.compare(cd);
final TestCase testcase = getTestcase(data, versions, describedChunk);
final double diff = describedChunk.getDiff();
final boolean isBigEnoughDiff = Math.abs(diff) > minChange;
allData.addStatistic(versions[1], testcase, fileName, statistic, statistic.isChange() && isBigEnoughDiff, !confidenceResult.equals(Relation.EQUAL));
if (statistic.isChange() && isBigEnoughDiff) {
changeKnowledge.addChange(testcase, versions[1], confidenceResult, statistic.isChange() ? Relation.GREATER_THAN : Relation.EQUAL, describedChunk.getDescPrevious().getMean(), diff, statistic.getTvalue(), statistic.getVMs());
writeRunCommands(versions, describedChunk, testcase);
}
info.addMeasurement(versions[1], testcase, statistic);
}
use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class ContinuousDependencyReader method getTests.
public RTSResult getTests(final VersionIterator iterator, final String url, final String version, final MeasurementConfig measurementConfig) {
final StaticTestSelection dependencies = getDependencies(iterator, url);
RTSResult result;
final Set<TestCase> tests;
if (dependencies.getVersions().size() > 0) {
VersionStaticSelection versionInfo = dependencies.getVersions().get(version);
LOG.debug("Versioninfo for version {}, running was: {}", version, versionInfo != null ? versionInfo.isRunning() : "null");
if (dependencyConfig.isGenerateTraces()) {
tests = selectResults(version);
result = new RTSResult(tests, versionInfo.isRunning());
} else {
tests = versionInfo.getTests().getTests();
result = new RTSResult(tests, versionInfo.isRunning());
}
// final Set<TestCase> tests = selectIncludedTests(dependencies);
NonIncludedTestRemover.removeNotIncluded(tests, measurementConfig.getExecutionConfig());
} else {
tests = new HashSet<>();
result = new RTSResult(tests, true);
LOG.info("No test executed - version did not contain changed tests.");
}
return result;
}
use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class ContinuousDependencyReader method selectResults.
private Set<TestCase> selectResults(final String version) {
try {
final Set<TestCase> tests;
if (dependencyConfig.isGenerateCoverageSelection()) {
LOG.info("Using coverage-based test selection");
ExecutionData executionData = Constants.OBJECTMAPPER.readValue(resultsFolders.getCoverageSelectionFile(), ExecutionData.class);
tests = fetchTestset(version, executionData);
} else {
LOG.info("Using dynamic test selection results");
ExecutionData executionData = Constants.OBJECTMAPPER.readValue(resultsFolders.getTraceTestSelectionFile(), ExecutionData.class);
tests = fetchTestset(version, executionData);
}
return tests;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class CopyFromFull method checkFileMerging.
public static void checkFileMerging(final File goal, final ExecutionData tests, final File source) throws JAXBException {
Kopemedata kopemeData = XMLDataLoader.loadData(source);
Testcases testcase = kopemeData.getTestcases();
TestcaseType testcaseType = testcase.getTestcase().get(0);
String clazz = testcase.getClazz();
String method = testcaseType.getName();
TestCase testcase2 = new TestCase(testcase);
List<Chunk> chunks = testcaseType.getDatacollector().get(0).getChunk();
if (!goal.exists()) {
goal.mkdirs();
}
for (Chunk chunk : chunks) {
checkChunkMerging(goal, tests, testcase2, chunk);
}
}
Aggregations