Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit 5 Support #417

Closed
toniedzwiedz opened this issue Apr 24, 2018 · 7 comments
Closed

JUnit 5 Support #417

toniedzwiedz opened this issue Apr 24, 2018 · 7 comments

Comments

@toniedzwiedz
Copy link
Contributor

toniedzwiedz commented Apr 24, 2018

Version used

  • knot.x: 1.3.0+

Context of the issue/feature

Starting with version 3.5.1, Vert.x supports testing with JUnit 5 via vertx-junit5.

Using this utility would allow us to write cleaner and more expressive test code and give projects based on Knot.x more leeway in terms of what testing frameworks they use (the JUnit 5 extension model is more flexible than JUnit 4).

In order for that to happen:

  1. Knot.x needs to be upgraded to use Vert.x 3.5.1. According to @Skejven, this is going to be surprisingly tricky due to an API incompatibility between Vert.x 3.5.0 and 3.5.1 that affects the way Knot.x handles POST requests. This will need to be part of a bigger milestone. See Switch to vertx-codegen 3.5.1 when available #346
  2. A rewrite of the Knot.x test utilities to use vertx-junit5. JUnit 4 Rules need to be converted to JUnit 5 extensions.
  3. Tests can be rewritten. Surprisingly, this is optional as JUnit 5 allows a single project to execute tests using the new JUnit Jupiter programming model side by side with legacy JUnit 4 tests via JUnit Vintage. This could be a gradual migration.

Appendix:

This relies on the completion of #346

@marcinczeczko
Copy link
Contributor

@toniedzwiedz - sounds perfect. Just FYI, together with the test refactor towards Junit5 we'd like to migrate to other test utilities, to make unit/it tests even more readable. These are:

  • assertj instead of hamcrest - to get fluent api instead of dozen of static imports that's hard to manage
  • rest assured to simplify it tests that utilize HTTP calls, json, html validations

@toniedzwiedz
Copy link
Contributor Author

@marcinczeczko JUnit 5 is completely agnostic in terms of what assertion library we use. It makes for a cool group of features to put in the same milestone but, as far as I understand, there's no dependency between the two.

Not sure about REST-assured. Do you know if it relies on JUnit 4 Runners or Rules?

@toniedzwiedz
Copy link
Contributor Author

Vert.x 3.5.1 is now available in Knot.x 1.3.0-SNAPSHOT

@tomaszmichalak
Copy link
Member

Knot.x 1.3.0 is released. We use Vert.x 3.5.1 (<vertx.stack.version>3.5.1</vertx.stack.version>) so JUnit5 is ready to implement. It requires updates in:

  • Knot.x rules (integration tests)
  • integration tests
  • unit tests

@tomaszmichalak
Copy link
Member

tomaszmichalak commented Aug 22, 2018

Please start with an integration tests like: io.knotx.assembler.FragmentAssemblerTest

@tMaxx
Copy link

tMaxx commented Aug 29, 2018

Current proposed roadmap is as follows (in order):

After all of that is finished, port knotx core's tests to v5 as well. Work on that is just starting, so this is more of a general topic than a task.

@tomaszmichalak
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants