Skip to content

Conversation

@unroma
Copy link

@unroma unroma commented Jun 6, 2025

Issue being resolved: #308 #107

Solution description

I refactored JunitParser for better maintainability.
At first I would like to provide for review and only then if everything is ok, replace the current solution.
Also It should solve the issue with case result statuses mapping.

Changes

Restructured huge parse_file method with small methods.
Replaced and reworked methods from TestRailResult post_init section (they should not be there) into JunitParser,
Still todo: remove them from data class
this part:

    def __post_init__(self):
        if self.junit_result_unparsed is not None:
            self.status_id = self.calculate_status_id_from_junit_element(
                self.junit_result_unparsed
            )
            self.comment = self.get_comment_from_junit_element(
                self.junit_result_unparsed
            )

Now case result statuses {"passed": 1, "skipped": 4,"error": 5, "failure": 5} might be overridden using config.yml

Potential impacts

Result of junit xml parsing

Steps to test

replace from trcli.readers.junit_xml import JunitParser in cmd_parse_junit.py with from trcli.readers.junit_xml_refactored import JunitParser
then run unit tests
also add to config.yaml:

case_result_statuses:
  passed: 1
  skipped: 3
  error: 4
  failure: 5

(your desired mappings)
endpoint to get ids of result statuses for your project /api/v2/get_statuses

UPD:
Replaced current junit parser with refactored after review.

PR Tasks

  • PR reference added to issue
  • README updated
  • Unit tests added/updated

@unroma unroma changed the title Added refactored version of JunitParser for review [Refactor] Added refactored version of JunitParser for review Jun 6, 2025
@unroma
Copy link
Author

unroma commented Jun 17, 2025

@acuanico-tr-galt Any reaction?

@ecollins666
Copy link
Collaborator

Hi @unroma,
We will look into it today. Thank you

@acuanico-tr-galt
Copy link
Collaborator

Hi @unroma thank you for your patience. The changes looks solid. Can you now update the PR to change the actual file to update? (junit_xml) So that we can include in the next release? Thank you.

@unroma
Copy link
Author

unroma commented Jun 19, 2025

Hi @unroma thank you for your patience. The changes looks solid. Can you now update the PR to change the actual file to update? (junit_xml) So that we can include in the next release? Thank you.

Hi @acuanico-tr-galt @ecollins666 Done. Also I have updated documentation.

@acuanico-tr-galt
Copy link
Collaborator

Thanks @unroma can you also point the merge to release/1.10.0 branch? Thanks.

@unroma
Copy link
Author

unroma commented Jun 20, 2025

Thanks @unroma can you also point the merge to release/1.10.0 branch? Thanks.

@acuanico-tr-galt Done

@unroma unroma changed the base branch from main to release/1.10.0 June 20, 2025 06:42
@acuanico-tr-galt acuanico-tr-galt merged commit 34f645f into gurock:release/1.10.0 Jun 20, 2025
10 checks passed
@unroma unroma deleted the refactor/junitparser_for_review branch June 20, 2025 07:57
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.

[Refactor] JunitParser

3 participants