How to get only the last test result and not all the results of a Test Execution.
Oded Mozesh (52●8●18)
| asked Jun 05 '19, 7:42 a.m.
edited Jun 05 '19, 9:18 a.m. by Martin Madzio (96●1●7) I have the following JRS query, and I get all the runs results of a Test and not the last one.
I tried to get only the max of test result end time, but I failed to understand how can I filter the results such I get only tthe records where the max(end time) = end time
The results I get are:
But there should be only one result for Test Result (and not 3)
Following is the used query
PREFIX process: <http://jazz.net/ns/process#>
PREFIX rqm_merged: <http://jazz.net/ns/lqe/merge/gensym/qm/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dng_merged: <http://jazz.net/ns/lqe/merge/gensym/rm/>
PREFIX oslc_config: <http://open-services.net/ns/config#>
PREFIX oslc_rm: <http://open-services.net/ns/rm#>
PREFIX oslc: <http://open-services.net/ns/core#>
PREFIX rqm: <http://jazz.net/ns/qm/rqm#>
PREFIX oslc_qm: <http://open-services.net/ns/qm#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX merge: <http://jazz.net/ns/lqe/merge/>
PREFIX dcterms: <http://purl.org/dc/terms/>
?rqm_merged_QMTestPlan1_title ?rqm_merged_QMTestCase1_shortId ?rqm_merged_QMTestCase1_title ?dng_merged_SystemRequirement1_identifier ?dng_merged_SystemRequirement1_title ?rqm_merged_QMTestResult1_title ?rqm_merged_QMTestResult1_verdict WHERE{ ?rqm_merged_QMTestPlan1_uri process:projectArea ?rqm_merged_QMTestPlan1_paUri. FILTER(?rqm_merged_QMTestPlan1_paUri IN (<https://demmy.com/gc/process/project-areas/_1FLV0DbAEemg-MTlSloFXg>, <https://demmy.com/rm/process/project-areas/_QhSGcCMJEem4vZIQTRKFzA>, <https://demmy.com/qm/process/project-areas/_zVcYACMAEemxqL7t80wk5Q>)) ?rqm_merged_QMTestPlan1_uri oslc_qm:usesTestCase ?rqm_merged_QMTestCase1_uri. ?rqm_merged_QMTestPlan1_uri oslc:instanceShape ?rqm_merged_QMTestPlan1_uri_instanceShape. ?rqm_merged_QMTestPlan1_uri_instanceShape merge:mergeShape rqm_merged:QM%20Test%20Plan. ?rqm_merged_QMTestPlan1_uri dcterms:title ?rqm_merged_QMTestPlan1_title. OPTIONAL {?rqm_merged_QMTestPlan1_ver dcterms:isVersionOf ?rqm_merged_QMTestPlan1_uri; rdf:type oslc_config:VersionResource.} ?rqm_merged_QMTestCase1_uri process:projectArea ?rqm_merged_QMTestCase1_paUri. FILTER(?rqm_merged_QMTestCase1_paUri IN (<https://demmy.com/gc/process/project-areas/_1FLV0DbAEemg-MTlSloFXg>, <https://demmy.com/rm/process/project-areas/_QhSGcCMJEem4vZIQTRKFzA>, <https://demmy.com/qm/process/project-areas/_zVcYACMAEemxqL7t80wk5Q>)) { ?rqm_merged_QMTestCase1_uri oslc_qm:validatesRequirement ?dng_merged_SystemRequirement1_uri. } UNION { ?dng_merged_SystemRequirement1_uri oslc_rm:validatedBy ?rqm_merged_QMTestCase1_uri. } ?rqm_merged_QMTestResult1_uri oslc_qm:reportsOnTestCase ?rqm_merged_QMTestCase1_uri. ?rqm_merged_QMTestCase1_uri oslc:instanceShape ?rqm_merged_QMTestCase1_uri_instanceShape. ?rqm_merged_QMTestCase1_uri_instanceShape merge:mergeShape rqm_merged:QM%20Test%20Case. ?rqm_merged_QMTestCase1_uri dcterms:title ?rqm_merged_QMTestCase1_title. OPTIONAL { ?rqm_merged_QMTestCase1_uri oslc:shortId ?rqm_merged_QMTestCase1_shortId. } OPTIONAL {?rqm_merged_QMTestCase1_ver dcterms:isVersionOf ?rqm_merged_QMTestCase1_uri; rdf:type oslc_config:VersionResource.} ?rqm_merged_QMTestResult1_uri process:projectArea ?rqm_merged_QMTestResult1_paUri. FILTER(?rqm_merged_QMTestResult1_paUri IN (<https://demmy.com/gc/process/project-areas/_1FLV0DbAEemg-MTlSloFXg>, <https://demmy.com/rm/process/project-areas/_QhSGcCMJEem4vZIQTRKFzA>, <https://demmy.com/qm/process/project-areas/_zVcYACMAEemxqL7t80wk5Q>)) ?rqm_merged_QMTestResult1_uri oslc:instanceShape ?rqm_merged_QMTestResult1_uri_instanceShape. ?rqm_merged_QMTestResult1_uri_instanceShape merge:mergeShape rqm_merged:QM%20Test%20Result. ?rqm_merged_QMTestResult1_uri dcterms:title ?rqm_merged_QMTestResult1_title. OPTIONAL { ?rqm_merged_QMTestResult1_uri rqm:verdict ?rqm_merged_QMTestResult1_verdict_enumValue. OPTIONAL {{?rqm_merged_QMTestResult1_verdict_enumValue rdfs:label ?rqm_merged_QMTestResult1_verdict_enumName} UNION {?rqm_merged_QMTestResult1_verdict_enumValue dcterms:title ?rqm_merged_QMTestResult1_verdict_enumName}} } OPTIONAL {?rqm_merged_QMTestResult1_ver dcterms:isVersionOf ?rqm_merged_QMTestResult1_uri; rdf:type oslc_config:VersionResource.} BIND( IF (bound(?rqm_merged_QMTestPlan1_ver), concat(str(?rqm_merged_QMTestPlan1_uri), "?oslc_config.context="), ?rqm_merged_QMTestPlan1_uri) as ?rqm_merged_QMTestPlan1) BIND( IF (bound(?rqm_merged_QMTestCase1_ver), concat(str(?rqm_merged_QMTestCase1_uri), "?oslc_config.context="), ?rqm_merged_QMTestCase1_uri) as ?rqm_merged_QMTestCase1) BIND( IF (bound(?rqm_merged_QMTestResult1_ver), concat(str(?rqm_merged_QMTestResult1_uri), "?oslc_config.context="), ?rqm_merged_QMTestResult1_uri) as ?rqm_merged_QMTestResult1) BIND( IF(bound(?rqm_merged_QMTestResult1_verdict_enumName), ?rqm_merged_QMTestResult1_verdict_enumName, IF(bound(?rqm_merged_QMTestResult1_verdict_enumValue), ?rqm_merged_QMTestResult1_verdict_enumValue, "")) as ?rqm_merged_QMTestResult1_verdict) ?dng_merged_SystemRequirement1_uri process:projectArea ?dng_merged_SystemRequirement1_paUri. FILTER(?dng_merged_SystemRequirement1_paUri=<https://demmy.com/rm/process/project-areas/_QhSGcCMJEem4vZIQTRKFzA>) ?dng_merged_SystemRequirement1_uri oslc:instanceShape ?dng_merged_SystemRequirement1_uri_instanceShape. ?dng_merged_SystemRequirement1_uri_instanceShape merge:mergeShape dng_merged:System%20Requirement. ?dng_merged_SystemRequirement1_uri dcterms:title ?dng_merged_SystemRequirement1_title. OPTIONAL { ?dng_merged_SystemRequirement1_uri dcterms:identifier ?dng_merged_SystemRequirement1_identifier. } OPTIONAL {?dng_merged_SystemRequirement1_ver dcterms:isVersionOf ?dng_merged_SystemRequirement1_uri; rdf:type oslc_config:VersionResource.} BIND( IF (bound(?dng_merged_SystemRequirement1_ver), concat(str(?dng_merged_SystemRequirement1_uri), "?oslc_config.context="), ?dng_merged_SystemRequirement1_uri) as ?dng_merged_SystemRequirement1) } ORDER BY asc(?rqm_merged_QMTestPlan1_title) asc(?rqm_merged_QMTestCase1_shortId) asc(?rqm_merged_QMTestCase1_title) asc(?dng_merged_SystemRequirement1_identifier) asc(?dng_merged_SystemRequirement1_title) |
Accepted answer
The Test Execution Record has a relationship to "Current Test Result" (rqm:currentTestResult). Use that relationship to get the most recent result.
Oded Mozesh selected this answer as the correct answer
Comments
Bellow if the relations chain I used:
Trace relationships and add artifacts
Kathryn Fryer
commented Jun 10 '19, 9:51 a.m.
There is a potential issue with that path: once you get to the Test Case, it could have Execution Records that are unrelated to the original Test Plan, and you'd get those results too.
You might be able to handle that with conditions, e.g. if you have specific TCER naming conventions or other ways to distinguish them.
Else, you could try using a dual relationship path - enable multiple paths, with the Merge option, and branch at the TCER as follows:
QM Test Plan > Rel: Reported By > QM Test Execution Record > Rel:Current Test Case result > QM Test Result
[QM Test Plan > Rel: Reported By > QM Test Execution Record] > Rel: Runs Test Case: QM Test Case
There might be other relationship paths as well. Just consider the relationships as you get to each artifact in the path.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.