Search in sources :

Example 36 with TestSet

use of de.dagere.peass.dependency.analysis.data.TestSet in project peass-ci-plugin by jenkinsci.

the class RTSVisualizationCreator method addVersionDataToChangeliste.

private void addVersionDataToChangeliste(final Map<String, List<String>> changesList, final VersionStaticSelection version) {
    for (Map.Entry<ChangedEntity, TestSet> entry : version.getChangedClazzes().entrySet()) {
        List<String> tests = new LinkedList<>();
        for (TestCase test : entry.getValue().getTests()) {
            tests.add(test.toString());
        }
        ChangedEntity changedClazz = entry.getKey();
        changesList.put(changedClazz.toString(), tests);
    }
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedList(java.util.LinkedList) TestSet(de.dagere.peass.dependency.analysis.data.TestSet)

Example 37 with TestSet

use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.

the class ContinuousDependencyReader method fetchTestset.

/**
 * Fetches the test set from the current version; it is required to allow null, in case a compile error occured
 * @param version
 * @param executionData
 * @return
 */
private Set<TestCase> fetchTestset(final String version, final ExecutionData executionData) {
    final Set<TestCase> tests;
    TestSet versionTestSet = executionData.getVersions().get(version);
    tests = versionTestSet != null ? versionTestSet.getTests() : new HashSet<TestCase>();
    return tests;
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) HashSet(java.util.HashSet)

Example 38 with TestSet

use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.

the class GetProjectSizes method main.

public static void main(final String[] args) throws JsonParseException, JsonMappingException, IOException {
    File dependencyFolder;
    if (System.getenv(Constants.PEASS_REPOS) != null) {
        final String repofolder = System.getenv(Constants.PEASS_REPOS);
        final File folder = new File(repofolder);
        dependencyFolder = new File(folder, "dependencies-final");
    } else {
        throw new RuntimeException("Please define environment variable " + Constants.PEASS_REPOS);
    }
    System.out.println("Projekt & Versionen & Analysierbar & GeƤndert & Selektiert & Tests\\\\ \\hline");
    for (final String project : allProjects) {
        final File projectFolder = new File("../../projekte/" + project);
        final int commits = GitUtils.getCommits(projectFolder, true).size();
        final File executionFile = new File(dependencyFolder, ResultsFolders.TRACE_SELECTION_PREFIX + project + ".json");
        int analyzable = 0;
        int tests = 0;
        int executionTests = 0;
        if (executionFile.exists()) {
            final ExecutionData executionData = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
            executionTests = executionData.getVersions().size();
            for (final TestSet test : executionData.getVersions().values()) {
                tests += test.getTests().size();
            }
        }
        final File nonRunning = new File(dependencyFolder, "nonRunning_" + project + ".json");
        final File nonChanges = new File(dependencyFolder, "nonChanges_" + project + ".json");
        int changes = 0;
        if (nonRunning.exists()) {
            final VersionKeeper vk = Constants.OBJECTMAPPER.readValue(nonRunning, VersionKeeper.class);
            analyzable = commits - vk.getNonRunableReasons().size();
            if (nonChanges.exists()) {
                final VersionKeeper vk2 = Constants.OBJECTMAPPER.readValue(nonChanges, VersionKeeper.class);
                changes = analyzable - vk2.getNonRunableReasons().size();
            }
        }
        System.out.println(project + " & " + commits + " & " + analyzable + " & " + changes + " & " + executionTests + " & " + tests + "\\\\");
    }
}
Also used : VersionKeeper(de.dagere.peass.dependency.reader.VersionKeeper) File(java.io.File) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData) TestSet(de.dagere.peass.dependency.analysis.data.TestSet)

Example 39 with TestSet

use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.

the class MissingExecutionFinder method removeSlurmExecutions.

private void removeSlurmExecutions(final File folder) throws JAXBException {
    ChangeReader reader = new ChangeReader(folder.getName(), tests);
    reader.readFile(folder);
    for (Entry<String, TestcaseData> entry : reader.getAllData().getData().entrySet()) {
        String version = entry.getKey();
        TestSet versionsTests = tests.getVersions().get(version);
        LOG.debug("Removing from: {}", version);
        for (TestCase test : entry.getValue().getTestcaseData().keySet()) {
            removeTestFromTestSet(test.getClazz(), test.getMethod(), versionsTests);
        }
    }
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ChangeReader(de.dagere.peass.analysis.changes.ChangeReader) TestcaseData(de.dagere.peass.analysis.helper.read.TestcaseData) TestSet(de.dagere.peass.dependency.analysis.data.TestSet)

Example 40 with TestSet

use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.

the class DependencyManager method initialyGetTraces.

public boolean initialyGetTraces(final String version) throws IOException, InterruptedException, XmlPullParserException {
    if (folders.getTempMeasurementFolder().exists()) {
        FileUtils.deleteDirectory(folders.getTempMeasurementFolder());
    }
    final ModuleClassMapping mapping = new ModuleClassMapping(executor);
    executor.loadClasses();
    TestSet tests = findIncludedTests(mapping);
    runTraceTests(tests, version);
    if (folders.getTempMeasurementFolder().exists()) {
        return readInitialResultFiles(mapping);
    } else {
        return printErrors();
    }
}
Also used : ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) TestSet(de.dagere.peass.dependency.analysis.data.TestSet)

Aggregations

TestSet (de.dagere.peass.dependency.analysis.data.TestSet)71 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)41 File (java.io.File)19 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)16 Test (org.junit.jupiter.api.Test)15 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)12 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)10 Set (java.util.Set)8 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)7 Map (java.util.Map)7 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)6 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)5 ChangeManager (de.dagere.peass.dependency.ChangeManager)5 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)5 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)5 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)5 PeassFolders (de.dagere.peass.folders.PeassFolders)5 VersionIterator (de.dagere.peass.vcs.VersionIterator)5 JmhTestTransformer (de.dagere.peass.dependency.jmh.JmhTestTransformer)4 LinkedHashMap (java.util.LinkedHashMap)4