incubator-xtable icon indicating copy to clipboard operation
incubator-xtable copied to clipboard

Improved all tests in TestHudiInstantUtils by parameterising and adding more test cases

Open Monilnarang opened this issue 8 months ago • 0 comments

What is the purpose of the pull request

This pull request improves both the tests in TestHudiInstantUtils by refactoring them into parameterised unit tests and also adding more test cases to enhance testing logic.

Elaboration:

  • The same method calls (parseFromInstantTime & convertInstantToCommit) are repeated with different inputs, making the test harder to maintain and extend.
  • When a test fails, JUnit only shows which type of assertion failed, but not which specific input caused the failure.
  • Adding new test cases requires copying and pasting another Assertions.assertEquals(...) statement instead of simply adding new data.

Brief change log

  • Parameterised tests: testParseCommitTimeToInstant & testInstantToCommit
  • Added more test cases as value sets to above parameterised tests

Verify this pull request

Below are the before and after unit test run reports: Below changes:
Screenshot 2025-04-24 at 11 08 53 AM

After changes: Screenshot 2025-04-24 at 11 09 18 AM

Monilnarang avatar Apr 24 '25 18:04 Monilnarang