Allure custom labels won’t show up in the final report (pytest, allure)

  • python 3.12.2

  • allure-pytest: 2.13.5

  • allure-python-commons: 2.13.5

  • pytest: 8.2.2

  • allure CLI: 2.30.0

Premise

Allure documentation says that I can add labels.

import allure from allure_commons.types 
import LabelType 

@allure.label(LabelType.LANGUAGE, "python") 
@allure.label(LabelType.FRAMEWORK, "pytest") 
def test_authentication():

“It can be a constant from the LabelType class or any other string.”

So I assume this should work:

import allure 

@allure.label("any other string", "python") 
@allure.label("another any other string", "pytest") 
def test_authentication():

Problem

Although, when I add my custom label via @allure.label(), it won’t show up in the report.

For example:

# root_dir/test.py  

import allure  

@allure.label('Area', 'someArea') 
@allure.label('Component', 'someComponent') 
@allure.label('Relevance', 'someVersion') 
def test_smth()

Then I run the test; point to reports/ to save the report; and open it in the browser:

pytest -v -s --alluredir reports

allure serve reports

And there’s no trace of my custom labels in the report. And no corresponding tag or element or something else in the report’s HTML.

At the very same time, when I open *-result.json in my Allure report directory reports/, I see this:

"labels": [{"name": "Area", "value": "someArea"}, {"name": "Component", "value": "someComponent"}, {"name": "Relevance", "value": "someVersion"}

BTW

The example from the documentation doesn’t show up in the final report:

python @allure.label(LabelType.LANGUAGE, "python") 

What actually shows up in the final report:

@allure.title() 
@allure.description() 
@allure.severity() 
@allure.testcase() 
@allure.story() 
@allure.featur() 
@allure.tag 

What else I tried:

Making a separate place to keep my labels

# root_dir/custom_allure_labels.py  

import allure 
 
def area(value):     
    return allure.label('Area', value)  

def component(value):     
    return allure.label('Component', value)  

def relevance(value):     
    return allure.label('Relevance', value)  
# root_dir/test.py 

import allure  
from custom_allure_labels import area, component, relevance  
 
@area('someArea')  
@component('someComponent')  
@relevance('someVersion')  
def test_smth()

No result.

All the same + adding properties

# root_dir/allure.properties    

allure.label.Area=Area  
allure.label.Component=Component  
allure.label.Relevance=Relevance
# root_dir/custom_allure_labels.py  

import allure 
from allure_commons.types import LabelType  

def area(value):     
    allure.label(LabelType.CUSTOM_LABEL_1, value)     
        return allure.label('Area', value)  
def component(value):     
    allure.label(LabelType.CUSTOM_LABEL_2, value)     
        return allure.label('Component', value)  
def relevance(value):     
    allure.label(LabelType.CUSTOM_LABEL_3, value)     
        return allure.label('Relevance', value) 
# root_dir/test.py  

import allure 
from custom_allure_labels import area, component, relevance  

@area('someArea') 
@component('someComponent') 
@relevance('someVersion') 
def test_smth()

No result.

Similar but adding a `decorator` func

# root_dir/custom_allure_labels.py  

import allure  

def custom_allure_labels(area, component, relevance):     
    def decorator(func):         
        allure.label('Area', area)(func)         
        allure.label('Component', component)(func)         
        allure.label('Relevance', relevance)(func)         
        return func     
    return decorator
# root_dir/test.py  

import allure 
from custom_allure_labels import area, component, relevance  

@custom_allure_labels(         
    area='someArea',         
    component='someComponent',         
    relevance='someVersion',     
    ) 
def test_smth()

Question

What is wrong with what I’m trying to do?

Is there a way to add custom attributes into `LabelType`?

New contributor

KD. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật