https://kotlinlang.org logo
#feed
Title
# feed
g

gammax

11/27/2018, 3:40 PM
j

janvladimirmostert

11/27/2018, 6:14 PM
I didn't know about
@Rule
seems very useful!
j

jmfayard

11/27/2018, 6:21 PM
I don't want to be mean, I prefer to avoid the complexity of conventional junit tests instead of trying to solve it. No need for those junit annotations because I work with immutable data and a functional style with no side effect. So no work to do in
@AfterClass, @After, @Before
.
@BeforeClass
is simply the test class constructor. I use the powerful kotlintest framework and I never felt the need to add the equivalent of those
@Rules
j

janvladimirmostert

11/27/2018, 6:22 PM
I've used Spek and it felt a bit cumbersome to use having to force your tests into a certain structure. Will need to check out KotlinTest as well
j

jmfayard

11/27/2018, 6:27 PM
I contributed to this repo that makes it easier to compare the different test frameworks @janvladimirmostert https://github.com/rozkminiacz/KotlinUnitTesting
👍 1
j

janvladimirmostert

11/27/2018, 7:14 PM
nice!
g

gammax

11/27/2018, 10:38 PM
Thanks for the input @jmfayard 💪 Yup I agree with you generally. Unfortunately, in Android you sometimes need to write a lot of code to setup your testing environment. I’m currently working on a really big Android codebase and using
Rules
helped me structure a lot the setup/cleanup code.
👍 1
d

dariuszbacinski

11/28/2018, 7:59 AM
Rules are great! Unfortunately they were replaced by Extensions in jUnit 5 which makes migration much harder 😕 https://www.codeaffine.com/2016/04/06/replace-rules-in-junit5/
2 Views