]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Run modelled STS tests in alphanumeric order 22/222/1
authorJussi Koskela <jussi.koskela@semantum.fi>
Tue, 20 Dec 2016 10:07:41 +0000 (12:07 +0200)
committerJussi Koskela <jussi.koskela@semantum.fi>
Tue, 20 Dec 2016 10:16:13 +0000 (12:16 +0200)
Run modelled STS tests in alphanumeric order in case of equal execution
priority

refs #6889
Change-Id: I4fed12d34de943ea9f950d209754c9465b2ce9b4

bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/STSTestSuiteModel.java
bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java
bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java

index 188574e545d4d329a0fde8de1a9623bf7a6e0cb5..ad1e2953157a023bc41085f61e85d846cc9dba8f 100644 (file)
@@ -30,6 +30,7 @@ import org.simantics.scl.compiler.runtime.RuntimeModule;
 import org.simantics.scl.osgi.SCLOsgi;\r
 import org.simantics.scl.runtime.reporting.AbstractSCLReportingHandler;\r
 import org.simantics.tests.modelled.ontology.TestsResource;\r
+import org.simantics.utils.strings.AlphanumComparator;\r
 \r
 public class STSTestSuiteModel {\r
 \r
@@ -435,9 +436,9 @@ public class STSTestSuiteModel {
                         Collections.sort(tests, (o1, o2) -> {\r
                             if (o1.priority < o2.priority)\r
                                 return -1;\r
-                            if (o1.priority > o2.priority)\r
+                            else if (o1.priority > o2.priority)\r
                                 return 1;\r
-                            return 0;\r
+                            else return AlphanumComparator.COMPARATOR.compare(o1.name, o2.name);\r
                         });\r
                         suite.children(tests.toArray(new STSTest[tests.size()]));\r
                     } else {\r
index c0a5ac342d4ec56a40146ed5f1164a7c62739c82..a86aa41d32c32ac087e7b30370abdc5eed70c31e 100644 (file)
@@ -63,6 +63,10 @@ public class RuntimeSTSTestRunner extends Runner {
         }\r
     }\r
 \r
+    public String getName() {\r
+       return name;\r
+    }\r
+    \r
     public Integer getPriority() {\r
         return priority;\r
     }\r
index 06b81687ec025f1cc17a1bbf5cbb0dbf8155589f..0ab31b3f01a8961ad652f36ca980d4a9a475e8b7 100644 (file)
@@ -18,6 +18,7 @@ import org.simantics.layer0.Layer0;
 import org.simantics.modeling.ModelingUtils;\r
 import org.simantics.scl.runtime.tuple.Tuple0;\r
 import org.simantics.tests.modelled.ontology.TestsResource;\r
+import org.simantics.utils.strings.AlphanumComparator;\r
 \r
 public class RuntimeTestCollector {\r
 \r
@@ -60,10 +61,11 @@ public class RuntimeTestCollector {
                                 }\r
                                 \r
                                 testRunners.sort((test1, test2) -> {\r
-                                    if (test1.getPriority() <= test2.getPriority())\r
+                                    if (test1.getPriority() < test2.getPriority())\r
                                         return -1;\r
-                                    else\r
+                                    else if (test1.getPriority() > test2.getPriority())\r
                                         return 1;\r
+                                    else return AlphanumComparator.COMPARATOR.compare(test1.getName(), test2.getName());\r
                                 });\r
                                 suite.addChildren(testRunners);\r
                                 suites.add(suite);\r