Search in sources :

Example 21 with ExecutionData

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

the class TestCreateMeasurementExecutionScript method testFromDependencies.

@Test
public void testFromDependencies() throws IOException {
    ExecutionData executiondata = buildExecutionDataWithTests();
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (PrintStream ps = new PrintStream(baos)) {
        RunCommandWriter writer = new RunCommandWriter(ps, "experiment-1", executiondata);
        CreateMeasurementExecutionScript.generateExecuteCommands(executiondata, "experiment-1", writer);
    }
    String result = baos.toString();
    System.out.println(result);
    MatcherAssert.assertThat(result, Matchers.containsString("-test Test1#testMe"));
    MatcherAssert.assertThat(result, Matchers.containsString("-test Test5#testMe"));
}
Also used : PrintStream(java.io.PrintStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) TestExecutionData(de.dagere.peass.dependency.persistence.TestExecutionData) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData) Test(org.junit.jupiter.api.Test)

Example 22 with ExecutionData

use of de.dagere.peass.dependency.persistence.ExecutionData in project peass-ci-plugin by jenkinsci.

the class TestRTSVisualizationCreator method writeEmptyExecutionData.

private void writeEmptyExecutionData(final ResultsFolders localWorkspace) throws IOException, JsonGenerationException, JsonMappingException {
    ExecutionData data = new ExecutionData();
    Constants.OBJECTMAPPER.writeValue(localWorkspace.getTraceTestSelectionFile(), data);
}
Also used : ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 23 with ExecutionData

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

the class GetChanges method call.

@Override
public Void call() throws Exception {
    SelectedTests selectedTests = VersionSorter.getSelectedTests(staticSelectionFile, executionFile);
    if (!out.exists()) {
        out.mkdirs();
    }
    LOG.info("Errors: 1: {} 2: {}", statisticConfigMixin.getType1error(), statisticConfigMixin.getType2error());
    ResultsFolders folders = new ResultsFolders(out, "out");
    final ChangeReader reader = createReader(folders, selectedTests);
    if (staticSelectionFile != null) {
        StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(staticSelectionFile, StaticTestSelection.class);
        reader.setTests(dependencies.toExecutionData().getVersions());
    }
    if (executionFile != null) {
        ExecutionData executions = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
        reader.setTests(executions.getVersions());
    }
    for (final File dataFile : data) {
        reader.readFile(dataFile);
    }
    return null;
}
Also used : ChangeReader(de.dagere.peass.analysis.changes.ChangeReader) SelectedTests(de.dagere.peass.dependency.persistence.SelectedTests) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 24 with ExecutionData

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

the class ReadAllProperties method getProperties.

static void getProperties(final RepoFolders folders, final String project) throws JAXBException, IOException, JsonParseException, JsonMappingException, JsonGenerationException {
    final File viewFolder = new File(folders.getAllViewFolder(), "views_" + project);
    final File executionFile = new File(folders.getDependencyFolder(), ResultsFolders.TRACE_SELECTION_PREFIX + project + ".json");
    final ExecutionData changedTests = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
    final File projectFolder = new File("../../projekte/" + project);
    if (!projectFolder.exists()) {
        GitUtils.downloadProject(changedTests.getUrl(), projectFolder);
    }
    if (!readAll) {
        final File changeFile = new File(folders.getResultsFolder(), project + File.separator + project + ".json");
        if (changeFile.exists()) {
            final File resultFile = new File(folders.getPropertiesFolder(), project + File.separator + project + ".json");
            if (!resultFile.getParentFile().exists()) {
                resultFile.getParentFile().mkdir();
            }
            final ReadProperties reader = new ReadProperties(resultFile);
            reader.readChangeProperties(changeFile, projectFolder, viewFolder, changedTests);
        } else {
            System.err.println("Error: " + changeFile.getAbsolutePath() + " does not exist");
        }
    } else {
        ResultsFolders resultsFolders = new ResultsFolders(folders.getPropertiesFolder().getParentFile(), project);
        new PropertyReader(resultsFolders, projectFolder, changedTests, new ExecutionConfig()).readAllTestsProperties();
    }
}
Also used : ReadProperties(de.dagere.peass.ReadProperties) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) File(java.io.File) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 25 with ExecutionData

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

the class SourceReader method executeSourceReading.

public void executeSourceReading(final Set<TestCase> tests) {
    ExecutionData executionData = new ExecutionData();
    executionData.addEmptyVersion(version, versionOld);
    if (versionOld != null) {
        executionData.addEmptyVersion(versionOld, null);
    }
    for (TestCase test : tests) {
        executionData.addCall(version, test);
    }
    LOG.info("Reading method sources for {} - {}", version, versionOld);
    final PropertyReader propertyReader = new PropertyReader(resultsFolders, folders.getProjectFolder(), executionData, config);
    propertyReader.readAllTestsProperties();
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

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