使用Rally API创建TestSet报错:目标迭代不在项目范围内
Hey there, let's break down why your Rally API TestSet creation started failing suddenly after 3 years of smooth operation. The error message Could not update: Desired iteration is not in project scope points straight to a mismatch between the iteration you're linking to your TestSet and the project where you're creating the TestSet.
Common Root Causes
- Iteration was re-assigned to another project: It’s likely someone on your team recently reorganized Rally projects and moved the iteration you’ve been using out of the target project for TestSet creation.
- Iteration scope configuration changed: The iteration’s settings might have been updated to exclude your target project from its scope.
- Stale iteration reference in code: If your code uses a hardcoded iteration ID or reference, that iteration could have been archived or reassigned to a different project recently.
Step-by-Step Fixes
Verify the iteration’s project association
Head to the Rally web interface, find the iteration you’re specifying innewTestSet, and check its "Project" field. Confirm it belongs to the same project where you’re trying to create the TestSet.Update the iteration reference in your request
If the iteration is no longer in the target project:- Either move the iteration back to the target project (if that fits your team’s workflow), or
- Replace the iteration’s ID/reference in
newTestSetwith one that’s explicitly linked to your target project. You can grab the correct iteration details from the Rally UI or via a quick API query for iterations in your project.
Debug your request payload
Add a log statement to print out the contents ofnewTestSetbefore sending the create request—this will let you confirm exactly which iteration you’re trying to link. For example:System.out.println("TestSet payload details: " + newTestSet.toString());Double-check that the iteration’s
_reforObjectIDpoints to an iteration within your target project.Validate API user permissions
Make sure the user account your API uses has access to both the target project and the iteration you’re referencing. Sometimes permission changes can restrict access to iterations even if their project association looks correct.
Your core code structure isn’t the issue here—this is almost certainly a data or configuration change in Rally. For reference, here’s your existing code snippet:
CreateRequest createTSRequest = new CreateRequest("testset", newTestSet); CreateResponse createTSResponse = restApi.create(createTSRequest);
内容的提问来源于stack exchange,提问作者user7032675

