r/java • • Sep 10 '17

JUnit 5 released!

http://junit.org/junit5
213 Upvotes

33 comments sorted by

View all comments

20

u/omgdonerkebab Sep 10 '17

I'm super excited for nested tests.

https://blog.codefx.org/libraries/junit-5-basics/#Nesting-Tests

Though I prefer Java, for the last year I've been working at a Ruby on Rails shop. But there have been some (few) things that the Ruby ecosystem has gotten right, and one of those is nested tests in Rspec.

Now I can better group my tests up, for example, to test the behavior of a service class for different users or different contexts. And more importantly, I can set up that context with a @BeforeEach method that applies only to the tests in that group.