allure-framework / allure-framework/allure-python
The first "Suite" in the Allure report has inconstant path compared to the remaining "Suites"
- 主要言語
- Python
- スター
- 814
- フォーク
- 260
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
**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.

**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"}`
コントリビューションガイド
調査の方向性
まず、ディレクトリ test_lambdas/a、b、c を使って Jenkins pipeline を再現し、生成された result.json ファイル内のパッケージエントリを比較します。pytest が test_a.py、test_b.py、test_c.py をどのように検出し、それらのパッケージパスがどのように Allure Suites になるかを調べます。完了の条件は、最初の suite が他の suite と同様に、完全な test_lambdas.a.tests パスを一貫して報告することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- testing
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100