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%2FModelledSTSSuiteRunner.java;h=ac42653e57d5536ce776cfd47092413b3ca8ef86;hp=11931d824c3990c432aece73020949d1bb058491;hb=2fb951a4a92e4a863a54c645bae18c2b9aa274bf;hpb=cd109cfc863adf6e9207cb77396b52f10d26a849 diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSSuiteRunner.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSSuiteRunner.java index 11931d824..ac42653e5 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSSuiteRunner.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSSuiteRunner.java @@ -25,11 +25,40 @@ public class ModelledSTSSuiteRunner extends ParentRunner 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(); @@ -61,7 +90,8 @@ public class ModelledSTSSuiteRunner extends ParentRunner } notifier.fireTestStarted(description); List 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));