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);
}
}
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);
}
}
}
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);
}
}
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);
}
}
Aggregations