use of eu.stamp_project.dspot.common.configuration.InitializeDSpot in project dspot by STAMP-project.
the class ProjectJSONTest method setUp.
@Before
public void setUp() {
super.setUp();
this.configuration = new UserInput();
this.configuration.setAbsolutePathToProjectRoot(getPathToProjectRoot());
this.configuration.setOutputDirectory(outputDirectory);
this.builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
this.initializeDSpot = new InitializeDSpot();
String dependencies = initializeDSpot.completeDependencies(configuration, this.builder);
DSpotUtils.init(CommentEnum.None, outputDirectory, this.configuration.getFullClassPathWithExtraDependencies(), this.getPathToProjectRoot());
this.compiler = DSpotCompiler.createDSpotCompiler(configuration, dependencies);
DSpotCache.init(10000);
Launcher launcher = new Launcher();
launcher.getEnvironment().setNoClasspath(true);
launcher.addInputResource(this.getPathToProjectRoot());
launcher.buildModel();
this.factory = launcher.getFactory();
TestFramework.init(this.factory);
testCompiler = new TestCompiler(0, false, this.getPathToProjectRoot(), this.configuration.getClasspathClassesProject(), 10000, "", false);
AssertionGeneratorUtils.init(false);
DSpotPOMCreator.createNewPom(configuration);
RandomHelper.setSeedRandom(72L);
ValueCreator.count = 0;
this.testSelector = new JacocoCoverageSelector(builder, configuration);
try {
FileUtils.forceDelete(new File(outputDirectory));
} catch (Exception ignored) {
}
}
use of eu.stamp_project.dspot.common.configuration.InitializeDSpot in project dspot by STAMP-project.
the class DSpotUtilsTest method setUp.
@Override
@Before
public void setUp() {
super.setUp();
super.setUp();
this.configuration = new UserInput();
this.configuration.setAbsolutePathToProjectRoot(getPathToProjectRoot());
this.configuration.setOutputDirectory(outputDirectory.getAbsolutePath());
this.builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
this.initializeDSpot = new InitializeDSpot();
String dependencies = initializeDSpot.completeDependencies(configuration, this.builder);
DSpotUtils.init(CommentEnum.None, outputDirectory.getAbsolutePath(), this.configuration.getFullClassPathWithExtraDependencies(), this.getPathToProjectRoot());
this.compiler = DSpotCompiler.createDSpotCompiler(configuration, dependencies);
}
use of eu.stamp_project.dspot.common.configuration.InitializeDSpot in project dspot by STAMP-project.
the class Main method run.
public static List<CtMethod<?>> run(CtType<?> amplifiedTestClass, UserInput configuration) {
InitializeDSpot initializeDSpot = new InitializeDSpot();
final AutomaticBuilder automaticBuilder = configuration.getBuilderEnum().getAutomaticBuilder(configuration);
final String dependencies = initializeDSpot.completeDependencies(configuration, automaticBuilder);
final DSpotCompiler compiler = DSpotCompiler.createDSpotCompiler(configuration, dependencies);
configuration.setFactory(compiler.getLauncher().getFactory());
initializeDSpot.initHelpers(configuration);
final List<CtMethod<?>> testMethods = TestFramework.getAllTest(amplifiedTestClass);
Main.report.nbTestMethods = testMethods.size();
final List<CtMethod<?>> minimizedAmplifiedTestMethods;
// 1 minimize amplified test methods
if (configuration.isApplyAllPrettifiers() || configuration.isApplyGeneralMinimizer() || configuration.isApplyPitMinimizer()) {
minimizedAmplifiedTestMethods = applyMinimization(testMethods, amplifiedTestClass, configuration);
} else {
minimizedAmplifiedTestMethods = testMethods;
}
// 2 rename test methods
if (configuration.isApplyAllPrettifiers() || configuration.isRenameTestMethods()) {
applyCode2Vec(minimizedAmplifiedTestMethods, configuration);
}
// 3 rename local variables TODO train one better model
final List<CtMethod<?>> prettifiedTestMethods;
if (configuration.isApplyAllPrettifiers() || configuration.isRenameLocalVariables()) {
prettifiedTestMethods = applyContext2Name(minimizedAmplifiedTestMethods);
} else {
prettifiedTestMethods = minimizedAmplifiedTestMethods;
}
return prettifiedTestMethods;
}
use of eu.stamp_project.dspot.common.configuration.InitializeDSpot in project dspot by STAMP-project.
the class AbstractSelectorRemoveOverlapTest method setUp.
@Before
public void setUp() {
DSpotState.verbose = true;
this.configuration = new UserInput();
this.configuration.setAbsolutePathToProjectRoot(getPathToAbsoluteProjectRoot());
this.configuration.setOutputDirectory(outputDirectory);
this.builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
this.initializeDSpot = new InitializeDSpot();
String dependencies = initializeDSpot.completeDependencies(configuration, this.builder);
DSpotUtils.init(CommentEnum.None, outputDirectory, this.configuration.getFullClassPathWithExtraDependencies(), this.getPathToAbsoluteProjectRoot());
this.compiler = DSpotCompiler.createDSpotCompiler(configuration, dependencies);
DSpotCache.init(10000);
Launcher launcher = new Launcher();
launcher.getEnvironment().setNoClasspath(true);
launcher.addInputResource(this.getPathToAbsoluteProjectRoot());
launcher.buildModel();
this.factory = launcher.getFactory();
TestFramework.init(this.factory);
this.testCompiler = new TestCompiler(0, false, this.getPathToAbsoluteProjectRoot(), this.configuration.getClasspathClassesProject(), 10000, "", false);
AssertionGeneratorUtils.init(false);
DSpotPOMCreator.createNewPom(configuration);
RandomHelper.setSeedRandom(72L);
ValueCreator.count = 0;
this.testSelectorUnderTest = this.getTestSelector();
}
use of eu.stamp_project.dspot.common.configuration.InitializeDSpot in project dspot by STAMP-project.
the class AbstractSelectorTest method setUp.
@Before
public void setUp() throws Exception {
DSpotState.verbose = true;
this.configuration = new UserInput();
this.configuration.setAbsolutePathToProjectRoot(getPathToAbsoluteProjectRoot());
this.configuration.setOutputDirectory(outputDirectory);
this.configuration.setGregorMode(true);
this.builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
this.initializeDSpot = new InitializeDSpot();
String dependencies = initializeDSpot.completeDependencies(configuration, this.builder);
DSpotUtils.init(CommentEnum.None, outputDirectory, this.configuration.getFullClassPathWithExtraDependencies(), this.getPathToAbsoluteProjectRoot());
this.compiler = DSpotCompiler.createDSpotCompiler(configuration, dependencies);
DSpotCache.init(10000);
Launcher launcher = new Launcher();
launcher.getEnvironment().setNoClasspath(true);
launcher.addInputResource(this.getPathToAbsoluteProjectRoot());
launcher.buildModel();
this.factory = launcher.getFactory();
TestFramework.init(this.factory);
this.testRunner = new TestRunner(this.getPathToAbsoluteProjectRoot(), "", false);
this.testCompiler = new TestCompiler(0, false, this.getPathToAbsoluteProjectRoot(), this.configuration.getClasspathClassesProject(), 10000, "", false);
AssertionGeneratorUtils.init(false);
DSpotPOMCreator.createNewPom(configuration);
RandomHelper.setSeedRandom(72L);
ValueCreator.count = 0;
this.testSelectorUnderTest = this.getTestSelector();
}
Aggregations