本文整理汇总了Java中osmo.common.TestUtils.recursiveDelete方法的典型用法代码示例。如果您正苦于以下问题:Java TestUtils.recursiveDelete方法的具体用法?Java TestUtils.recursiveDelete怎么用?Java TestUtils.recursiveDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osmo.common.TestUtils
的用法示例。
在下文中一共展示了TestUtils.recursiveDelete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: failureCollector
import osmo.common.TestUtils; //导入方法依赖的package包/类
@Test
public void failureCollector() {
ErrorModelProbability model = new ErrorModelProbability();
OSMOTester tester = new OSMOTester();
Length length = new Length(10);
tester.setSuiteEndCondition(length);
tester.setTestEndCondition(length);
OSMOConfiguration config = tester.getConfig();
config.setKeepTests(false);
config.setStopGenerationOnError(false);
config.setStopTestOnError(true);
FailureCollector collector = new FailureCollector();
config.addListener(collector);
tester.addModelObject(model);
tester.generate(1);
TestSuite suite = tester.getSuite();
List<TestCase> tests = suite.getAllTestCases();
assertEquals("Number of tests in generator", 0, tests.size());
assertEquals("Number of collected failures", 7, collector.getFailed().size());
final String listenerFolder = "osmo-output/listener";
TestUtils.recursiveDelete(listenerFolder);
collector.writeTrace(listenerFolder);
TestLoader loader = new TestLoader();
List<TestScript> scripts = loader.loadTests(listenerFolder);
assertEquals("Number of loaded tests", 7, scripts.size());
}
示例2: search
import osmo.common.TestUtils; //导入方法依赖的package包/类
/**
* Initializes a set of {@link GreedyOptimizer} instances to search for an optimal set of tests (test suite).
*
* @return The optimized set of tests.
*/
public List<TestCase> search() {
if (deleteOldOutput) TestUtils.recursiveDelete("osmo-output");
long start = System.currentTimeMillis();
List<TestCase> tests = generate();
log.i("sorting set from all optimizers");
//this does the final round of optimization for the set received from all optimizers..
tests = GreedyOptimizer.sortAndPrune(-1, tests, calculator, max);
tests = trimToMax(tests);
writeFinalReport(tests, rand.getSeed());
updateRequirements(tests);
log.i("search done");
long end = System.currentTimeMillis();
long seconds = (end-start)/1000;
System.out.println("duration of search: "+seconds+"s.");
for (IterationListener listener : listeners) {
listener.generationDone(tests);
}
return tests;
}
示例3: check
import osmo.common.TestUtils; //导入方法依赖的package包/类
/**
* Checks if current configuration has known issues, such as sharing model instances over tasks.
* Also deletes old output if so configured.
*/
private void check() {
if (osmoConfig.getFactory() instanceof SingleInstanceModelFactory) {
System.out.println(MultiOSMO.ERROR_MSG);
}
if (deleteOldOutput) {
TestUtils.recursiveDelete("osmo-output");
}
}
示例4: cleanup
import osmo.common.TestUtils; //导入方法依赖的package包/类
@After
public void cleanup() throws Exception {
//strangely it seems we need to run garbage collector or the file cannot be deleted..?
//http://stackoverflow.com/questions/991489/i-cant-delete-a-file-in-java
System.gc();
Thread.sleep(100);
TestUtils.recursiveDelete(TEMP_DIR);
}
示例5: probableModel
import osmo.common.TestUtils; //导入方法依赖的package包/类
@Test
public void probableModel() throws Exception {
TestUtils.recursiveDelete(REDUCER_FOLDER);
ReducerConfig config = new ReducerConfig(111);
config.setParallelism(1);
Reducer reducer = new Reducer(config);
OSMOConfiguration osmoConfig = reducer.getOsmoConfig();
osmoConfig.setFactory(new ReflectiveModelFactory(ErrorModelProbability.class));
config.setInitialTime(TimeUnit.SECONDS, 5);
config.setFuzzTime(TimeUnit.SECONDS, 5);
config.setShorteningTime(TimeUnit.SECONDS, 5);
config.setPopulationSize(50);
config.setLength(10);
config.setTestMode(true);
ReducerState state = reducer.search();
List<TestCase> tests = state.getTests();
assertEquals("Number of tests", 1, tests.size());
TestCase test1 = tests.get(0);
assertEquals("Final test length", 1, test1.getAllStepNames().size());
assertEquals("Iteration lengths", "[]", state.getLengths().toString());
String report = TestUtils.readFile(REDUCER_FOLDER + "/reducer-final.txt", "UTF8");
String expected = TestUtils.getResource(ReducerTests.class, "expected-reducer.txt");
report = TestUtils.unifyLineSeparators(report, "\n");
expected = TestUtils.unifyLineSeparators(expected, "\n");
assertEquals("Reducer report", expected, report);
List<String> files = TestUtils.listFiles(REDUCER_FOLDER, ".html", false);
assertEquals("Generated report files", "[final-tests.html]", files.toString());
}
示例6: model10
import osmo.common.TestUtils; //导入方法依赖的package包/类
@Test
public void model10() throws Exception {
TestUtils.recursiveDelete(REDUCER_FOLDER);
ReducerConfig config = new ReducerConfig(111);
config.setStrictReduction(false);
config.setParallelism(1);
//changed here on 8apr15
config.setInitialTime(TimeUnit.SECONDS, 10);
config.setFuzzTime(TimeUnit.SECONDS, 10);
config.setShorteningTime(TimeUnit.SECONDS, 10);
Reducer reducer = new Reducer(config);
OSMOConfiguration osmoConfig = reducer.getOsmoConfig();
osmoConfig.setFactory(new ReflectiveModelFactory(Model10Debug.class));
//TODO: move this to config object
reducer.setDeleteOldOutput(true);
// config.setTotalTime(TimeUnit.SECONDS, 1);
//TODO: length asettaa siis oikeasti sen pituuden ja jos osmo-config on mitään asetettu pitäisi herjata
config.setPopulationSize(1500);
config.setLength(50);
config.setTestMode(true);
ReducerState state = reducer.search();
List<TestCase> tests = state.getTests();
// assertEquals("Number of tests", 230, tests.size());
TestCase test1 = tests.get(0);
//this does not produce multiple tests as the initial fuzz only stores the shortest of all found failures
//since finding equally short failing tests by fuzzing is very unlikely, we end up with just one
//although it would be possible to have others as well..
// assertEquals("Final test length", 11, test1.getAllStepNames().size());
// assertEquals("Iteration lengths", "[25, 22, 17, 14, 13, 12, 11]", state.getLengths().toString());
String report = TestUtils.readFile(REDUCER_FOLDER + "/reducer-final.txt", "UTF8");
String expected = TestUtils.getResource(ReducerTests.class, "expected-reducer3.txt");
report = TestUtils.unifyLineSeparators(report, "\n");
expected = TestUtils.unifyLineSeparators(expected, "\n");
String[] replaced = TestUtils.replace("##", expected, report);
report = replaced[0];
expected = replaced[1];
assertEquals("Reducer report", expected, report);
List<String> files = TestUtils.listFiles(REDUCER_FOLDER, ".html", false);
assertEquals("Generated report files", "[final-tests.html]", files.toString());
}
示例7: deleteFiles
import osmo.common.TestUtils; //导入方法依赖的package包/类
public static void deleteFiles() {
TestUtils.recursiveDelete(DIR);
}
示例8: startTest
import osmo.common.TestUtils; //导入方法依赖的package包/类
@Test
public void startTest() throws Exception {
TestUtils.recursiveDelete(REDUCER_FOLDER);
ReducerConfig config = new ReducerConfig(111);
config.setParallelism(1);
//changed here on 8apr15
config.setInitialTime(TimeUnit.MINUTES, 10);
config.setFuzzTime(TimeUnit.SECONDS, 5);
config.setShorteningTime(TimeUnit.MINUTES, 10);
config.setTargetLength(11);
Reducer reducer = new Reducer(config);
ScriptBuilder builder = new ScriptBuilder();
builder.add(5, "Step4");
builder.add(5, "Step6");
builder.add(1, "Step8");
TestCase test = builder.create(11, new ReflectiveModelFactory(Model10Debug.class));
reducer.setStartTest(test);
OSMOConfiguration osmoConfig = reducer.getOsmoConfig();
osmoConfig.setFactory(new ReflectiveModelFactory(Model10Debug.class));
reducer.setDeleteOldOutput(true);
config.setPopulationSize(1500);
config.setLength(50);
config.setTestMode(true);
ReducerState state = reducer.search();
Analyzer analyzer = state.getAnalyzer();
Invariants invariants = analyzer.analyze();
assertThat(invariants.getFlexPrecedences())
.hasSize(2)
.contains("Step4->Step8")
.contains("Step6->Step8");
assertThat(invariants.getStrictPrecedences())
.hasSize(2)
.contains("Step4->Step8")
.contains("Step6->Step8");
assertThat(invariants.getLastSteps())
.hasSize(1)
.contains("Step8");
assertThat(invariants.getMissingSteps())
.hasSize(7)
.contains("Step1")
.contains("Step2")
.contains("Step3")
.contains("Step5")
.contains("Step7")
.contains("Step9")
.contains("Step10");
assertThat(invariants.getUsedStepCounts())
.hasSize(3)
.contains("Step4 : 5")
.contains("Step6 : 5")
.contains("Step8 : 1");
Collection<String> sequences = invariants.getSequences();
assertThat(sequences)
.hasSize(3)
.contains("[Step6]")
.contains("[Step8]");
boolean test4Seq = sequences.contains("[Step4]") || sequences.contains("[Step4, Step4]");
assertTrue("Step4 should be once or twice", test4Seq);
}
示例9: after
import osmo.common.TestUtils; //导入方法依赖的package包/类
@AfterMethod
public void after() {
TestUtils.recursiveDelete(OUTPUTDIR);
}