allure-framework / allure-framework/allure-python

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

Abierto
#813 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
814
Forks
260
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**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"}`

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza reproduciendo el pipeline de Jenkins con los directorios test_lambdas/a, b y c y compara las entradas de paquetes en los archivos result.json generados. Inspecciona cómo pytest descubre test_a.py, test_b.py y test_c.py y cómo sus rutas de paquete se convierten en Allure Suites; se considera terminado cuando la primera suite informa sistemáticamente de su ruta completa test_lambdas.a.tests, igual que las demás.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
testing
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.