package org.simantics.tests.modelled.junit.v2;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
-import java.util.stream.Collectors;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.junit.runner.Description;
import org.junit.runners.model.InitializationError;
import org.simantics.Simantics;
import org.simantics.db.testing.common.AcornTests;
-import org.simantics.scl.compiler.commands.CommandSession;
-import org.simantics.scl.osgi.SCLOsgi;
+import org.simantics.tests.modelled.utils.ModelledSTSSuite;
import org.simantics.tests.modelled.utils.STSSuiteTestCollector;
public class ModelledSTSRunner extends ParentRunner<ModelledSTSSuiteRunner> {
- private CommandSession commandSession;
+ private final List<ModelledSTSSuiteRunner> children;
- public ModelledSTSRunner(Class<?> testClass) throws Exception {
+ public ModelledSTSRunner(Class<?> testClass) throws InitializationError {
super(testClass);
- initialize0();
+ try {
+ initialize0();
+ Collection<ModelledSTSSuite> suites = STSSuiteTestCollector.collectTests();
+ children = new ArrayList<>(suites.size());
+ for (ModelledSTSSuite suite : suites) {
+ children.add(new ModelledSTSSuiteRunner(suite));
+ }
+ } catch (Exception e) {
+ throw new InitializationError(e);
+ }
}
@Override
protected List<ModelledSTSSuiteRunner> getChildren() {
- return STSSuiteTestCollector.collectTests().stream().map(suite -> {
- try {
- return new ModelledSTSSuiteRunner(suite);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }).collect(Collectors.toList());
+ return children;
}
@Override
@Override
protected void runChild(ModelledSTSSuiteRunner child, RunNotifier notifier) {
- child.setCommandSesssion(commandSession);
child.run(notifier);
// TODO: Add coverage reporting to ModelledSTSRunner
// CombinedCoverage cover = child.getCoverage();
private void initialize0() throws Exception {
AcornTests.newSimanticsWorkspace(null, null);
- this.commandSession = new CommandSession(SCLOsgi.MODULE_REPOSITORY, null);
initialize();
}