Search in sources :

Example 1 with VersionStaticSelection

use of de.dagere.peass.dependency.persistence.VersionStaticSelection 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;
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 2 with VersionStaticSelection

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

the class RootCauseAnalysis method call.

@Override
public Void call() throws Exception {
    if (testName == null) {
        throw new RuntimeException("Test needs to be defined!");
    }
    initVersionProcessor();
    if (version == null) {
        version = executionData.getVersions().keySet().iterator().next();
        LOG.info("Version was not defined, using " + version);
    }
    final TestCase test = new TestCase(testName);
    final VersionStaticSelection versionInfo = staticTestSelection.getVersions().get(version);
    boolean found = versionInfo.getTests().getTests().contains(test);
    if (!found) {
        LOG.error("Test " + test + " is not contained in regression test selection result, therefore it is unlikely to have a performance change!");
    }
    final String predecessor = versionInfo.getPredecessor();
    LOG.debug("Timeout in minutes: {}", executionMixin.getTimeout());
    final MeasurementConfig measurementConfiguration = getConfiguration(predecessor);
    final CauseSearcherConfig causeSearcherConfig = new CauseSearcherConfig(test, causeSearchConfigMixin);
    if (kiekerConfigMixin.isUseAggregation() && measurementConfiguration.getKiekerConfig().getRecord() == AllowedKiekerRecord.OPERATIONEXECUTION) {
        throw new RuntimeException("Aggregation and OperationExecutionRecord can not be combined!");
    }
    final CauseSearchFolders alternateFolders = new CauseSearchFolders(folders.getProjectFolder());
    final BothTreeReader reader = new BothTreeReader(causeSearcherConfig, measurementConfiguration, alternateFolders, new EnvironmentVariables());
    final CauseSearcher tester = getCauseSeacher(measurementConfiguration, causeSearcherConfig, alternateFolders, reader);
    tester.search();
    return null;
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) LevelCauseSearcher(de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher) CauseSearcher(de.dagere.peass.measurement.rca.searcher.CauseSearcher) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) BothTreeReader(de.dagere.peass.measurement.rca.kieker.BothTreeReader) CauseSearcherConfig(de.dagere.peass.measurement.rca.CauseSearcherConfig)

Example 3 with VersionStaticSelection

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

the class DependencyDetectorParameterizedIT method testNormalChange.

@Test
public void testNormalChange() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException {
    final ChangeManager changeManager = changeManagerWithParameter();
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(NORMAL_CHANGE));
    final DependencyReader reader = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator);
    System.out.println(reader.getDependencies().getInitialversion().getInitialDependencies());
    VersionStaticSelection firstVersion = reader.getDependencies().getVersions().get(DependencyTestConstants.VERSION_1);
    System.out.println(firstVersion.getChangedClazzes());
    Assert.assertEquals(3, reader.getDependencies().getInitialversion().getInitialDependencies().size());
    TestSet selectedTest = firstVersion.getChangedClazzes().get(new ChangedEntity("defaultpackage.NormalDependency#onlyCalledWithOne"));
    Assert.assertEquals(new TestCase("TestMe#testMe(JUNIT_PARAMETERIZED-2)"), selectedTest.getTests().iterator().next());
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) VersionIterator(de.dagere.peass.vcs.VersionIterator) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) Test(org.junit.jupiter.api.Test)

Example 4 with VersionStaticSelection

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

the class TestDependencies method testRunningersions.

@Test
public void testRunningersions() {
    StaticTestSelection dependencies = new StaticTestSelection();
    dependencies.setInitialversion(new InitialVersion());
    dependencies.getInitialversion().setVersion("0");
    VersionStaticSelection running1 = new VersionStaticSelection();
    running1.setRunning(true);
    dependencies.getVersions().put("1", running1);
    VersionStaticSelection nonRunning2 = new VersionStaticSelection();
    nonRunning2.setRunning(false);
    dependencies.getVersions().put("2", nonRunning2);
    VersionStaticSelection running3 = new VersionStaticSelection();
    running3.setRunning(true);
    dependencies.getVersions().put("3", running3);
    String[] versionNames = dependencies.getRunningVersionNames();
    Assert.assertEquals("0", versionNames[0]);
    Assert.assertEquals("1", versionNames[1]);
    Assert.assertEquals("3", versionNames[2]);
    Assert.assertEquals("3", dependencies.getNewestVersion());
}
Also used : InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

Example 5 with VersionStaticSelection

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

the class DependencyReader method documentFailure.

public void documentFailure(final String version) {
    if (dependencyManager.getExecutor().isAndroid()) {
        dependencyResult.setAndroid(true);
        executionResult.setAndroid(true);
        coverageBasedSelection.setAndroid(true);
    }
    LOG.error("Version not running");
    final VersionStaticSelection newVersionInfo = new VersionStaticSelection();
    newVersionInfo.setRunning(false);
    dependencyResult.getVersions().put(version, newVersionInfo);
}
Also used : VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection)

Aggregations

VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)24 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)12 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)10 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)9 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)8 Test (org.junit.jupiter.api.Test)7 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)5 File (java.io.File)5 InitialVersion (de.dagere.peass.dependency.persistence.InitialVersion)4 Map (java.util.Map)4 LinkedList (java.util.LinkedList)3 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)2 PeassFolders (de.dagere.peass.folders.PeassFolders)2 KiekerConfig (de.dagere.peass.config.KiekerConfig)1 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)1 TestSelectionConfig (de.dagere.peass.config.TestSelectionConfig)1 ChangeManager (de.dagere.peass.dependency.ChangeManager)1 KiekerResultManager (de.dagere.peass.dependency.KiekerResultManager)1 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)1 ChangeTestMapping (de.dagere.peass.dependency.analysis.data.ChangeTestMapping)1