Closed DavideD closed 3 years ago
Good idea @DavideD, would you like to try to contribute it?
I can try but I might need some help.
Can I copy the logic in Vert.x RunTestOnContext
?
It seems it delegates some things to the VertxUnitRunner, should I do something similar and call the methods in VertxExtension?
I think yes you can copy or take inspiration from what's been done there.
@DavideD any progress on this contribution?
No, sorry. I didn't have time
jUnit5 has a mechanism for intercepting test method calls.
This could be used to get a Vert.x context then run the test on this context.
@jponge the jUnit5 documentation says checkpoints shouldn't be used on Vert.x threads. Can you explain why?
This could be a problem if running tests on a Vert.x context.
That might be a bad explanation in the docs then, can you please point me to the corresponding sentence?
https://vertx.io/docs/vertx-junit5/java/#_checkpoint_when_there_are_multiple_success_conditions
TIP: Checkpoints should be created only from the test case main thread, not from Vert.x asynchronous event callbacks.
Makes sense.
Checkpoints shall be created from the test main thread (e.g., when you enter a test method).
Then checkpoints shall be used from anywhere else (e.g., flagging from a callback).
This is because we had some users who created new checkpoints on the fly, like in the middle of a callback, but the main test context had already completed because it could not have anticipated that they would even exist.
Ok. Perhaps we should change the tip wording then, it is confusing.
There is this rule available for JUnit 4:
It would be nice to have something similar for JUnit 5. Probably an extension.