When querying the Defect endpoint via the Rally Web Services API (WSAPI), the TestCase and TestCaseResult fields return null even when the Defect appears to be linked to test cases or results in the Rally UI.
Rally SAAS
In the Rally WSAPI object model, the TestCase and TestCaseResult fields on a Defect are singular object references (foreign keys). These fields are only populated if the Defect was created directly from a specific Test Case or Test Case Result.
General associations or links between Defects and Test Cases are stored in the TestCases collection, which is separate from the singular reference fields.
To retrieve the associated test cases and results for a defect, you must query the TestCases collection instead of the singular fields.
TestCases collection endpoint for that defect using a fetch parameter to include relevant fields (e.g., FormattedID, LastResult, Results).Example Query: Review this command before running it.
/slm/webservice/v2.0/defect/[DEFECT_ID]/testcases?fetch=FormattedID,LastResult,LastResultVerdict,Results
This query will return the full list of associated test cases and their respective results as a collection, rather than a single inline object.