org.junit,
org.simantics.modeling;bundle-version="1.1.1",
org.slf4j.api,
- org.simantics.db.testing
+ org.simantics.db.testing,
+ org.simantics.debug.browser;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.simantics.tests.modelled,
public class ModelledSTSRunner extends ParentRunner<ModelledSTSSuiteRunner> {
+ public static final String INCLUSION_FILTER = "org.simantics.tests.modelled.singleTestIncludeFilter";
public static final String EXCLUSION_FILTER = "org.simantics.tests.modelled.excludeFilter";
private final List<ModelledSTSSuiteRunner> children;
try {
initialize0();
Collection<ModelledSTSSuite> suites = STSSuiteTestCollector.collectTests();
+
+ // Filter exclusions
String exclusionFilter = System.getProperty(EXCLUSION_FILTER);
Collection<ModelledSTSSuite> filtered;
if (exclusionFilter != null) {
} else {
filtered = suites;
}
+ // Filter inclusions
+// String inclusionFilter = System.getProperty(INCLUSION_FILTER);
+// Collection<ModelledSTSSuite> included;
+// if (inclusionFilter != null) {
+// String[] filters = inclusionFilter.split(",");
+// included = filtered.stream().filter(s -> startsWithAny(s, filters)).collect(Collectors.toList());
+// } else {
+// included = filtered;
+// }
+
// Sort by priority
+// List<ModelledSTSSuite> sorted = included.stream().sorted((o1, o2) -> Integer.compare(o1.getPriority(), o2.getPriority())).collect(Collectors.toList());
List<ModelledSTSSuite> sorted = filtered.stream().sorted((o1, o2) -> Integer.compare(o1.getPriority(), o2.getPriority())).collect(Collectors.toList());
private void initialize0() throws Exception {
AcornTests.newSimanticsWorkspace(null, null);
+ org.simantics.debug.browser.internal.Activator.getDefault().startDebugServer();
initialize();
}
private void deinitialize0() throws Exception {
deinitialize();
+ org.simantics.debug.browser.internal.Activator.getDefault().stopDebugServer();
Simantics.shutdown(new NullProgressMonitor());
}
}
super(ModelledSTSSuiteRunner.class);
this.suite = suite;
this.children = new ArrayList<>(suite.getChildren().size());
+
+ // Do possible filtering
+ // Filter exclusions
+ String exclusionFilter = System.getProperty(ModelledSTSRunner.EXCLUSION_FILTER);
+ // Filter inclusions
+ String inclusionFilter = System.getProperty(ModelledSTSRunner.INCLUSION_FILTER);
for (ModelledSTSTest test : suite.getSortedChildren()) {
- children.add(new ModelledSTSTestRunner(test));
+ boolean add = false;
+ if (exclusionFilter != null) {
+ String[] filters = exclusionFilter.split(",");
+ if (!startsWithAny(test, filters)) {
+ add = true;
+ }
+ }
+ if (inclusionFilter != null) {
+ String[] filters = inclusionFilter.split(",");
+ if (!startsWithAny(test, filters)) {
+ add = false;
+ }
+ }
+ if (add)
+ children.add(new ModelledSTSTestRunner(test));
}
}
+ private static boolean startsWithAny(ModelledSTSTest test, String[] filters) {
+ for (String filter : filters) {
+ if (test.getName().contains(filter)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
@Override
protected String getName() {
return suite.getName();
}
notifier.fireTestStarted(description);
List<CommandSessionVariable> newVars = child.runWithVars(variables);
- storedVariables.put(child.getTest().getName(), newVars);
+// TODO: FIX THIS BY NOT ADDING ALL VARIABLES TO MEMORY (CAN BE HUGE)
+// storedVariables.put(child.getTest().getName(), newVars);
notifier.fireTestFinished(description);
} catch (Throwable e) {
notifier.fireTestFailure(new Failure(description, e));
public List<CommandSessionVariable> run(List<CommandSessionVariable> vars) throws IOException {
ModuleRepository repo = new ModuleRepository(SCLOsgi.SOURCE_REPOSITORY);
+ CommandSession session = null;
try {
repo.setAdvisor(new ModuleCompilationOptionsAdvisor() {
});
SCLReportingHandler handler = (SCLReportingHandler) SCLContext.getCurrent().get(SCLReportingHandler.REPORTING_HANDLER);
- CommandSession session = new CommandSession(repo, handler);
+ session = new CommandSession(repo, handler);
for (CommandSessionVariable var : vars)
session.setVariable(var.getName(), var.getType(), var.getValue());