allure-framework / allure-framework/allure-python

Add labels from env for all tests in a run

Aperta
#721 1 commento 9 reazioni 0 assegnatari Vedi su GitHub
contribute task:new feature theme:core
Lingua principale
Python
Stelle
814
Fork
260
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

#### 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": ""
}
]
}
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia esaminando il riferimento temporale delle label di ambiente in allure-junit-platform/src/main/java/io/qameta/allure/junitplatform/AllureJunitPlatform.java e i punti di ingresso degli adapter Python che creano file JSON dei risultati. Esegui i test esistenti degli adapter, quindi verifica che ogni risultato di test riceva variabili ALLURE_LABEL_, inclusi i valori vuoti, con i nomi e i valori delle label previsti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
testing
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.