Skip to content

Avoid ComparisonUtils::assertXmlEquals (compareXml) in CI to reduce execution time#3762

Open
samirromdhani wants to merge 4 commits intomainfrom
perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2
Open

Avoid ComparisonUtils::assertXmlEquals (compareXml) in CI to reduce execution time#3762
samirromdhani wants to merge 4 commits intomainfrom
perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2

Conversation

@samirromdhani
Copy link
Copy Markdown
Contributor

@samirromdhani samirromdhani commented Feb 9, 2026

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • A PR or issue has been opened in all impacted repositories (if any)

Does this PR already have an issue describing the problem?

Fixes #2817

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

Other information:

  • All updated tests pass successfully with assertXmlEquals.

  • The test class EncodingTest is excluded from this change. keep using assertXml, since its purpose is specifically to verify encoding behavior. Replacing it with a plain text comparison would not align with the purpose of the test.

  • setSorted in Export options (round-trip validation)
    Since setSorted is mutable in some test scenarios, it may introduce variability in execution time. This area could be optimized to ensure more consistent performance.

Summary
In the IIDM SerDe module, most of the tests were updated to use assertTxt instead of assertXml.

mvn test

Befor (~30,558 s)

Total time: 32.574 s
Total time: 28.709 s
Total time: 30.391 s

After (~22,2 s)

Total time: 21.790 s
Total time: 20.147 s
Total time: 24.665 s

@samirromdhani samirromdhani force-pushed the perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2 branch 2 times, most recently from a223955 to 23c88e8 Compare February 9, 2026 13:09
@samirromdhani samirromdhani changed the title perf: use equal byte-by-byte comparison [Google Guava library] perf: files assertions ComparisonUtils TXT XML Feb 9, 2026
@samirromdhani samirromdhani changed the title perf: files assertions ComparisonUtils TXT XML perf: file assertions ComparisonUtils TXT XML Feb 9, 2026
@samirromdhani samirromdhani force-pushed the perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2 branch 2 times, most recently from 08495c9 to aa8837e Compare February 9, 2026 15:02
@samirromdhani samirromdhani changed the title perf: file assertions ComparisonUtils TXT XML perf: ComparisonUtils TXT XML Feb 9, 2026
@samirromdhani samirromdhani force-pushed the perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2 branch from aa8837e to f995903 Compare February 9, 2026 15:54
@samirromdhani samirromdhani changed the title perf: ComparisonUtils TXT XML perf: ComparisonUtils TXT instead of XML Feb 9, 2026
@samirromdhani samirromdhani force-pushed the perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2 branch from f995903 to f944259 Compare February 9, 2026 15:58
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Feb 9, 2026

@samirromdhani samirromdhani force-pushed the perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2 branch 10 times, most recently from 093914a to d4e0da0 Compare February 17, 2026 14:19
@samirromdhani samirromdhani changed the title perf: ComparisonUtils TXT instead of XML Avoid ComparisonUtils::assertXmlEquals (compareXml) in CI to reduce execution time Feb 17, 2026
@samirromdhani samirromdhani force-pushed the perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2 branch 2 times, most recently from e7f6546 to cf4e689 Compare February 17, 2026 14:45
@samirromdhani samirromdhani marked this pull request as ready for review February 17, 2026 15:11
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@rolnico rolnico left a comment

Choose a reason for hiding this comment

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

Multiple conflits have to be resolved

public static void assertTxtEquals(String expected, String actual) {
String expectedStr = TestUtil.normalizeLineSeparator(expected);
String actualStr = TestUtil.normalizeLineSeparator(actual);
// Ensure element ends with exactly one newline before assertion
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// Ensure element ends with exactly one newline before assertion
// Ensure elements end with a newline before assertion

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines +96 to +97
* Writes the given data using the provided write function, then compares the resulting text file to the specified reference.
* @return the path of written file.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Writes the given data using the provided write function, then compares the resulting text file to the specified reference.
* @return the path of written file.
* Write the given data using the provided write function, then compares the resulting text file to the specified reference.
* @return the path of the written file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@samirromdhani
Copy link
Copy Markdown
Contributor Author

draft for now until fix conflicts

@samirromdhani samirromdhani marked this pull request as draft April 2, 2026 15:18
olperr1 added 2 commits April 13, 2026 10:37
Signed-off-by: Olivier Perrin <olivier.perrin@rte-france.com>
Signed-off-by: Olivier Perrin <olivier.perrin@rte-france.com>
@samirromdhani samirromdhani force-pushed the perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2 branch 6 times, most recently from cd706f0 to 139f3d6 Compare April 13, 2026 12:12
@samirromdhani samirromdhani marked this pull request as ready for review April 13, 2026 12:23
@samirromdhani samirromdhani marked this pull request as draft April 14, 2026 08:19
Signed-off-by: Samir Romdhani <samir.romdhani_externe@rte-france.com>
Signed-off-by: Samir Romdhani <samir.romdhani_externe@rte-france.com>
@samirromdhani samirromdhani force-pushed the perf/2817_avoid_using-comparison_utils_compare_xml_in_ci_v2 branch from 139f3d6 to fb50ce2 Compare April 14, 2026 09:12
@sonarqubecloud
Copy link
Copy Markdown

@samirromdhani samirromdhani marked this pull request as ready for review April 14, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid using ComparisonUtils::compareXml in CI

3 participants