1 package org.simantics.tests.modelled.junit.v2;
3 import java.util.ArrayList;
4 import java.util.Collection;
7 import org.eclipse.core.runtime.NullProgressMonitor;
8 import org.junit.runner.Description;
9 import org.junit.runner.Result;
10 import org.junit.runner.notification.RunListener;
11 import org.junit.runner.notification.RunNotifier;
12 import org.junit.runners.ParentRunner;
13 import org.junit.runners.model.InitializationError;
14 import org.simantics.Simantics;
15 import org.simantics.db.testing.common.AcornTests;
16 import org.simantics.tests.modelled.utils.ModelledSTSSuite;
17 import org.simantics.tests.modelled.utils.STSSuiteTestCollector;
19 public class ModelledSTSRunner extends ParentRunner<ModelledSTSSuiteRunner> {
21 private final List<ModelledSTSSuiteRunner> children;
23 public ModelledSTSRunner(Class<?> testClass) throws InitializationError {
27 Collection<ModelledSTSSuite> suites = STSSuiteTestCollector.collectTests();
28 children = new ArrayList<>(suites.size());
29 for (ModelledSTSSuite suite : suites) {
30 children.add(new ModelledSTSSuiteRunner(suite));
32 } catch (Exception e) {
33 throw new InitializationError(e);
38 protected List<ModelledSTSSuiteRunner> getChildren() {
43 protected Description describeChild(ModelledSTSSuiteRunner child) {
44 return child.getDescription();
48 public void run(RunNotifier notifier) {
49 notifier.addListener(new RunListener() {
52 public void testRunFinished(Result result) throws Exception {
60 protected void runChild(ModelledSTSSuiteRunner child, RunNotifier notifier) {
62 // TODO: Add coverage reporting to ModelledSTSRunner
63 // CombinedCoverage cover = child.getCoverage();
64 // CoverageBuilder b = new CoverageBuilder();
67 public void initialize() throws InitializationError {
70 public void deinitialize() throws Exception {
73 private void initialize0() throws Exception {
74 AcornTests.newSimanticsWorkspace(null, null);
78 private void deinitialize0() throws Exception {
80 Simantics.shutdown(new NullProgressMonitor());