Use parent name in JUnit STS test identifiers
[simantics/platform.git] / bundles / org.simantics.tests.modelled / src / org / simantics / tests / modelled / utils / STSSuiteTestCollector.java
index 58aa323e1e98e5053380b1579eaf2c27823f4e85..56d43aec9ad47db272aea9905636ee30e9b20355 100644 (file)
@@ -95,7 +95,14 @@ public class STSSuiteTestCollector {
             String value = graph.getRelatedValue(stsVariable, TESTS.STSVariable_definition);
             variables.put(name, value);
         }
-        return new ModelledSTSTest(testName, code, priority != null ? priority : -1, ignored != null ? ignored : false, new HashSet<>(Arrays.asList(actualDeps)), variables);
+        Resource parent = graph.getSingleObject(test, L0.PartOf);
+        String parentName;
+        String possibleURI = graph.getPossibleURI(parent);
+        if (possibleURI != null)
+            parentName = possibleURI;
+        else
+            parentName = graph.getRelatedValue2(parent, L0.HasName, Bindings.STRING);
+        return new ModelledSTSTest(testName, parentName, code, priority != null ? priority : -1, ignored != null ? ignored : false, new HashSet<>(Arrays.asList(actualDeps)), variables);
     }
 
     public static ModelledSTSSuite toModelledSuite(ReadGraph graph, Resource suite, List<ModelledSTSTest> children) throws DatabaseException {