allure-framework / allure-framework/allure-python

The first "Suite" in the Allure report has inconstant path compared to the remaining "Suites"

Aperta
#813 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
814
Fork
260
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Describe the bug**
When using Jenkins with pytest-5.2.0, allure-pytest-2.8.6 and Allure Jenkins Plugin 2.28.1 to run unit tests and generate an Allure report for multiple applications (AWS lambdas) the first "Suite" in the Allure report has inconstant path compared to the remaining "Suites".

**To Reproduce**
Steps to reproduce the behavior:
1.With the directory structure:
```
test_lambdas
├── a
│ ├── a.py
│ └── tests
│ └── test_a.py
├── b
│ ├── b.py
│ └── tests
│ └── test_b.py
└── c
├── c.py
└── tests
└── test_c.py
```
2. Where the a.py, b.py and c.py have the code similar to:
```
def handler(event, context):
return "A"
```
3. And the a_test.py, b_test.py and c_test.py have code similar to:
```
import unittest
import a
class TestStringMethods(unittest.TestCase):
def test_a(self):
self.assertEqual(a.handler(None, None), 'A')
```
4. And the Jenkinsfile:
```
pipeline {
agent any
options {
ansiColor('xterm')
disableConcurrentBuilds()
}
environment {
ALLURE_DIR = "${WORKSPACE}/allure-results"
LAMBDAS_DIR = "${WORKSPACE}/test_lambdas"
LAMBDAS = "a b c"
}
stages {
stage('Test Lambdas') {
steps {
script {
dir(LAMBDAS_DIR) {
sh '''
rm -fr ${ALLURE_DIR}
for lambda in $LAMBDAS; do
cd ${LAMBDAS_DIR}/${lambda}
python -m pytest . --alluredir ${ALLURE_DIR}
done
'''
}
}
}
}
}
post {
always {
dir("$WORKSPACE") {
script {
allure([
includeProperties: false,
reportBuildPolicy: 'ALWAYS',
results : [[path: "${ALLURE_DIR}"]]
])
}
}
}
}
}
```
5. Run the pipeline and view the Allure report.

**Expected behavior**
A clear and concise description of what you expected to happen.

I expect to see under "Suites" the path
test_lambdas.a.tests
test_lambdas.b.tests
test_lambdas.c.tests

But I see
tests
test_lambdas.b.tests
test_lambdas.c.tests

**Screenshots**
If applicable, add screenshots to help explain your problem.
![allure](https://user-images.githubusercontent.com/47950413/69141316-69993880-0abc-11ea-850a-09be18e04139.png)

**Environment (please complete the following information):**

pytest-5.2.0, allure-pytest-2.8.6 and Allure Jenkins Plugin 2.28.1

**Additional context**
In the ...result.json files I see
`{"name": "package", "value": "tests.test_a"}`
`{"name": "package", "value": "test_lambdas.c.tests.test_c"}`

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo la pipeline Jenkins con le directory test_lambdas/a, b e c e confronta le voci dei package nei file result.json generati. Esamina come pytest rileva test_a.py, test_b.py e test_c.py e come i relativi percorsi dei package diventano Allure Suites; il lavoro è completato quando la prima suite riporta sistematicamente il percorso completo test_lambdas.a.tests, come le altre.

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

Valutazione

Stack tecnologico
python
Ambito
testing
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 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.