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%2FModelledSTSTestRunner.java;h=5f8ea6c16117fe90f4e4bad19b7095a54200e756;hp=a2acbfcb8d23edc93ab0a64d76c2ff6bc56a4377;hb=4789a20d317a245e03096df441baba1ab338c1f0;hpb=1cc487c3f6cf4b46b1fdd727183a9483e3bc05bb diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSTestRunner.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSTestRunner.java index a2acbfcb8..5f8ea6c16 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSTestRunner.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSTestRunner.java @@ -1,18 +1,14 @@ package org.simantics.tests.modelled.junit.v2; -import java.io.BufferedReader; -import java.io.StringReader; +import java.io.IOException; +import java.util.List; import org.junit.runner.Description; import org.junit.runner.Runner; +import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunNotifier; -import org.simantics.scl.compiler.commands.CommandSession; -import org.simantics.scl.compiler.commands.TestScriptExecutor; -import org.simantics.scl.osgi.SCLOsgi; -import org.simantics.scl.runtime.SCLContext; -import org.simantics.scl.runtime.reporting.SCLReportingHandler; import org.simantics.tests.modelled.utils.ModelledSTSTest; -import org.simantics.tests.modelled.utils.STSSuiteTestCollector; +import org.simantics.tests.modelled.utils.ModelledSTSTest.CommandSessionVariable; public class ModelledSTSTestRunner extends Runner { @@ -23,41 +19,20 @@ public class ModelledSTSTestRunner extends Runner { this.test = test; } - public String getName() { - return test.getName(); - } - @Override public Description getDescription() { if (description == null) - description = Description.createTestDescription(ModelledSTSTestRunner.class, getName()); + description = Description.createTestDescription(ModelledSTSTestRunner.class, test.getName()); return description; } - /** - * This method is called from ModelledSTSSuite (ParentRunner) with the same - * CommandSession - * - * @param session - */ - public void run(CommandSession session) { - try (BufferedReader reader = new BufferedReader(new StringReader(test.getCode()))) { - SCLReportingHandler handler = (SCLReportingHandler) SCLContext.getCurrent().get(SCLReportingHandler.REPORTING_HANDLER); - new TestScriptExecutor(session, reader, handler, true).execute(); - STSSuiteTestCollector.setTestCoverage(test, session); - } catch (Exception e) { - throw new RuntimeException(e); - } + public List runWithVars(List vars) throws IOException { + return test.run(vars); } - + @Override public void run(RunNotifier notifier) { - notifier.fireTestStarted(getDescription()); - try { - run(new CommandSession(SCLOsgi.MODULE_REPOSITORY, null)); - } finally { - notifier.fireTestFinished(getDescription()); - } + throw new UnsupportedOperationException(); } public boolean isIgnored() {