]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/v2/ModelledSTSSuiteRunner.java
Fixing NPE with modelled tests
[simantics/platform.git] / bundles / org.simantics.tests.modelled / src / org / simantics / tests / modelled / junit / v2 / ModelledSTSSuiteRunner.java
index 5b7a8ef0ac3d5b352052476055bd160b7c58531b..11931d824c3990c432aece73020949d1bb058491 100644 (file)
@@ -1,6 +1,7 @@
 package org.simantics.tests.modelled.junit.v2;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -18,7 +19,7 @@ public class ModelledSTSSuiteRunner extends ParentRunner<ModelledSTSTestRunner>
 
     private final ModelledSTSSuite suite;
     private final List<ModelledSTSTestRunner> children;
-    private Map<String, List<CommandSessionVariable>> storedVariables;
+    private Map<String, List<CommandSessionVariable>> storedVariables = new HashMap<>();
 
     public ModelledSTSSuiteRunner(ModelledSTSSuite suite) throws InitializationError {
         super(ModelledSTSSuiteRunner.class);
@@ -58,10 +59,11 @@ public class ModelledSTSSuiteRunner extends ParentRunner<ModelledSTSTestRunner>
                         variables.addAll(storedVars);
                     }
                 }
+                notifier.fireTestStarted(description);
                 List<CommandSessionVariable> newVars = child.runWithVars(variables);
                 storedVariables.put(child.getTest().getName(), newVars);
                 notifier.fireTestFinished(description);
-            } catch (Exception e) {
+            } catch (Throwable e) {
                 notifier.fireTestFailure(new Failure(description, e));
             }
         }