Test case import from Xray Test Management fails to sync with requirements

Test cases imported from Xray Test Management for Jira aren’t linking to their corresponding requirements in our test-case-mgmt module. The import completes without errors, but traceability linking fails silently, leaving us with zero requirement coverage visibility.

The Xray integration appears to be working at the surface level - test cases arrive with correct titles and descriptions. However, the requirement identifier mapping seems broken. Our REST API configuration shows successful authentication, but the coverage-reporting dashboard shows no linked requirements.

{
  "xray_test_key": "PROJ-T-123",
  "requirement_refs": ["REQ-456", "REQ-789"],
  "import_status": "success",
  "links_created": 0
}

Is there a specific field mapping configuration needed for traceability linking during Xray imports? Our requirement identifiers follow a different pattern than Xray’s test keys.

I’ve worked with Xray integration before. The traceability linking requires a two-phase approach: first, import the test cases, then use a separate API call to establish the links. The links_created:0 in your response suggests the linking phase isn’t executing. Your REST API configuration might be missing the traceability endpoint or the authentication scope doesn’t include link creation permissions.

The requirement identifier mapping is definitely the issue here. Xray uses its own reference format, and you need explicit mapping rules to translate those to your internal requirement IDs. Check if your REST API configuration includes a field mapping section for requirement references. Without it, the import process won’t know how to resolve the Xray requirement keys to actual requirement objects in your system.

The root cause is that Xray integration and traceability linking require coordinated configuration across multiple areas. Here’s the complete solution:

1. Xray Integration Configuration Ensure your Xray connector is configured to export requirement references in a format your system can parse. The requirement_refs array in your JSON shows Xray is sending the data, but it needs proper handling.

2. Requirement Identifier Mapping Create a mapping configuration that translates Xray requirement keys to your internal format:

{
  "mapping_rules": [
    {"pattern": "REQ-(\\d+)", "target": "REQUIREMENT-$1"},
    {"pattern": "PROJ-R-(\\d+)", "target": "REQ-$1"}
  ],
  "fallback_strategy": "search_by_title"
}

3. Traceability Linking Configuration The missing piece is the post-import link creation. Configure this in your REST API integration:


xray.import.enableAutoLinking=true
xray.import.linkType=verifies
xray.import.resolveReferences=true

4. REST API Configuration Enhancement Your REST API configuration needs both import and linking permissions:


api.scope=test.write,workitem.link.create
api.linkCreation.retryOnFailure=true
api.linkCreation.batchSize=50

Implementation Steps:

  1. Add Requirement Resolver: Implement a custom resolver that takes Xray requirement references and queries your system to find matching requirement work items. Use fuzzy matching on requirement IDs or titles if exact matches fail.

  2. Enable Post-Import Linking: Configure a workflow step that executes after test case import completes. This step should:

    • Extract requirement references from imported test case metadata
    • Resolve each reference using your mapping rules
    • Create traceability links using the appropriate link type (typically ‘verifies’ or ‘validates’)
    • Log any unresolved references for manual review
  3. Verify Coverage Reporting: After linking is established, the coverage-reporting dashboard should automatically reflect the new traceability relationships. If it doesn’t, check that your dashboard queries include the correct link types.

Troubleshooting Tips:

  • Test the mapping rules with a small batch first (5-10 test cases)
  • Enable detailed logging for the import and linking phases
  • Verify REST API permissions include both test case creation AND link creation
  • Check that requirement work items exist before attempting to create links (orphaned references will fail silently)

Common Pitfalls:

  • Case sensitivity in requirement identifiers
  • Missing permissions for link creation
  • Requirement references pointing to archived or deleted requirements
  • Timeout issues when processing large batches of links

Once configured properly, subsequent imports should automatically establish traceability links, and your coverage reporting will reflect the complete test-to-requirement relationships.

You need to configure a post-import processor that handles the requirement identifier mapping and creates the traceability links. This isn’t automatic in the base Xray integration - it requires custom configuration. The processor should read the requirement references from the imported test case metadata and resolve them to actual requirement work items in your system before creating the link relationships.

That makes sense about the two-phase approach. Looking at our import logs, I only see the test case creation calls, nothing about link establishment afterward. How do I configure the traceability linking to execute automatically after import? Is there a webhook or scheduled job that should be triggering this second phase?