Overview
As test cases are developed over time, it is a good practice to evaluate how much the existing test cases are reusable. This approach supports modularity where test cases that have been understood well and executed successfully before can be reused.
Test Case Reusability SQL Query
Given below is the query.
select
rtc.release_name as name,
count (ts.linked_test_case_id) as tcount
from
SpiraTestEntities.R_TestCases as t
join
SpiraTestEntities.R_TestSteps as ts on
t.test_case_id = ts.linked_test_case_id and
t.project_id = ts.project_id and
ts.is_deleted = false and
ts.linked_test_case_id is not null
join
SpiraTestEntities.R_ReleaseTestCases as RTC on
RTC.project_id = T.project_id and
TS.linked_test_case_id = RTC.test_case_id
where
t.project_id = ${ProjectId} and
t.Is_deleted = False
group by
rtc.release_name
Query Explanation
- Modular test cases can be reused when they are inserted as linked test steps. Hence, this query joins test case and test steps.
- The query computes the test cases associated with the release.
- The test case id from Test Case is joined on linked_test_case id on test_steps.
- Since test cases may also have other test steps where such links do not exist, the not null check is done on linked_test_case_id.
- To avoid deleted test cases confusing the results, apply the IS_DELETED = False.
- If you want this query to also filter by the current release selected in interface, bring the RELEASE_ID = ${ReleaseId}.
Output
Given below is the output.
![Quality - Test Case Reusability](/Support/Attachment/151363.aspx)