Is this code lab on testing still valid? (state of...
# android
c
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
@Manuel Vivo do you know what version this is currently targeting?
1
c
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
Involving @ppvi that might have more info about this
p
Last commit was made 2 months ago, what deprecated code are you looking at?
c
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
Ok but what deprecated things? Do you have an example?
c
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
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
The codelab where you see that API being used
c
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
The codelab even has CI so it does run, you must be doing something wrong that we might have missed
c
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
It's a codelab, not a sample. If you run the starter_code branch it will fail. Did you follow the actual codelab?
c
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