Better @BeforeAll
/@AfterAll
experience for Kotlin
#3704
Replies: 2 comments 6 replies
-
As stated in the Test Instance Lifecycle section of the User Guide:
From what I understand, a lot of people using Kotlin prefer that approach. Have you tried using |
Beta Was this translation helpful? Give feedback.
-
I looked into this in some detail today. Here's the summary:
(1) and (2) would be used by JUnit itself (in one way or another) and (3) would be used by JUnit itself and by third-party extensions Does this sound at all feasible? Otherwise I'll stop here. The code I used in my investigation is available as a Gist. |
Beta Was this translation helpful? Give feedback.
-
I've written a small extension that makes
@BeforeAll
and@AfterAll
more natural to use in Kotlin:Old:
New:
Is this something that could be contributed to JUnit itself? This would also give a better IDE experience than a third-party extension. (Currently IntelliJ complains that
@BeforeAll
is used without@JvmStatic
and thatbeforeAll()
is unused.)Beta Was this translation helpful? Give feedback.
All reactions