@Test public void testPrivateFractionCrash() { Botsing botsing = new Botsing(); String user_dir = System.getProperty("user.dir"); File file = new File(user_dir); String base_dir = Paths.get(file.getParent(), "botsing-examples").toString(); File outputDir = Paths.get(user_dir, "target", "crash-reproduction-tests").toFile(); String[] prop = { "-" + CommandLineParameters.CRASH_LOG_OPT, Paths.get(base_dir, "src", "main", "resources", "PrivateFraction.log").toString(), "-" + CommandLineParameters.TARGET_FRAME_OPT, "" + 1, "-" + CommandLineParameters.PROJECT_CP_OPT, Paths.get(base_dir, "target", "classes").toString() + System.getProperty("path.separator"), "-" + CommandLineParameters.D_OPT + "test_dir=" + outputDir.getAbsolutePath(), "-"+CommandLineParameters.SEARCH_ALGORITHM, CrashProperties.SearchAlgorithm.Guided_MOSA.name(), "-"+CommandLineParameters.FITNESS_FUNCTION, CrashProperties.FitnessFunction.IntegrationSingleObjective.name() }; List<TestGenerationResult> results = botsing.parseCommandLine(prop); assertTrue(results.size() > 0); assertEquals(TestGenerationResult.Status.SUCCESS, results.get(0).getTestGenerationStatus()); assertThat(outputDir, anExistingDirectory()); assertThat(outputDir.list(), arrayWithSize(greaterThan(0))); }
public List<TestGenerationResult> parseCommandLine(String[] args) { CrashProperties crashProperties = CrashProperties.getInstance(); Options options = CommandLineParameters.getCommandLineOptions(); CommandLine commands = parseCommands(args, options, false); if (commands.hasOption(HELP_OPT)) { printHelpMessage(options, false); } else if(!(commands.hasOption(PROJECT_CP_OPT) && commands.hasOption(CRASH_LOG_OPT) && commands.hasOption(TARGET_FRAME_OPT))) { LOG.error("A mandatory option -{} -{} -{} is missing!", PROJECT_CP_OPT, CRASH_LOG_OPT, TARGET_FRAME_OPT); printHelpMessage(options, false); } else { java.util.Properties properties = commands.getOptionProperties(D_OPT); updateEvoSuiteProperties(properties); crashProperties.setClasspath(getCompatibleCP(commands.getOptionValue(PROJECT_CP_OPT))); setupProjectClasspath(crashProperties.getProjectClassPaths()); setupStackTrace(crashProperties, commands); if(commands.hasOption(SEARCH_ALGORITHM)){ setSearchAlgorithm(commands.getOptionValue(SEARCH_ALGORITHM)); } if(commands.hasOption(FITNESS_FUNCTION)){ setFF(commands.getOptionValue(FITNESS_FUNCTION)); } if(commands.hasOption(INTEGRATION_TESTING)){ CrashProperties.integrationTesting = true; } if(commands.hasOption(DISABLE_LINE_ESTIMATION)){ CrashProperties.lineEstimation = false; } if(commands.hasOption(IO_DIVERSITY)){ CrashProperties.IODiversity = true; } if(commands.hasOption(MODEL_PATH_OPT)){ setupModelSeedingRelatedProperties(commands); } return CrashReproduction.execute(); } return null; }
Botsing { public List<TestGenerationResult> parseCommandLine(String[] args) { CrashProperties crashProperties = CrashProperties.getInstance(); Options options = CommandLineParameters.getCommandLineOptions(); CommandLine commands = parseCommands(args, options, false); if (commands.hasOption(HELP_OPT)) { printHelpMessage(options, false); } else if(!(commands.hasOption(PROJECT_CP_OPT) && commands.hasOption(CRASH_LOG_OPT) && commands.hasOption(TARGET_FRAME_OPT))) { LOG.error("A mandatory option -{} -{} -{} is missing!", PROJECT_CP_OPT, CRASH_LOG_OPT, TARGET_FRAME_OPT); printHelpMessage(options, false); } else { java.util.Properties properties = commands.getOptionProperties(D_OPT); updateEvoSuiteProperties(properties); crashProperties.setClasspath(getCompatibleCP(commands.getOptionValue(PROJECT_CP_OPT))); setupProjectClasspath(crashProperties.getProjectClassPaths()); setupStackTrace(crashProperties, commands); if(commands.hasOption(SEARCH_ALGORITHM)){ setSearchAlgorithm(commands.getOptionValue(SEARCH_ALGORITHM)); } if(commands.hasOption(FITNESS_FUNCTION)){ setFF(commands.getOptionValue(FITNESS_FUNCTION)); } if(commands.hasOption(INTEGRATION_TESTING)){ CrashProperties.integrationTesting = true; } if(commands.hasOption(DISABLE_LINE_ESTIMATION)){ CrashProperties.lineEstimation = false; } if(commands.hasOption(IO_DIVERSITY)){ CrashProperties.IODiversity = true; } if(commands.hasOption(MODEL_PATH_OPT)){ setupModelSeedingRelatedProperties(commands); } return CrashReproduction.execute(); } return null; } }
Botsing { public List<TestGenerationResult> parseCommandLine(String[] args) { CrashProperties crashProperties = CrashProperties.getInstance(); Options options = CommandLineParameters.getCommandLineOptions(); CommandLine commands = parseCommands(args, options, false); if (commands.hasOption(HELP_OPT)) { printHelpMessage(options, false); } else if(!(commands.hasOption(PROJECT_CP_OPT) && commands.hasOption(CRASH_LOG_OPT) && commands.hasOption(TARGET_FRAME_OPT))) { LOG.error("A mandatory option -{} -{} -{} is missing!", PROJECT_CP_OPT, CRASH_LOG_OPT, TARGET_FRAME_OPT); printHelpMessage(options, false); } else { java.util.Properties properties = commands.getOptionProperties(D_OPT); updateEvoSuiteProperties(properties); crashProperties.setClasspath(getCompatibleCP(commands.getOptionValue(PROJECT_CP_OPT))); setupProjectClasspath(crashProperties.getProjectClassPaths()); setupStackTrace(crashProperties, commands); if(commands.hasOption(SEARCH_ALGORITHM)){ setSearchAlgorithm(commands.getOptionValue(SEARCH_ALGORITHM)); } if(commands.hasOption(FITNESS_FUNCTION)){ setFF(commands.getOptionValue(FITNESS_FUNCTION)); } if(commands.hasOption(INTEGRATION_TESTING)){ CrashProperties.integrationTesting = true; } if(commands.hasOption(DISABLE_LINE_ESTIMATION)){ CrashProperties.lineEstimation = false; } if(commands.hasOption(IO_DIVERSITY)){ CrashProperties.IODiversity = true; } if(commands.hasOption(MODEL_PATH_OPT)){ setupModelSeedingRelatedProperties(commands); } return CrashReproduction.execute(); } return null; }  }
Botsing { public List<TestGenerationResult> parseCommandLine(String[] args) { CrashProperties crashProperties = CrashProperties.getInstance(); Options options = CommandLineParameters.getCommandLineOptions(); CommandLine commands = parseCommands(args, options, false); if (commands.hasOption(HELP_OPT)) { printHelpMessage(options, false); } else if(!(commands.hasOption(PROJECT_CP_OPT) && commands.hasOption(CRASH_LOG_OPT) && commands.hasOption(TARGET_FRAME_OPT))) { LOG.error("A mandatory option -{} -{} -{} is missing!", PROJECT_CP_OPT, CRASH_LOG_OPT, TARGET_FRAME_OPT); printHelpMessage(options, false); } else { java.util.Properties properties = commands.getOptionProperties(D_OPT); updateEvoSuiteProperties(properties); crashProperties.setClasspath(getCompatibleCP(commands.getOptionValue(PROJECT_CP_OPT))); setupProjectClasspath(crashProperties.getProjectClassPaths()); setupStackTrace(crashProperties, commands); if(commands.hasOption(SEARCH_ALGORITHM)){ setSearchAlgorithm(commands.getOptionValue(SEARCH_ALGORITHM)); } if(commands.hasOption(FITNESS_FUNCTION)){ setFF(commands.getOptionValue(FITNESS_FUNCTION)); } if(commands.hasOption(INTEGRATION_TESTING)){ CrashProperties.integrationTesting = true; } if(commands.hasOption(DISABLE_LINE_ESTIMATION)){ CrashProperties.lineEstimation = false; } if(commands.hasOption(IO_DIVERSITY)){ CrashProperties.IODiversity = true; } if(commands.hasOption(MODEL_PATH_OPT)){ setupModelSeedingRelatedProperties(commands); } return CrashReproduction.execute(); } return null; }  List<TestGenerationResult> parseCommandLine(String[] args); void setupStackTrace(CrashProperties crashProperties, CommandLine commands); @SuppressWarnings("checkstyle:systemexit") static void main(String[] args); }
Botsing { public List<TestGenerationResult> parseCommandLine(String[] args) { CrashProperties crashProperties = CrashProperties.getInstance(); Options options = CommandLineParameters.getCommandLineOptions(); CommandLine commands = parseCommands(args, options, false); if (commands.hasOption(HELP_OPT)) { printHelpMessage(options, false); } else if(!(commands.hasOption(PROJECT_CP_OPT) && commands.hasOption(CRASH_LOG_OPT) && commands.hasOption(TARGET_FRAME_OPT))) { LOG.error("A mandatory option -{} -{} -{} is missing!", PROJECT_CP_OPT, CRASH_LOG_OPT, TARGET_FRAME_OPT); printHelpMessage(options, false); } else { java.util.Properties properties = commands.getOptionProperties(D_OPT); updateEvoSuiteProperties(properties); crashProperties.setClasspath(getCompatibleCP(commands.getOptionValue(PROJECT_CP_OPT))); setupProjectClasspath(crashProperties.getProjectClassPaths()); setupStackTrace(crashProperties, commands); if(commands.hasOption(SEARCH_ALGORITHM)){ setSearchAlgorithm(commands.getOptionValue(SEARCH_ALGORITHM)); } if(commands.hasOption(FITNESS_FUNCTION)){ setFF(commands.getOptionValue(FITNESS_FUNCTION)); } if(commands.hasOption(INTEGRATION_TESTING)){ CrashProperties.integrationTesting = true; } if(commands.hasOption(DISABLE_LINE_ESTIMATION)){ CrashProperties.lineEstimation = false; } if(commands.hasOption(IO_DIVERSITY)){ CrashProperties.IODiversity = true; } if(commands.hasOption(MODEL_PATH_OPT)){ setupModelSeedingRelatedProperties(commands); } return CrashReproduction.execute(); } return null; }  List<TestGenerationResult> parseCommandLine(String[] args); void setupStackTrace(CrashProperties crashProperties, CommandLine commands); @SuppressWarnings("checkstyle:systemexit") static void main(String[] args);  }