Skip to content

Support for mapping XCTAttachment to Allure labels and environment fields #85

@maxibello

Description

@maxibello

Hello!

Context:

  • I am running iOS UI tests with XCTest and generating attachments in each test using XCTAttachment.
  • I use names like allure.label.MyLabel or allure.environment.os for these attachments, hoping they will be mapped to Allure labels or environment fields in the resulting *-result.json files.

What I see:

  • After running xcresults export ..., all my attachments appear in the "attachments" section of the test in Allure, but they do not appear as labels or environment fields in the Allure report or in the labels/parameters sections of the result JSON.

Question:
Is there a way to make xcresults map certain attachments (by name or type) to Allure labels or environment fields automatically? If not, are there any plans to support this feature in the future? Is there a recommended workaround for adding per-test custom fields and environment variables to Allure results for iOS/XCTest?

Example of what I tried:

let automationAttachment = XCTAttachment(string: "true")
automationAttachment.name = "allure.label.iOSAutomation"
add(automationAttachment)

let osAttachment = XCTAttachment(string: "iOS 18.5.0")
osAttachment.name = "allure.environment.os"
add(osAttachment)

Current workaround:
I'm currently using a post-processing script that:

  1. Finds attachments with specific names in the generated *-result.json files
  2. Reads their content and adds corresponding entries to the labels and parameters sections
  3. This works but requires additional processing step

Feature request:
It would be great if xcresults could automatically recognize attachments with names like:

  • allure.label.* → add to labels section
  • allure.environment.* → add to environment or parameters section
  • allure.parameter.* → add to parameters section

Thank you in advance for any advice or clarification!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions