1.18.0
In order to be able to test with JUnit 5 I would like to have a comparable solution like GrpcCleanupRule but as JUnit 5 extension.
In my PoC project mmichaelis/poc-grpc you may see an example, which is very similar to your GrpcCleanupRule (because that was my intention :smile:): In module grpc-test you will find the class GrpcTestExtension and an example usage in HelloServiceImplTest.
I may assist in adding this to the grpc-java project, but there are several questions:
GrpcCleanupRule, so that GrpcTestExtension and the JUnit 4 rule share as much code as possible.This seems need to add junit 5 dependency in io.grpc.testing. @carl-mastrangelo are we able to add that dependency internally?
personally i would like to use junit5. but, internally we only have junit 4.12. junit5 requires pretty big change, so unfortunately it won't happen any time in near future.
JUnit 5 is also Java 8+. I'm not sure if the grpc-testing module is still under of the umbrella of https://github.com/grpc/grpc-java/issues/4671
Just wondering how this issue is going? Is there anything I can do to help?
@Torbacka , basically it is blocked by #4671. grpc-java is a library that still has to support Java 7.
@dapengzhang0 thank for the update.
IMO the current design of GrpcCleanupRule is unnecessarily dependent on Junit4 TestRule api. It basically calls teardown method after each test case.
So, I guess, if you can just separate the core cleanup utility from the TestRule extension, we can just call tearDown() method inside @AfterEach method. Or use the engine to create a Junit5 AfterEachCallback extension.
I created an extension for JUnit 5, that does what the rule did, and more. https://github.com/asarkar/grpc-test
@asarkar Awesome! Could you please add it to https://github.com/junit-team/junit5/wiki/Third-party-Extensions?
@marcphilipp Added to the "JUnit Jupiter Extensions" section.
Most helpful comment
@marcphilipp Added to the "JUnit Jupiter Extensions" section.