本文整理汇总了Java中osmo.common.TestUtils.listFiles方法的典型用法代码示例。如果您正苦于以下问题:Java TestUtils.listFiles方法的具体用法?Java TestUtils.listFiles怎么用?Java TestUtils.listFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osmo.common.TestUtils
的用法示例。
在下文中一共展示了TestUtils.listFiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate4
import osmo.common.TestUtils; //导入方法依赖的package包/类
@Test
public void generate4() throws Exception {
Thread.sleep(100);
MultiOSMO mosmo = new MultiOSMO(4);
OSMOConfiguration config = mosmo.getConfig();
config.setSequenceTraceRequested(true);
config.setFactory(new MyModelFactory());
config.setTestEndCondition(new Length(10));
config.setSuiteEndCondition(new Time(2));
mosmo.generate(new Time(1), 444);
// List<String> reports = TestUtils.listFiles(OUTPUT_FOLDER, ".csv", false);
// assertEquals("Number of reports generated", 4, reports.size());
List<String> traces = TestUtils.listFiles(OUTPUT_FOLDER, ".html", false);
assertEquals("Number of HTML traces generated", 4, traces.size());
List<String> xmls = TestUtils.listFiles(OUTPUT_FOLDER, ".xml", false);
assertEquals("Number of XML traces generated", 4, xmls.size());
}
示例2: loadTests
import osmo.common.TestUtils; //导入方法依赖的package包/类
public List<TestScript> loadTests(String dir) {
List<TestScript> scripts = new ArrayList<>();
List<String> files = TestUtils.listFiles(dir, "tc", true);
for (String file : files) {
String scriptText = TestUtils.readFile(file, "UTF8");
TestScript script = parse(scriptText);
scripts.add(script);
}
return scripts;
}
示例3: generate4times3
import osmo.common.TestUtils; //导入方法依赖的package包/类
@Ignore
@Test
public void generate4times3() {
MultiOSMO mosmo = new MultiOSMO(4);
OSMOConfiguration config = mosmo.getConfig();
config.setSequenceTraceRequested(true);
config.setFactory(new MyModelFactory());
config.setTestEndCondition(new Length(10));
config.setSuiteEndCondition(new Time(2));
mosmo.generate(new Time(6), 444);
List<String> reports = TestUtils.listFiles(OUTPUT_FOLDER, ".csv", false);
assertEquals("Number of reports generated", 5, reports.size());
List<String> traces = TestUtils.listFiles(OUTPUT_FOLDER, ".html", false);
assertEquals("Number of traces generated", 4, traces.size());
}
示例4: 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());
}
示例5: 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());
}