Search in sources :

Example 1 with ExecutorCreator

use of de.dagere.peass.dependency.ExecutorCreator in project peass by DaGeRe.

the class TestParallelMeasurement method testFiles.

@Test
public void testFiles() throws Exception {
    try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
        MockedStatic<ExecutorCreator> mockedExecutor = Mockito.mockStatic(ExecutorCreator.class);
        MockedStatic<GitUtils> gitUtils = Mockito.mockStatic(GitUtils.class)) {
        VCSTestUtils.mockGetVCS(mockedVCS);
        VCSTestUtils.mockGoToTagEmpty(gitUtils);
        final PeassFolders folders = new PeassFolders(folder.getRoot());
        final MeasurementConfig configuration = new MeasurementConfig(4, "2", "1");
        configuration.setMeasurementStrategy(MeasurementStrategy.PARALLEL);
        MavenTestExecutorMocker.mockExecutor(mockedExecutor, folders, configuration);
        DependencyTester spiedTester = createTesterNoThreads(folders, configuration);
        spiedTester.evaluate(TestDependencyTester.EXAMPLE_TESTCASE);
        TestDependencyTester.checkResult(folders);
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) TestDependencyTester(de.dagere.peass.measurement.analysis.TestDependencyTester) DependencyTester(de.dagere.peass.measurement.dependencyprocessors.DependencyTester) GitUtils(de.dagere.peass.vcs.GitUtils) ExecutorCreator(de.dagere.peass.dependency.ExecutorCreator) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.Test)

Example 2 with ExecutorCreator

use of de.dagere.peass.dependency.ExecutorCreator in project peass by DaGeRe.

the class TestContinuousMeasurementExecutor method testConfigurationChange.

@Test
public void testConfigurationChange() throws IOException, InterruptedException, JAXBException, XmlPullParserException {
    try (MockedStatic<ExecutorCreator> executorCreatorMock = Mockito.mockStatic(ExecutorCreator.class)) {
        mockExecutorCreation();
        final PeassFolders folders = new PeassFolders(new File(parentFile, "project"));
        MeasurementConfig measurementConfig = createMeasurementConfig();
        ContinuousMeasurementExecutor cme = new ContinuousMeasurementExecutor(folders, measurementConfig, new EnvironmentVariables());
        Set<TestCase> tests = buildTestSet();
        File logFile = new File(parentFile, "log.txt");
        File fullResultsVersion = new File(parentFile, "fullResultsVersion");
        Answer<Void> answerOnceRunner = mockOnceRunner(folders);
        Answer<Object> answerResultLoader = mockResultLoader();
        try (MockedConstruction<OnceRunner> onceRunncerConstruction = Mockito.mockConstructionWithAnswer(OnceRunner.class, answerOnceRunner);
            MockedConstruction<ResultLoader> resultLoaderConstruction = Mockito.mockConstructionWithAnswer(ResultLoader.class, answerResultLoader)) {
            File measurementResultFolder = cme.executeMeasurements(tests, fullResultsVersion, logFile);
            checkResults(executorCreatorMock, measurementConfig, measurementResultFolder);
        }
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) ResultLoader(de.dagere.peass.measurement.dataloading.ResultLoader) PeassFolders(de.dagere.peass.folders.PeassFolders) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) OnceRunner(de.dagere.peass.measurement.dependencyprocessors.OnceRunner) ExecutorCreator(de.dagere.peass.dependency.ExecutorCreator) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 3 with ExecutorCreator

use of de.dagere.peass.dependency.ExecutorCreator in project peass by DaGeRe.

the class TestDependencyTester method testFiles.

@Test
public void testFiles() throws Exception {
    try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
        MockedStatic<ExecutorCreator> mockedExecutor = Mockito.mockStatic(ExecutorCreator.class);
        MockedStatic<GitUtils> utils = Mockito.mockStatic(GitUtils.class)) {
        VCSTestUtils.mockGetVCS(mockedVCS);
        final PeassFolders folders = new PeassFolders(folder.getRoot());
        final MeasurementConfig configuration = new MeasurementConfig(4, "2", "1");
        VCSTestUtils.mockExecutor(mockedExecutor, folders, configuration);
        final DependencyTester tester = new DependencyTester(folders, configuration, new EnvironmentVariables());
        tester.evaluate(EXAMPLE_TESTCASE);
        checkResult(folders);
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) DependencyTester(de.dagere.peass.measurement.dependencyprocessors.DependencyTester) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) GitUtils(de.dagere.peass.vcs.GitUtils) ExecutorCreator(de.dagere.peass.dependency.ExecutorCreator) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.Test)

Example 4 with ExecutorCreator

use of de.dagere.peass.dependency.ExecutorCreator in project peass by DaGeRe.

the class AdaptiveTesterTest method testIterationUpdate.

@Test
public void testIterationUpdate() throws IOException, InterruptedException, JAXBException, XmlPullParserException {
    try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
        MockedStatic<ExecutorCreator> mockedExecutor = Mockito.mockStatic(ExecutorCreator.class)) {
        VCSTestUtils.mockGetVCS(mockedVCS);
        VCSTestUtils.mockExecutor(mockedExecutor);
        final int vms = 10;
        final MeasurementConfig config = new MeasurementConfig(vms, "A", "B");
        config.setIterations(1000);
        MeasurementConfig config2 = Mockito.spy(config);
        Mockito.when(testGenerator.getConfig()).thenReturn(config2);
        AdaptiveTester tester2 = prepareTester();
        Mockito.doReturn(false).when(tester2).checkIsDecidable(Mockito.eq(testcase), Mockito.anyInt());
        for (int i = 0; i < vms; i++) {
            final Result result1 = new Result();
            result1.setValue(15);
            result1.setIterations(40);
            Mockito.doReturn(result1).when(tester2).getLastResult("A", testcase, i);
            final Result result2 = new Result();
            result2.setValue(17);
            result2.setIterations(40);
            Mockito.doReturn(result2).when(tester2).getLastResult("B", testcase, i);
        }
        tester2.evaluate(testcase);
        Assert.assertEquals(vms, tester2.getFinishedVMs());
        Mockito.verify(config2).setIterations(38);
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) AdaptiveTester(de.dagere.peass.measurement.dependencyprocessors.AdaptiveTester) ExecutorCreator(de.dagere.peass.dependency.ExecutorCreator) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) Result(de.dagere.kopeme.generated.Result) Test(org.junit.Test)

Aggregations

MeasurementConfig (de.dagere.peass.config.MeasurementConfig)4 ExecutorCreator (de.dagere.peass.dependency.ExecutorCreator)4 PeassFolders (de.dagere.peass.folders.PeassFolders)3 VersionControlSystem (de.dagere.peass.vcs.VersionControlSystem)3 Test (org.junit.Test)3 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)2 DependencyTester (de.dagere.peass.measurement.dependencyprocessors.DependencyTester)2 GitUtils (de.dagere.peass.vcs.GitUtils)2 Result (de.dagere.kopeme.generated.Result)1 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)1 TestDependencyTester (de.dagere.peass.measurement.analysis.TestDependencyTester)1 ResultLoader (de.dagere.peass.measurement.dataloading.ResultLoader)1 AdaptiveTester (de.dagere.peass.measurement.dependencyprocessors.AdaptiveTester)1 OnceRunner (de.dagere.peass.measurement.dependencyprocessors.OnceRunner)1 File (java.io.File)1 Test (org.junit.jupiter.api.Test)1