Here’s a complete solution for remapping orphaned regression tests and preventing future traceability breaks:
Phase 1: Identify and Categorize Orphaned Tests
Run this JQL to find all orphaned tests:
project = TEST AND type = Test
AND issueFunction not in linked("type = Story")
AND status != Archived
Export results to CSV. The export should include: Test Key, Summary, Description, Component, Labels.
Phase 2: Extract Old Story References
Use a spreadsheet or script to parse the Summary and Description fields for story key patterns (e.g., “DEV-892”, “PROJ-1234”). Create a mapping column: Test Key | Old Story Key | Component.
Phase 3: Map Old Stories to Current Stories
For each old story key, determine the current equivalent:
- Check if the story still exists (might be archived or moved)
- If deleted, find the current story covering the same feature area
- Use component and epic alignment to identify replacements
Create mapping: Old Story Key | Current Story Key | Feature Area
Phase 4: Bulk Remapping with JQL and Bulk Change
Group tests by current story target:
project = TEST AND key IN (TEST-1247, TEST-1248, TEST-1249)
Use Bulk Change:
- Select all tests in the filter
- Choose “Edit Issues”
- Select “Change Links”
- Add link: “Tests” → [Current Story Key]
- Execute bulk operation
Repeat for each group of tests mapping to the same current story.
Phase 5: Implement Stable Requirement Mapping
Create a custom field to prevent future orphaning:
-
Custom Field: “Stable Feature ID”
- Type: Short Text (single line)
- Format: FEAT-[Component]-[Number] (e.g., FEAT-AUTH-001)
- Applied to: Story and Test issue types
- Indexed: Yes (for JQL searching)
-
Populate Stable Feature IDs
- Assign IDs to all active stories in backlog
- Copy the same ID to all regression tests linked to that story
- Use bulk edit to set the field across related issues
-
Update Test Creation Process
- When creating a new regression test, copy the Stable Feature ID from the parent story
- Add field to test case templates
Phase 6: Ongoing Traceability Maintenance
Add to Definition of Done:
- ✓ Regression tests have valid “Stable Feature ID” matching parent story
- ✓ Tests are linked to current story via “Tests” relationship
- ✓ When refactoring stories, update Stable Feature ID on linked tests
Phase 7: Create Monitoring Filters
Set up JQL filters to catch future orphaning:
Filter: “Orphaned Regression Tests”
project = TEST AND type = Test
AND labels = regression
AND issueFunction not in linked("type = Story")
Filter: “Tests Missing Stable Feature ID”
project = TEST AND type = Test
AND "Stable Feature ID" IS EMPTY
Subscribe to these filters for weekly email alerts.
Automation for Bulk Remapping (Advanced)
If you have many tests to remap, use Jira REST API scripting:
// Pseudocode for bulk remapping:
1. Load mapping CSV: TestKey, OldStoryKey, NewStoryKey
2. For each row in mapping:
a. GET /rest/api/3/issue/{testKey}
b. POST /rest/api/3/issueLink with:
- type: "Tests"
- inwardIssue: testKey
- outwardIssue: newStoryKey
3. Log results and errors
This script can remap hundreds of tests in minutes vs. days of manual work.
Recommended Immediate Action Plan:
- Week 1: Run identification JQL, export to CSV, parse old story keys
- Week 2: Create old-to-new story mapping with product owner input
- Week 3: Execute bulk remapping in batches of 50-100 tests
- Week 4: Implement Stable Feature ID custom field and populate current stories
- Week 5: Update Definition of Done and test creation templates
This approach balances quick remediation of the current problem with long-term prevention. The Stable Feature ID field is key - it acts as a persistent identifier that survives story refactoring, splits, and merges. Even if story keys change, tests can be traced back to features through this stable reference.
For your 400+ orphaned tests, using bulk operations with component-based grouping should allow you to complete the remapping in 2-3 weeks rather than months of manual review. The critical success factor is getting product owner involvement in validating the old-to-new story mappings to ensure regression tests are linked to the correct current requirements.