1. 程式人生 > 其它 >Add clickable link to allure report

Add clickable link to allure report

技術標籤:測試

try:
    attach(
        f'<head></head><body><a href="{video_url}">Link to ...</a></body>',
        'html video log',
        attachment_type.HTML
    )
except Exception as e:
    logger.error('attach HTML usage is wrong')

The plain text usage:

try:
        attach(
            name='Text: Video on Sauce Labs',
            body=video_url,
            attachment_type=attachment_type.TEXT
        )

    except Exception as e:
        logger.error(
            f'Failed to insert test video url to allure report, due to: {e}'
        )

The best one:

    try:
        attach(
            name='URL 2: Video on Sauce Labs',
            body=video_url,
            attachment_type=attachment_type.URI_LIST
        )
    except Exception as e:
        logger.error('add link usage is wrong')