Search in sources :

Example 1 with CoverageSelectionInfo

use of de.dagere.peass.dependency.traces.coverage.CoverageSelectionInfo in project peass by DaGeRe.

the class ContinuousDependencyReader method doPartialRCS.

private void doPartialRCS(final StaticTestSelection dependencies, final VersionIterator newIterator) {
    DependencyReader reader = new DependencyReader(dependencyConfig, folders, resultsFolders, dependencies.getUrl(), newIterator, new VersionKeeper(new File(resultsFolders.getStaticTestSelectionFile().getParentFile(), "nochanges.json")), executionConfig, kiekerConfig, env);
    newIterator.goTo0thCommit();
    reader.readCompletedVersions(dependencies);
    try {
        ExecutionData executions = Constants.OBJECTMAPPER.readValue(resultsFolders.getTraceTestSelectionFile(), ExecutionData.class);
        reader.setExecutionData(executions);
        if (resultsFolders.getCoverageSelectionFile().exists()) {
            ExecutionData coverageExecutions = Constants.OBJECTMAPPER.readValue(resultsFolders.getCoverageSelectionFile(), ExecutionData.class);
            reader.setCoverageExecutions(coverageExecutions);
            if (resultsFolders.getCoverageInfoFile().exists()) {
                CoverageSelectionInfo coverageInfo = Constants.OBJECTMAPPER.readValue(resultsFolders.getCoverageInfoFile(), CoverageSelectionInfo.class);
                reader.setCoverageInfo(coverageInfo);
            }
        }
        reader.readDependencies();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : VersionKeeper(de.dagere.peass.dependency.reader.VersionKeeper) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) IOException(java.io.IOException) File(java.io.File) CoverageSelectionInfo(de.dagere.peass.dependency.traces.coverage.CoverageSelectionInfo) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 2 with CoverageSelectionInfo

use of de.dagere.peass.dependency.traces.coverage.CoverageSelectionInfo in project peass-ci-plugin by jenkinsci.

the class RTSVisualizationCreator method readCoverageSelection.

private CoverageSelectionVersion readCoverageSelection(final Run<?, ?> run) throws IOException, JsonParseException, JsonMappingException {
    File coverageInfoFile = localWorkspace.getCoverageInfoFile();
    if (coverageInfoFile.exists()) {
        LOG.info("Reading {}", coverageInfoFile);
        CoverageSelectionInfo executions = Constants.OBJECTMAPPER.readValue(coverageInfoFile, CoverageSelectionInfo.class);
        CoverageSelectionVersion currentVersion = executions.getVersions().get(peassConfig.getMeasurementConfig().getExecutionConfig().getVersion());
        return currentVersion;
    } else {
        LOG.info("File {} was not found, RTS coverage based selection info might be incomplete", coverageInfoFile.getAbsoluteFile());
    }
    return null;
}
Also used : File(java.io.File) CoverageSelectionInfo(de.dagere.peass.dependency.traces.coverage.CoverageSelectionInfo) CoverageSelectionVersion(de.dagere.peass.dependency.traces.coverage.CoverageSelectionVersion)

Example 3 with CoverageSelectionInfo

use of de.dagere.peass.dependency.traces.coverage.CoverageSelectionInfo in project peass by DaGeRe.

the class TestTestcaseSerialization method testNoParamSerialization.

@Test
public void testNoParamSerialization() throws JsonProcessingException {
    CoverageSelectionInfo info = new CoverageSelectionInfo();
    CoverageSelectionVersion version = new CoverageSelectionVersion();
    TestCase test = new TestCase("ClazzA", "methodA2", "moduleA");
    TraceCallSummary traceCallSummary = new TraceCallSummary();
    traceCallSummary.addCall("app" + ChangedEntity.MODULE_SEPARATOR + "ClazzB" + ChangedEntity.METHOD_SEPARATOR + "methodB");
    traceCallSummary.setTestcase(test);
    version.getTestcases().put(test, traceCallSummary);
    info.getVersions().put("000001", version);
    String serialized = Constants.OBJECTMAPPER.writeValueAsString(info);
    System.out.println(serialized);
    CoverageSelectionInfo deserialized = Constants.OBJECTMAPPER.readValue(serialized, CoverageSelectionInfo.class);
    TestCase deserializedTest = deserialized.getVersions().get("000001").getTestcases().keySet().iterator().next();
    Assert.assertEquals("ClazzA", deserializedTest.getClazz());
    Assert.assertEquals("methodA2", deserializedTest.getMethod());
    Assert.assertEquals("moduleA", deserializedTest.getModule());
    Assert.assertNull(deserializedTest.getParams());
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) TraceCallSummary(de.dagere.peass.dependency.traces.coverage.TraceCallSummary) CoverageSelectionInfo(de.dagere.peass.dependency.traces.coverage.CoverageSelectionInfo) CoverageSelectionVersion(de.dagere.peass.dependency.traces.coverage.CoverageSelectionVersion) Test(org.junit.jupiter.api.Test)

Example 4 with CoverageSelectionInfo

use of de.dagere.peass.dependency.traces.coverage.CoverageSelectionInfo in project peass by DaGeRe.

the class TestTestcaseSerialization method testSerialization.

@Test
public void testSerialization() throws JsonProcessingException {
    CoverageSelectionInfo info = new CoverageSelectionInfo();
    CoverageSelectionVersion version = new CoverageSelectionVersion();
    TestCase test = new TestCase("ClazzA", "methodA2", "moduleA", "int,String");
    TraceCallSummary traceCallSummary = new TraceCallSummary();
    traceCallSummary.addCall("app" + ChangedEntity.MODULE_SEPARATOR + "ClazzB" + ChangedEntity.METHOD_SEPARATOR + "methodB(double)");
    traceCallSummary.setTestcase(test);
    version.getTestcases().put(test, traceCallSummary);
    info.getVersions().put("000001", version);
    String serialized = Constants.OBJECTMAPPER.writeValueAsString(info);
    System.out.println(serialized);
    CoverageSelectionInfo deserialized = Constants.OBJECTMAPPER.readValue(serialized, CoverageSelectionInfo.class);
    TestCase deserializedTest = deserialized.getVersions().get("000001").getTestcases().keySet().iterator().next();
    Assert.assertEquals("ClazzA", deserializedTest.getClazz());
    Assert.assertEquals("methodA2", deserializedTest.getMethod());
    Assert.assertEquals("moduleA", deserializedTest.getModule());
    Assert.assertEquals("int,String", deserializedTest.getParams());
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) TraceCallSummary(de.dagere.peass.dependency.traces.coverage.TraceCallSummary) CoverageSelectionInfo(de.dagere.peass.dependency.traces.coverage.CoverageSelectionInfo) CoverageSelectionVersion(de.dagere.peass.dependency.traces.coverage.CoverageSelectionVersion) Test(org.junit.jupiter.api.Test)

Aggregations

CoverageSelectionInfo (de.dagere.peass.dependency.traces.coverage.CoverageSelectionInfo)4 CoverageSelectionVersion (de.dagere.peass.dependency.traces.coverage.CoverageSelectionVersion)3 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)2 TraceCallSummary (de.dagere.peass.dependency.traces.coverage.TraceCallSummary)2 File (java.io.File)2 Test (org.junit.jupiter.api.Test)2 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)1 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)1 VersionKeeper (de.dagere.peass.dependency.reader.VersionKeeper)1 IOException (java.io.IOException)1