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

codeslubber

04/20/2020, 4:32 PM
Is this code lab on testing still valid? (state of the art?) I cloned it and it seemed like it has not been touched in a long time.. been reading about AndroidX testing, but as I look at code I still see deprecated stuff.. ? https://codelabs.developers.google.com/codelabs/advanced-android-kotlin-training-testing-basics/index.html#0
a

Adam Powell

04/21/2020, 1:09 AM
@Manuel Vivo do you know what version this is currently targeting?
1
c

codeslubber

04/21/2020, 1:35 AM
Forgot to mention I did update the gradle plugin and made a couple minor changes and the app did build and I was able to run it. But the InstrumentationTests fail. Says something like ‘Test runner failed unexpectedly.’
m

Manuel Vivo

04/21/2020, 7:16 AM
Involving @ppvi that might have more info about this
p

ppvi

04/21/2020, 7:58 AM
Last commit was made 2 months ago, what deprecated code are you looking at?
c

codeslubber

04/21/2020, 4:29 PM
I was just saying that most the classes are chains of deprecated things, on the instrumented test side. But the tests in the project do not run for me. Anyway I will tinker some more and see if I can get some similar tests working.
p

ppvi

04/21/2020, 4:45 PM
Ok but what deprecated things? Do you have an example?
c

codeslubber

04/21/2020, 6:10 PM
If you look at the code for doing Tests on android it’s a LONG string of deprecated stuff!! and one thing points you to another and that one is deprecated, e.g.
ActivityInstrumentationTestCase2
(which as name would imply already a rewrite), then there is
image.png
that’s the doc page and you see the deprecation notice? what do you suppose happens when you click there? Right:
ActivityTestRule
is also deprecated!!
I watched a video where the presenter (I/O) spent half his time talking about how crucial testing was at GOogle and you can’t even get a PR approved without tests and yada yada yada, then I go to run the test in the sample app and it doesn’t work. Gee I wonder why patronizing presenters are so disappointed in the amount of testing the community is doing?? can’t figure it out?
p

ppvi

04/21/2020, 6:43 PM
Lol I don't know what you're looking at but we haven't used that in years
Can you share urls where you see that?
I was excited to find the codelab
p

ppvi

04/21/2020, 6:45 PM
The codelab where you see that API being used
c

codeslubber

04/21/2020, 6:45 PM
I like the strategy of using the Espresso stuff for instrumented tests too
the codelab is not using that the codelab does not run
so I went back to reading documentation
p

ppvi

04/21/2020, 6:47 PM
The codelab even has CI so it does run, you must be doing something wrong that we might have missed
c

codeslubber

04/21/2020, 7:15 PM
what could I be doing wrong?
I cloned it and clicked Run on the test?
running it in the 4.1 Preview maybe? maybe it works in the 3.x
p

ppvi

04/21/2020, 7:32 PM
It's a codelab, not a sample. If you run the starter_code branch it will fail. Did you follow the actual codelab?
c

codeslubber

04/21/2020, 9:13 PM
omg dude you are incredible, thanks for your help
yeah I read the lab I also fixed it
by running in 3.6.2, you must disappointed it wasn’t just my stupidity
btw, you better go reread the codelab
it tells you to pull it, run the app, run the unit test, then run the example instrumentation test, which is what I did