You can also decide if Test Cases should only be added during creation of a Test Run like Polarion's Test Run functionallity "By Query on create" or if it should be possible to add Test Cases till execution of your Test Run "By Query on execute" (HowTo is added as comment in SQL Run.txt)
Get all Test Cases of project playground:
SELECT WORKITEM.C_PK FROM polarion.WORKITEM INNER JOIN polarion.PROJECT ON WORKITEM.FK_PROJECT=PROJECT.C_PK WHERE PROJECT.C_ID = 'playground' AND C_TYPE='testcase'
Get all Test Cases linked to work items via verifies link role in project playground:
SELECT WORKITEM.C_PK FROM Polarion.WORKITEM INNER JOIN polarion.STRUCT_WORKITEM_LINKEDWORKITEMS ON WORKITEM.C_PK = STRUCT_WORKITEM_LINKEDWORKITEMS.FK_P_WORKITEM INNER JOIN polarion.PROJECT ON WORKITEM.FK_PROJECT=PROJECT.C_PK WHERE PROJECT.C_ID = 'playground' AND STRUCT_WORKITEM_LINKEDWORKITEMS.C_ROLE = 'verifies' AND C_TYPE = 'testcase'
- Download SQL Run.txt
- Create Test Run Custom field: "id: sql , type: string"
- Go Into Test Run templates
- Select template you want to use
- Paste Wiki content into your Test Run template
- Add SQL query you want to use to custom field of your Test Run template
- Create new Test Run and select previously chosen Test Run template