You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "PoAn Yang (Jira)" <ji...@apache.org> on 2024/06/11 00:15:00 UTC
[jira] [Commented] (KAFKA-16929) Conside defining kafka-specified assertion to unify testing style
[ https://issues.apache.org/jira/browse/KAFKA-16929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17853841#comment-17853841 ]
PoAn Yang commented on KAFKA-16929:
-----------------------------------
Hi [~chia7712], thanks for the good suggestion. If this issue is valid, I can help to contribute it. 😀
> Conside defining kafka-specified assertion to unify testing style
> -----------------------------------------------------------------
>
> Key: KAFKA-16929
> URL: https://issues.apache.org/jira/browse/KAFKA-16929
> Project: Kafka
> Issue Type: New Feature
> Reporter: Chia-Ping Tsai
> Assignee: Chia-Ping Tsai
> Priority: Major
>
> There are many contributors who trying to fix chaos of kafka testing. That includes following huge works:
> # replace powermock/easymock by mockito (KAFKA-7438)
> # replace junit 4 assertion by junit 5 (KAFKA-7339)
> We take 6 years to complete the migration for task 1. The second task is in progress and I hope it can be addressed in 4.0.0
> When reviewing I noticed there are many different tastes in code base. That is why the task 1 is such difficult to rewrite. Now, the rewriting of "assertion" is facing the same issue, and I feel the usage of "assertion" is even more awkward than "mockito" due to following reason.
> # there are two "different" assertion style in code base - hamcrest and junit - that is confused to developers ([https://github.com/apache/kafka/pull/15730#discussion_r1567676845)]
> # third-party assertion does not offer good error message, so we need to use non-common style to get useful output ([https://github.com/apache/kafka/pull/16253#discussion_r1633406693)]
> IMHO, we should consider having our kafka-specified assertion style. Than can bring following benefit.
> # unify the assertion style of whole project
> # apply customized assertion. for example:
> ## assertEqual(List<Y>, List<K>, F<K, Y>))
> ## assertTrue(Supplier<B>, Duration) - equal to `TestUtils.waitForCondition`
> # auto-generate useful error message. For example: assertEqual(0, list) -> print the list
> In short, I'd like to add a new module to define common assertions, and then apply it to code base slowly.
> All feedback/responses/objections are welcomed :)
> Â
--
This message was sent by Atlassian Jira
(v8.20.10#820010)