allure-framework / allure-framework/allure-python

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

Open
#813 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
814
Forks
260
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.