https://kotlinlang.org logo
#android
Title
# android
s

smilecs

11/24/2017, 11:42 AM
what’s the suggested test framework to use for kotlin based android app
g

gildor

11/24/2017, 11:46 AM
There are plenty of them. JUnit is de facto standard.
r

rwachol

11/24/2017, 11:58 AM
I'd try spek
for junit, and kappuccino for espresso
s

smilecs

11/24/2017, 11:59 AM
alright thanks let me take a look at them now
g

gildor

11/24/2017, 12:11 PM
Spek experience can be not so smooth (especially on android) for now until 2.0 release, you can check talk about Spek on KotlinConf. Also, you cannot use it for instrumentation tests
r

rkeazor

11/24/2017, 2:27 PM
i like Spek
@gildor what Issues did you run into with Spek? It doesn’t play well with Robolectric, but I think this point people should just use Espresso for instrumentation testing, and drop Robolectric in my opinion
And spek to test to test your business logic
s

smilecs

11/24/2017, 2:49 PM
still looking into spek, looks concise though
maybe thats cause of kotlin don't know
r

rkeazor

11/24/2017, 2:53 PM
Kappuccino makes use of alot of high order functions but none of them are inline🤔
s

smilecs

11/24/2017, 2:54 PM
thinking though i can still write espresso in kotlin without using kappacinno
r

rkeazor

11/24/2017, 3:12 PM
yea
g

gildor

11/25/2017, 12:38 AM
@rkeazor I didn’t get your point. Spek requires Junit 5 and Junit 5 required Java 8, so you cannot use it for Instrumentation tests on Android until API level 26. Also Espresso is just view manipulation library, that allow to work with Android UI + integration with hamercrest assertions, so you can use any test runner, so don’t think that we should mix those different not-comparable tools I didn’t use Spek, I just know that it’s not so stable and even main contributors recommend to wait until version 2.0 dev preview. But I like concept and will probably use it in future I just think, that if you not familiar with testing in general and for first try just better to use Junit, it stable, works everywhere, part of instrumentation runner on Android and has great tooling support for every build system and every IDE. And when you will be more familiar with testing you will find better option yourself without asking other developers who, probably, has different requirements
r

rkeazor

11/25/2017, 12:39 AM
@gildor isn’t for instrumentation tests
its focus was pure unit test
g

gildor

11/25/2017, 12:40 AM
Spek is just specication framework integrated with Junit 5 test runner it doesn’t force to use particular test type (unit, instrumentation, integration). You can use it for any type of tests if you can run them, but you cannot do that on Android before api livel 26
junit in for unit tests, just check title, but still used for other test types
If Spek experience for you so good and you don’t have issues, good, but I just think that maybe library under active development is not the best recommendation for the first test library
r

rkeazor

11/25/2017, 12:46 AM
lol which open source library isn’t under active development.I don’t know I used it and without problem .
I think they are doing a good job on it
g

gildor

11/25/2017, 12:48 AM
under active, backward incompatable, development
r

rkeazor

11/25/2017, 12:49 AM
when you say backwards incompatible what are you referring to? Junit 4?
g

gildor

11/25/2017, 12:49 AM
Again, It’s good for you if you ready to use such library, even help with contribution, bug reporting etc. My point that it can be not so good for others, especially newbies
and when 2.0 dev preview will be released it will be backward incompatible with 1.x and it’s fine but make sense to wait release
Maybe I’m wrong and someone from contributors of Spek will correct me, but this what I understand now
r

rkeazor

11/25/2017, 12:53 AM
You should try and make judgement about it
and what you don’t like, just make a contribution lol
g

gildor

11/25/2017, 12:55 AM
I have nothing against Spek and want to use it. I judge only because main contributors of Spek telling about it and read #spek channel
r

rkeazor

11/25/2017, 12:57 AM
I think its fine, I haven’t ran into problems.Except for robolectric issue. But like I said the main focus was pure junit. And at KotlinConf the main contributor encourage people to give it a shot
g

gildor

11/25/2017, 12:58 AM
Yes, after version 2.0 dev preview
r

rkeazor

11/25/2017, 1:00 AM
lol even before
its just a dsl, what you got to loose lol
g

gildor

11/25/2017, 1:01 AM
Time
it’s not only dsl, it’s also Junit 5, IDE integration (including Spek plugin)
r

rkeazor

11/25/2017, 1:08 AM
Perhaps, but it works .
do you use robolectric?
it uses the testRunner, its not Junit 5
g

gildor

11/25/2017, 3:33 AM
No, I don’t, we use only pure unit + instrumentation
r

rkeazor

11/25/2017, 2:46 PM
best thing, Robolectric has been the source of all my Nightmares 😂