You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by Steve Loughran <st...@cloudera.com.INVALID> on 2025/07/04 14:55:38 UTC

JUnit5 parameterization pain

I see that Junit5 completely breaks parameterization because its test
running is completely different...the value gets passed as a parameter to
the test method, which is too late for any test setup. As a result, all s3a
ITests are broken.

The good news, JUnit 5.13 appears to restore this functionality, somehow

https://docs.junit.org/current/api/org.junit.jupiter.params/org/junit/jupiter/params/ParameterizedClass.html

I'm trying this on a new test suite I'm writing; if it works we will have
to move all those parameterized test cases in hadoop-aws, maybe elsewhere
back to it.

I'm a bit disappointed with the Junit team here, though their key
contribution to software development "make writing tests easy" is profound.
Pity they left out "make upgrading existing test suites easy"

Re: JUnit5 parameterization pain

Posted by Shilun Fan <sl...@apache.org>.
Hi Steve,

Thanks a lot for pointing out this issue. Indeed, JUnit 5 introduces significant differences compared to JUnit 4—one could even say the changes are quite drastic. That said, I think we’ll have to embrace this trend, as communities like Spark 4.0, Iceberg, and Flink are all moving in this direction.

My current plan is to first complete the migration of the remaining modules to JUnit 5 and fully remove JUnit 4, since we are already quite close to finishing that part. After that, we can consider upgrading to JUnit 5.13.2, which seems to reintroduce support for parameterized test classes. I'd be happy to help with this and prepare PRs to restore the previous parameterized behavior—but I’d really appreciate your help in providing a small demo or some guidance on the expected structure.

Also, once we've fully switched to JUnit 5, I propose we start transitioning Hadoop tests toward AssertJ for assertions. We can initiate a discussion in the dev list once the JUnit 4 removal is complete.

Thanks again for raising this point!

Best,
Shilun Fan.

On 2025/07/04 14:55:38 Steve Loughran wrote:
> I see that Junit5 completely breaks parameterization because its test
> running is completely different...the value gets passed as a parameter to
> the test method, which is too late for any test setup. As a result, all s3a
> ITests are broken.
> 
> The good news, JUnit 5.13 appears to restore this functionality, somehow
> 
> https://docs.junit.org/current/api/org.junit.jupiter.params/org/junit/jupiter/params/ParameterizedClass.html
> 
> I'm trying this on a new test suite I'm writing; if it works we will have
> to move all those parameterized test cases in hadoop-aws, maybe elsewhere
> back to it.
> 
> I'm a bit disappointed with the Junit team here, though their key
> contribution to software development "make writing tests easy" is profound.
> Pity they left out "make upgrading existing test suites easy"
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-dev-help@hadoop.apache.org