X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.tests.modelled%2Fsrc%2Forg%2Fsimantics%2Ftests%2Fmodelled%2Fjunit%2Fv2%2FModelledSTSRunner.java;h=393174906afeb46e7530a71cdef4091c818507ec;hp=29628cec061e8b4ef5117da84d45947524cd3893;hb=3e8cd4aef089a228d7f2e141f2b2159f820a4266;hpb=e3944c748c450a0760b9525e53e36b96180103b4 diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSRunner.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSRunner.java index 29628cec0..393174906 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSRunner.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSRunner.java @@ -13,21 +13,30 @@ import org.junit.runner.notification.RunNotifier; import org.junit.runners.ParentRunner; import org.junit.runners.model.InitializationError; import org.simantics.Simantics; +import org.simantics.db.layer0.util.Layer0Utils; import org.simantics.db.testing.common.AcornTests; import org.simantics.tests.modelled.utils.ModelledSTSSuite; import org.simantics.tests.modelled.utils.STSSuiteTestCollector; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ModelledSTSRunner extends ParentRunner { + private static final Logger LOGGER = LoggerFactory.getLogger(ModelledSTSRunner.class); + + 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 children; public ModelledSTSRunner(Class testClass) throws InitializationError { super(testClass); + try { initialize0(); Collection suites = STSSuiteTestCollector.collectTests(); + + // Filter exclusions String exclusionFilter = System.getProperty(EXCLUSION_FILTER); Collection filtered; if (exclusionFilter != null) { @@ -36,7 +45,18 @@ public class ModelledSTSRunner extends ParentRunner { } else { filtered = suites; } + // Filter inclusions +// String inclusionFilter = System.getProperty(INCLUSION_FILTER); +// Collection 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 sorted = included.stream().sorted((o1, o2) -> Integer.compare(o1.getPriority(), o2.getPriority())).collect(Collectors.toList()); List sorted = filtered.stream().sorted((o1, o2) -> Integer.compare(o1.getPriority(), o2.getPriority())).collect(Collectors.toList()); @@ -82,7 +102,12 @@ public class ModelledSTSRunner extends ParentRunner { @Override protected void runChild(ModelledSTSSuiteRunner child, RunNotifier notifier) { - child.run(notifier); + try { + child.run(notifier); + } finally { + // Clear query cache + Layer0Utils.queryDebugSupport("QueryControl.flush"); + } // TODO: Add coverage reporting to ModelledSTSRunner // CombinedCoverage cover = child.getCoverage(); // CoverageBuilder b = new CoverageBuilder(); @@ -96,11 +121,13 @@ public class ModelledSTSRunner extends ParentRunner { 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()); } }