From 58bfd9df9ff34a966757fd2d63e4f32e32840f2a Mon Sep 17 00:00:00 2001 From: Jussi Koskela Date: Tue, 20 Dec 2016 12:07:41 +0200 Subject: [PATCH] Run modelled STS tests in alphanumeric order Run modelled STS tests in alphanumeric order in case of equal execution priority refs #6889 Change-Id: I4fed12d34de943ea9f950d209754c9465b2ce9b4 --- .../org/simantics/tests/modelled/ui/STSTestSuiteModel.java | 5 +++-- .../tests/modelled/junit/RuntimeSTSTestRunner.java | 4 ++++ .../tests/modelled/junit/RuntimeTestCollector.java | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/STSTestSuiteModel.java b/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/STSTestSuiteModel.java index 188574e54..ad1e29531 100644 --- a/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/STSTestSuiteModel.java +++ b/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/STSTestSuiteModel.java @@ -30,6 +30,7 @@ import org.simantics.scl.compiler.runtime.RuntimeModule; import org.simantics.scl.osgi.SCLOsgi; import org.simantics.scl.runtime.reporting.AbstractSCLReportingHandler; import org.simantics.tests.modelled.ontology.TestsResource; +import org.simantics.utils.strings.AlphanumComparator; public class STSTestSuiteModel { @@ -435,9 +436,9 @@ public class STSTestSuiteModel { Collections.sort(tests, (o1, o2) -> { if (o1.priority < o2.priority) return -1; - if (o1.priority > o2.priority) + else if (o1.priority > o2.priority) return 1; - return 0; + else return AlphanumComparator.COMPARATOR.compare(o1.name, o2.name); }); suite.children(tests.toArray(new STSTest[tests.size()])); } else { diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java index c0a5ac342..a86aa41d3 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java @@ -63,6 +63,10 @@ public class RuntimeSTSTestRunner extends Runner { } } + public String getName() { + return name; + } + public Integer getPriority() { return priority; } diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java index 06b81687e..0ab31b3f0 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java @@ -18,6 +18,7 @@ import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingUtils; import org.simantics.scl.runtime.tuple.Tuple0; import org.simantics.tests.modelled.ontology.TestsResource; +import org.simantics.utils.strings.AlphanumComparator; public class RuntimeTestCollector { @@ -60,10 +61,11 @@ public class RuntimeTestCollector { } testRunners.sort((test1, test2) -> { - if (test1.getPriority() <= test2.getPriority()) + if (test1.getPriority() < test2.getPriority()) return -1; - else + else if (test1.getPriority() > test2.getPriority()) return 1; + else return AlphanumComparator.COMPARATOR.compare(test1.getName(), test2.getName()); }); suite.addChildren(testRunners); suites.add(suite); -- 2.43.2