Search in sources :

Example 36 with ExecutionData

use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.

the class JmhDependencyReaderMultiParamTest method checkChangedVersion.

private void checkChangedVersion(final ResultsFolders resultsFolders) throws IOException, JsonParseException, JsonMappingException {
    ExecutionData data = Constants.OBJECTMAPPER.readValue(resultsFolders.getTraceTestSelectionFile(), ExecutionData.class);
    TestCase changedBenchmark = new TestCase("de.dagere.peass.ExampleBenchmark#testMethod");
    TestSet versionTestSet = data.getVersions().get("000002");
    MatcherAssert.assertThat(versionTestSet.getTests(), Matchers.contains(changedBenchmark));
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData) TestSet(de.dagere.peass.dependency.analysis.data.TestSet)

Example 37 with ExecutionData

use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.

the class DependencyStatisticAnalyzer method call.

@Override
public Void call() throws Exception {
    // final File dependenciesFile = new File(args[0]);
    if (!dependencyFile.exists()) {
        LOG.info("Dependencies-file " + dependencyFile.getAbsolutePath() + " should exist.");
        System.exit(1);
    }
    ExecutionData changedTests;
    if (executionFile != null) {
        changedTests = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
    } else {
        changedTests = null;
    }
    final DependencyStatistics statistics = getChangeStatistics(dependencyFile, changedTests);
    LOG.info("Versions: {} Bei Pruning ausgeführte Tests: {} Trace-Changed Tests: {}", statistics.size, statistics.pruningRunTests, statistics.changedTraceTests);
    LOG.info("Gesamt-Tests: {} Bei Pruning (ggf. mehrmals) genutzte Tests: {} Nur einmal ausgeführte Tests (d.h. keine Veränderung möglich): {}", statistics.overallRunTests, statistics.multipleChangedTest.size(), statistics.onceChangedTests.size());
    return null;
}
Also used : ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 38 with ExecutionData

use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.

the class RegressionTestSelectionSummarizer method getExtendedTable.

private void getExtendedTable(final File folder) throws IOException, JsonParseException, JsonMappingException, JAXBException {
    System.out.println("Project;Versions;Normal-Tests;SIC;TIC; Tests once changed; Tests multiple times changed");
    for (final File xmlFile : FileUtils.listFiles(folder, new WildcardFileFilter(ResultsFolders.STATIC_SELECTION_PREFIX + "*.json"), TrueFileFilter.INSTANCE)) {
        final String projektName = xmlFile.getName().replace(ResultsFolders.STATIC_SELECTION_PREFIX, "").replace(".xml", "");
        final File executeFile = new File(xmlFile.getParentFile(), "views_" + projektName + "/execute" + projektName + ".json");
        if (xmlFile.exists() && executeFile.exists()) {
            final ExecutionData changedTests = Constants.OBJECTMAPPER.readValue(executeFile, ExecutionData.class);
            final DependencyStatistics statistics = DependencyStatisticAnalyzer.getChangeStatistics(xmlFile, changedTests);
            System.out.println(projektName + ";" + statistics.getSize() + ";" + statistics.getOverallRunTests() + ";" + statistics.getPruningRunTests() + ";" + statistics.getChangedTraceTests() + ";" + statistics.getOnceChangedTests().size() + ";" + statistics.getMultipleChangedTest().size());
        }
    }
}
Also used : DependencyStatistics(de.dagere.peass.dependency.statistics.DependencyStatistics) File(java.io.File) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 39 with ExecutionData

use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.

the class PartialDependenciesMerger method mergeExecutionFiles.

private static ExecutionData mergeExecutionFiles(final List<File> executionOutFiles) throws IOException, JsonParseException, JsonMappingException {
    List<ExecutionData> executionData = new LinkedList<>();
    for (File file : executionOutFiles) {
        ExecutionData currentData = Constants.OBJECTMAPPER.readValue(file, ExecutionData.class);
        executionData.add(currentData);
    }
    ExecutionData merged = mergeExecutiondata(executionData);
    return merged;
}
Also used : File(java.io.File) LinkedList(java.util.LinkedList) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 40 with ExecutionData

use of de.dagere.peass.dependency.persistence.ExecutionData in project peass by DaGeRe.

the class VersionProcessor method initVersionProcessor.

protected void initVersionProcessor() throws IOException, JsonParseException, JsonMappingException {
    if (executionMixin != null) {
        startversion = executionMixin.getStartversion();
        endversion = executionMixin.getEndversion();
        version = executionMixin.getVersion();
    }
    if (staticSelectionFile != null) {
        staticTestSelection = Constants.OBJECTMAPPER.readValue(staticSelectionFile, StaticTestSelection.class);
        VersionComparator.setDependencies(staticTestSelection);
        executionData = new ExecutionData(staticTestSelection);
    }
    if (executionfile != null) {
        executionData = Constants.OBJECTMAPPER.readValue(executionfile, ExecutionData.class);
        staticTestSelection = new StaticTestSelection(executionData);
    }
    if (executionData == null && staticTestSelection == null) {
        throw new RuntimeException("Dependencyfile and executionfile not readable - one needs to be defined!");
    }
    if (!projectFolder.exists()) {
        GitUtils.downloadProject(staticTestSelection.getUrl(), projectFolder);
    }
    folders = new PeassFolders(projectFolder);
    if (startversion != null || endversion != null) {
        LOG.info("Version: " + startversion + " - " + endversion);
    }
    if (executionMixin.getVersionOld() != null && startversion == null) {
        throw new RuntimeException("If versionOld is specified, always specify version!");
    }
    if (version != null) {
        if (startversion != null || endversion != null) {
            throw new RuntimeException("Both, version and (startversion or endversion), are defined - define version, or startversion/endversion!");
        }
        startversion = version;
        endversion = version;
        LOG.info("Version: " + startversion + " - " + endversion);
    }
    VersionComparator.setDependencies(staticTestSelection);
    vcs = VersionControlSystem.getVersionControlSystem(folders.getProjectFolder());
}
Also used : StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData) PeassFolders(de.dagere.peass.folders.PeassFolders)

Aggregations

ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)42 File (java.io.File)25 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)12 Test (org.junit.jupiter.api.Test)10 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)8 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)8 ResultsFolders (de.dagere.peass.folders.ResultsFolders)7 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)6 PeassFolders (de.dagere.peass.folders.PeassFolders)5 PrintStream (java.io.PrintStream)5 RepoFolders (de.dagere.peass.analysis.all.RepoFolders)4 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)4 PropertyReader (de.dagere.peass.analysis.properties.PropertyReader)4 KiekerConfig (de.dagere.peass.config.KiekerConfig)4 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)4 ChangeReader (de.dagere.peass.analysis.changes.ChangeReader)3 VersionKeeper (de.dagere.peass.dependency.reader.VersionKeeper)3 LinkedList (java.util.LinkedList)3 Change (de.dagere.peass.analysis.changes.Change)2 VersionChangeProperties (de.dagere.peass.analysis.properties.VersionChangeProperties)2