qltyfolio/chart1.sql
-- not including shell
-- not including breadcrumbs from sqlpage_aide_navigation
-- not including page title from sqlpage_aide_navigation
--First Chart: Test Case Status Distribution
SELECT
'chart' AS component,
'Comprehensive Test Status' AS title,
'pie' AS type,
TRUE AS labels,
'green' as color,
'red' as color,
'azure' as color,
'chart-left' AS class; --Custom class for styling the first chart
--Data for the first chart
SELECT
'Passed' AS label,
ROUND(100.0 * SUM(CASE WHEN r.status = 'passed' THEN 1 ELSE 0 END) / COUNT(t.test_case_id), 2) AS value
FROM
test_cases t
LEFT JOIN
test_case_run_results r
ON
t.test_case_id = r.test_case_id;
SELECT
'Failed' AS label,
ROUND(100.0 * SUM(CASE WHEN r.status = 'failed' THEN 1 ELSE 0 END) / COUNT(t.test_case_id), 2) AS value
FROM
test_cases t
LEFT JOIN
test_case_run_results r
ON
t.test_case_id = r.test_case_id;
SELECT
'Todo' AS label,
ROUND(100.0 * (COUNT(t.test_case_id) - COUNT(r.test_case_id)) / COUNT(t.test_case_id), 2) AS value
FROM
test_cases t
LEFT JOIN
test_case_run_results r
ON
t.test_case_id = r.test_case_id;