You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@amoro.apache.org by "Monilnarang (via GitHub)" <gi...@apache.org> on 2025/03/05 04:10:45 UTC

[PR] [Improvement]: Refactored test testToHumanReadableString of MemorySizeTest to paramerterized [amoro]

Monilnarang opened a new pull request, #3454:
URL: https://github.com/apache/amoro/pull/3454

   Aim:
   
   Improve the test code by avoiding code duplication, improving maintainability, and enhancing readability. By converting the test into a parameterized unit test, we reduce boilerplate code, make it easier to extend by simply adding new input values, and improve debugging by clearly identifying which test case fails instead of searching through individual assertions.
   
   
   
   ## Why are the changes needed?
   - The same method call to `toHumanReadableString` is repeated multiple times with different inputs in the test `testToHumanReadableString` making it harder to maintain and extend.
   - When this 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 new assertion instead of simply adding new data.
   
   
   ## Brief change log
   Parameterized the test testToHumanReadableString using `@MethodSource`. This reduces duplication, allows easy extension by simply adding new value sets, and makes debugging easier as it clearly indicates which test failed instead of requiring a search through individual assertions.
   
   Test run report after change: 
   <img width="507" alt="Screenshot 2025-03-04 at 7 16 39 PM" src="https://github.com/user-attachments/assets/0ebfb28e-2d47-4e86-8f66-7d4c04f18dd1" />
   
   
   ## How was this patch tested?
   
   - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   - [ ] Add screenshots for manual tests if appropriate
   
   - [ ] Run test locally before making a pull request
   
   ## Documentation
   
   - Does this pull request introduce a new feature? (yes / no)
   No
   - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@amoro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improvement]: Refactored test testToHumanReadableString of MemorySizeTest to paramerterized [amoro]

Posted by "zhoujinsong (via GitHub)" <gi...@apache.org>.
zhoujinsong merged PR #3454:
URL: https://github.com/apache/amoro/pull/3454


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@amoro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org