try this query, you can count the conditions by using SUM(condition) like below
SELECT p.parent_id,
COUNT(*) as children,
SUM(c.qty > 0) as in_stock,
SUM(c.qty = 0 AND c.wh_soh > 0) as warehouse,
SUM(c.qty = 0 AND c.wh_soh = 0) as out_of_stock
FROM test_parent p
INNER JOIN test_relation r USING (parent_id)
INNER JOIN test_child c USING (child_id)
GROUP BY p.parent_id
HAVING children > 3
AND in_stock > 0
AND warehouse > 0
AND out_of_stock > 0