Skip to content

Feature/parameterized tests with xray poc#535

Merged
Pog3k merged 1 commit into
eclipse-kiso-testing:masterfrom
DianeMornas:feature/parameterized-tests-with-xray-poc
May 6, 2025
Merged

Feature/parameterized tests with xray poc#535
Pog3k merged 1 commit into
eclipse-kiso-testing:masterfrom
DianeMornas:feature/parameterized-tests-with-xray-poc

Conversation

@DianeMornas
Copy link
Copy Markdown
Contributor

The goal of this POC is to change the way to upload test results to xray, before 2 steps were required first step run the test and generate the jjunit xml file at the same time then second step convert this junit into a junit compatible with xray to upload the test results. The parameterized were not supported. This way only worked with xray test ticket with a Generic type and not with Manual, Automated and automated Cucumber types.

The user still uses a decorator with the test_key ID of the xray test ticket

  • if the pykiso test does not use parameterized
  • only test execution ticket will be create in xray for all the test function and linked to the xray test tickets
  • if the pykiso test use parameterized
  • one test execution ticket will be created in xray per test function and per parameters

HTML step report generation has also been updated and support parameterized tests.

Copy link
Copy Markdown
Contributor

@sebastianpfischer sebastianpfischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @DianeMornas , there are core design issues with this pull-request. Could you please get in touch with @Pog3k so that he setup a meeting with all of us to discuss it. Could you also please create a ticket associated to this pull-request and the needs?

Thank you in advance

Copy link
Copy Markdown
Contributor

@sebastianpfischer sebastianpfischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like said above, we need to have a design discussion. In addition, tests, documentation and examples are missing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generation of the needed information should be created after the test was executed. If information needs to be fetchted during execution, most of the content should be part of the test_result module.

If we need to record now each line executed from a specific script, we need to take a look at it as well.

So I expect 2 parts: one in the test_result and maybe another here but more in a way we store information in a generic way that can per retrieve from the test_result itself

Comment thread src/pykiso/cli.py Outdated
Comment on lines +268 to +281
@click.option(
"--xray-upload",
nargs=3,
type=click.Tuple([str, str, str]),
required=False,
help="Upload the test results to Xray. Requires the username, password and url as arguments.",
)
@click.option(
"--test-execution-id",
nargs=1,
type=click.STRING,
required=False,
help="Test execution ID of Xray where to upload the test results. By default, a new test execution ticket is created except if the ID is given.",
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xray should not become an interface of pykiso. The upload should still be done via the tool.

Comment on lines +574 to +594
def generate_step_report_xray(
test_result: Union[BannerTestResult, XmlTestResult],
) -> dict:
"""Generate the step report dictionary for Xray

:param test_results: Result of tests to generate the report from
:return: The step report dictionary"""
return generate_all_step_report(test_result=test_result)


def generate_step_report_html(
test_result: Union[BannerTestResult, XmlTestResult],
output_file: str,
) -> None:
"""Generate the HTML step report based on Jinja2 template

:param test_result: Result of tests to generate the report from
:param output_file: Report output file path
"""

all_step_report = generate_all_step_report(test_result=test_result)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not the correct location for it

@Pog3k
Copy link
Copy Markdown
Contributor

Pog3k commented Mar 20, 2025

What I have seen in this POC:

assert_step_report has been improved to collect additional test information, which will be used for the step report HTML and to provide all necessary details for the Xray report.

In test_execution.py, additional functions related to Xray reports have been added. I think it would be cleaner if we moved these new functions to a separate file/module dedicated to Xray functions, perhaps something like tool/xray/xray_report.py.

In assert_step_report.py, we are mixing step report functions with Xray again. I think it makes sense to move generate_step_report_xray to tool/xray/xray_report.py. The refactored step report logic is fine because both require the same dictionary, ALL_STEP_REPORT.

I believe we need to modify the Pykiso interface because the information in the JUnit report is insufficient to capture all necessary details. See the improvements in assert_step_report. Somehow, we need make the informations stored ALL_STEP_REPORT available. Since this is quite generic, we could also introduce a flag like --kiso-report, which dumps the pickled dictionary or something similar.

For the upload process, we could still use the external CLI, which has the benefit of allowing results to be uploaded at any time. This way, tests don’t need to be re-run if something fails.

I'll be back on Monday to discuss this further. However, feel free to leave any comments in advance.

@sebastianpfischer
Copy link
Copy Markdown
Contributor

What I have seen in this POC:

assert_step_report has been improved to collect additional test information, which will be used for the step report HTML and to provide all necessary details for the Xray report.

In test_execution.py, additional functions related to Xray reports have been added. I think it would be cleaner if we moved these new functions to a separate file/module dedicated to Xray functions, perhaps something like tool/xray/xray_report.py.

In assert_step_report.py, we are mixing step report functions with Xray again. I think it makes sense to move generate_step_report_xray to tool/xray/xray_report.py. The refactored step report logic is fine because both require the same dictionary, ALL_STEP_REPORT.

I believe we need to modify the Pykiso interface because the information in the JUnit report is insufficient to capture all necessary details. See the improvements in assert_step_report. Somehow, we need make the informations stored ALL_STEP_REPORT available. Since this is quite generic, we could also introduce a flag like --kiso-report, which dumps the pickled dictionary or something similar.

For the upload process, we could still use the external CLI, which has the benefit of allowing results to be uploaded at any time. This way, tests don’t need to be re-run if something fails.

I'll be back on Monday to discuss this further. However, feel free to leave any comments in advance.

It makes sense. But we should take a deeper look at the report mechanism all together. I believe this may need some major design decision.

@DianeMornas DianeMornas marked this pull request as draft March 21, 2025 08:15
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 21, 2025

Codecov Report

Attention: Patch coverage is 98.06452% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pykiso/tool/xray/xray_report.py 97.16% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@DianeMornas DianeMornas force-pushed the feature/parameterized-tests-with-xray-poc branch from 9ac4717 to 2f27698 Compare April 16, 2025 16:00
@sebastianpfischer sebastianpfischer marked this pull request as ready for review April 28, 2025 15:34
@DianeMornas DianeMornas force-pushed the feature/parameterized-tests-with-xray-poc branch from dd276f8 to c2ba76e Compare May 6, 2025 11:21
@DianeMornas DianeMornas closed this May 6, 2025
@DianeMornas DianeMornas reopened this May 6, 2025
@DianeMornas DianeMornas force-pushed the feature/parameterized-tests-with-xray-poc branch from c2ba76e to 654124b Compare May 6, 2025 11:44
@Pog3k Pog3k merged commit 0774471 into eclipse-kiso-testing:master May 6, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants