I need help building a JQL query in Jira. I want to find all user stories that are in Closed status and have related test cases that meet specific criteria. The test cases should have resolution marked as “Unresolved” but their execution status should be “Passed”.
MainFilter = issueFunction in linkedIssuesOf("project = PROJECT AND issuetype = Story AND status = Closed", "is related to") AND issuetype = "Test Case" AND status in ("To Do", "New") ORDER BY priority DESC
issuetype = "Test" AND issue in getTestsFromExecution(MainFilter, 'PASSED') AND resolution = "Unresolved"
I’m not sure if my approach is correct. Can someone help me verify this JQL syntax or suggest improvements?
You’re overcomplicating this. Manual JQL queries get messy fast with complex relationships like this.
I hit this exact scenario constantly - tracking test cases that pass but stay unresolved when stories close. Skip the JQL wrestling and build an automation instead.
Set up a workflow that triggers when a story hits Closed status. It checks all linked test cases, finds “Passed” execution with “Unresolved” resolution, then updates them or flags for review.
No more remembering complex queries or manual searches. The system handles it and sends you a clean report.
I use Latenode for Jira automation since it connects directly to the API and lets you build custom logic without plugins. Way more reliable than getting JQL syntax perfect every time.
Your query’s on the right track but has some syntax issues. The main problem is you’re trying to combine two separate queries that should work differently together. I’ve handled similar stuff before and had good luck with ScriptRunner’s issueFunction. Try this instead:
issueFunction in linkedIssuesOf("project = PROJECT AND issuetype = Story AND status = Closed") AND issuetype = "Test Case" AND resolution = Unresolved AND cf[customfield_xxxxx] = "Passed"
Swap out customfield_xxxxx with your actual execution status field ID. You can find this under Administration > Issues > Custom Fields - just look for your test execution status field. That getTestsFromExecution function you’re using isn’t standard Jira - looks like it’s from Xray or Zephyr testing plugins. If you’re using those, check their docs for the right syntax since it changes between versions.
you’re overcomplicating this. flip the logic and start simple: issuetype = "Test Case" AND resolution = Unresolved AND linkedIssuesOf("status = Closed AND issuetype = Story") then add your passed execution criteria. that getTestsFromExecution syntax looks plugin-specific - check if it’s actually available in your JIRA instance first.
Your query’s way too complex - you’re mixing different approaches that don’t need to be mixed. I’ve dealt with this before and there’s a much cleaner way using linkedIssuesOf properly.
project = PROJECT AND issuetype = "Test Case" AND resolution = Unresolved AND status = "Passed" AND issue in linkedIssuesOf("project = PROJECT AND issuetype = Story AND status = Closed")
Start from the test case side instead of chaining multiple filters. This finds unresolved test cases with passed status, then filters for ones linked to closed stories. Double-check that “Passed” matches exactly what’s in your test execution field - it’s often case sensitive or named differently depending on your testing tool.
I see you’re using getTestsFromExecution, so you’ve got a testing plugin, but linkedIssuesOf works fine whether you’re on Xray, Zephyr, or whatever else.