Let me give you a complete solution that addresses all three focus areas: link directionality, branching logic, and guard conditions.
1. Jira Automation Rule Structure:
Trigger: When test execution issue transitions to “Failed” status
2. Branch on Linked Issues (Requirement Perspective):
Use this JQL to get requirements linked via inward “is tested by” relationship:
issue in linkedIssues({{triggerIssue.key}}, "is tested by")
AND issuetype = Requirement
This ensures you’re only branching on actual requirement issues, not other linked items.
3. Guard Conditions (Prevent Loops and False Transitions):
Before transitioning each branched requirement, add these conditions:
- Condition 1:
{{issue.status.name}} does not equal “Under Review” (prevents re-triggering on already transitioned requirements)
- Condition 2: Check if any linked tests are still passing (optional, depends on your policy)
4. Aggregation Logic for Multiple Tests:
Use a lookup issues action within the branch to count linked test executions:
issueFunction in linkedIssuesOf("key = {{issue.key}}", "tests")
AND issuetype = "Test Execution"
AND status = Failed
Store the count in a Smart Value variable. Then add a condition: only transition if failed test count > 0 AND (failed count / total linked tests) exceeds your threshold (e.g., > 20%).
5. Transition Action:
Use “Transition issue” action with the target status “Under Review”. Make sure the workflow transition is available from the current status.
6. Additional Safeguards:
- Add a custom field on requirements like “Last Test Sync” timestamp to track when automation last ran
- Use issue properties to store aggregated test status to avoid recalculating on every trigger
- Consider adding a cooldown period (e.g., don’t re-transition if last sync was within 1 hour) to prevent thrashing during active test runs
Link Type Directionality Deep Dive:
The key confusion is that Jira link types are directional but the terminology changes based on perspective:
- From Requirement → Test Execution: outward link is “tests”
- From Test Execution → Requirement: inward link is “is tested by”
When your automation trigger fires on a test execution failure, you’re starting from the test execution’s perspective, so you need the inward link (“is tested by”) to find requirements.
Preventing Transition Loops:
Loops happen when:
- Test fails → Requirement transitions to “Under Review”
- Requirement transition triggers another automation
- That automation updates the test or requirement again
- Cycle repeats
Prevent this by:
- Checking current status before transitioning (status != target status)
- Using specific trigger conditions (only on test execution transitions, not requirement transitions)
- Adding a “processed” flag or timestamp custom field to track automation execution
- Disabling automation recursion in Jira automation settings if available
This approach has worked reliably for us with 500+ requirements and 2000+ test executions in Jira 9. The quality dashboards now accurately reflect requirement coverage, and we’ve eliminated false status transitions. The key is being explicit about link direction and adding proper guards at every step.