allure-framework / allure-framework/allure-python

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

オープン
#813 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
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.
![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"}`

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、ディレクトリ 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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。