allure-framework / allure-framework/allure-python

Add labels from env for all tests in a run

Đang mở
#721 1 bình luận 9 reaction 0 người được giao Xem trên GitHub
contribute task:new feature theme:core
Ngôn ngữ chính
Python
Star
815
Fork
260
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

#### I'm submitting a ...
- [ ] bug report
- [x] feature request
- [ ] support request => Please do not submit support request here, see note at the top of this template.

#### What is the current behavior?
Currently there is no way to pass environment-related info into all tests in a run without modifying the code base of the tests.

#### What is the expected behavior?
Allure should automatically convert environment variables to labels using the naming convention specified below.

#### What is the motivation / use case for changing the behavior?
It\`s useful to test an application or library across multiple different environments. Such environments may differ in
- a language version
- an operating system
- a platform
- a dependency version
- etc.

The environment-based labels help to distinguish test results produced by the same test in different environments. TestOps can group those results apart with its `env from label` feature.

#### Other information

##### Naming convention
Every environment variable in form `ALLURE_LABEL_=` is translated into the label `` with the value ``.
The label is added for each test in the run.

##### Constraints
To ensure consistency across different allure adapters the following constraints are imposed:
- The environment variables are captured when the test is about to start (see [allure-java](https://github.com/allure-framework/allure-java/blob/e91fb588572ed9397911e988035bc000cd93b354/allure-junit-platform/src/main/java/io/qameta/allure/junitplatform/AllureJunitPlatform.java#L509))

##### Example
Given the following environment variables:
```
ALLURE_LABEL_PYTHON_VERSION=3.11
ALLURE_LABEL_OS=Linux
ALLURE_LABEL_USERNAME=John
ALLURE_LABEL_EMPTY=
```

When the tests are run.

Then the following labels are present in any `*-result.json` file created during the run:
```json
{
...
"labels": [
...
{
"name": "PYTHON_VERSION",
"value": "3.11"
},
{
"name": "OS",
"value": "Linux"
},
{
"name": "USERNAME",
"value": "John"
},
{
"name": "EMPTY",
"value": ""
}
]
}
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách xem lại tài liệu tham chiếu về thời điểm của environment label trong allure-junit-platform/src/main/java/io/qameta/allure/junitplatform/AllureJunitPlatform.java và các entry point của Python adapter tạo các tệp JSON kết quả. Chạy các bài kiểm thử adapter hiện có, sau đó xác minh rằng mỗi kết quả kiểm thử đều nhận các biến ALLURE_LABEL_, bao gồm cả các giá trị rỗng, với tên và giá trị label như mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
testing
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.