use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class JmhTestTransformer method findModuleTests.
public TestSet findModuleTests(final ModuleClassMapping mapping, final List<String> includedModules, final File module) throws FileNotFoundException {
TestSet moduleTests = new TestSet();
ClazzFileFinder finder = new ClazzFileFinder(measurementConfig.getExecutionConfig());
for (final String clazz : finder.getClasses(module)) {
String currentModule = ModuleClassMapping.getModuleName(projectFolder, module);
final List<TestCase> testMethodNames = getTestMethodNames(module, new TestCase(clazz, null, currentModule));
for (TestCase test : testMethodNames) {
if (includedModules == null || includedModules.contains(test.getModule())) {
addTestIfIncluded(moduleTests, test);
}
}
}
return moduleTests;
}
use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class JmhTestTransformer method findModuleTests.
// TODO includedModules is currenctly ignored for jmh!
@Override
public TestSet findModuleTests(final ModuleClassMapping mapping, final List<String> includedModules, final ProjectModules modules) {
TestSet allBenchmarks = new TestSet();
try {
for (File module : modules.getModules()) {
TestSet moduleTests = findModuleTests(mapping, includedModules, module);
allBenchmarks.addTestSet(moduleTests);
}
} catch (FileNotFoundException e) {
throw new RuntimeException("File was not found, can not handle this error", e);
}
return allBenchmarks;
}
use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class JmhTestTransformer method buildTestMethodSet.
@Override
public TestSet buildTestMethodSet(final TestSet testsToUpdate, final List<File> modules) {
final TestSet tests = new TestSet();
for (final TestCase clazzname : testsToUpdate.getClasses()) {
final Set<String> currentClazzMethods = testsToUpdate.getMethods(clazzname);
if (currentClazzMethods == null || currentClazzMethods.isEmpty()) {
final File moduleFolder = new File(projectFolder, clazzname.getModule());
final List<TestCase> methods = getTestMethodNames(moduleFolder, clazzname);
for (final TestCase test : methods) {
addTestIfIncluded(tests, test);
}
} else {
for (final String method : currentClazzMethods) {
TestCase test = new TestCase(clazzname.getClazz(), method, clazzname.getModule());
tests.addTest(test);
}
}
}
return tests;
}
use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class TestBenchmarkDetection method testBenchmarkDetectionInnerClass.
@Test
public void testBenchmarkDetectionInnerClass() throws FileNotFoundException, IOException, XmlPullParserException {
JmhTestTransformer jmhTransformer = new JmhTestTransformer(JmhTestConstants.INNER_CLASS_VERSION, JMH_CONFIG);
ProjectModules modules = new ProjectModules(JmhTestConstants.INNER_CLASS_VERSION);
TestSet tests = jmhTransformer.findModuleTests(new ModuleClassMapping(JmhTestConstants.INNER_CLASS_VERSION, modules, new ExecutionConfig()), null, modules);
Assert.assertEquals(tests.getTests().size(), 1);
TestCase test = tests.getTests().iterator().next();
Assert.assertEquals("de.dagere.peass.ExampleBenchmark#testMethod", test.getExecutable());
}
use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class TestCreateMeasurementExecutionScript method buildExecutionDataWithTests.
private ExecutionData buildExecutionDataWithTests() {
StaticTestSelection dependencies = TestExecutionData.buildExampleDependencies();
VersionStaticSelection version2 = dependencies.getVersions().get("000002");
version2.getChangedClazzes().put(new ChangedEntity("Test1#testMe"), new TestSet(new TestCase("Test1#testMe")));
VersionStaticSelection version5 = dependencies.getVersions().get("000005");
version5.getChangedClazzes().put(new ChangedEntity("Test5#testMe"), new TestSet(new TestCase("Test5#testMe")));
ExecutionData executiondata = new ExecutionData(dependencies);
return executiondata;
}
Aggregations