Apps-android-commons: Kotlin for the tests

Created on 29 Mar 2018  路  3Comments  路  Source: commons-app/apps-android-commons

Summary:

It has been our stated strategy that we would evaluate the use of Kotlin by using it for writing tests.

Expected behavior:

New tests would be written using Kotlin & our test coverage would increase.

Observed behavior:

  1. Very few tests seem to be created, whether Java or Kotlin.
  2. We leave the CI build broken & don't actively maintain the test suite
  3. We don't utilize Kotlin (cf #1371 - we could have / should have offered guidance that New tests be in Kotlin for the Nearby failures)

Device and Android version:

One thing to note: we should update the version of Kotlin in our project.

Would you like to work on the issue?

I would be happy to Port the _entire_ suite to Kotlin, for sure, including new ones for Nearby but this needs to be a team buy-in ... are we "in" or "out" of the Kotlin game? If we are "in" is there a more effective strategy for adoption?

continuous integration question tests

Most helpful comment

Tests are now done in Kotlin, builds are passing, coverage is increasing and there's a nice CI pipeline to alpha releases. Thanks to everyone who helped with this :tada: :champagne:

All 3 comments

Agreed that we don't maintain the test suite as much as we should, and apologies on that front. :)

I'm "in" if we can get a good foundation to start with (e.g. the entire test suite ported to Kotlin), and ideally a bit of documentation on how to get started with writing tests in Kotlin (perhaps in the wiki we can give an example of one of the tests in both Kotlin and Java?).

As for whether or not we want to make it a requirement that all new tests should be in Kotlin, I'm undecided about that. For consistency it would indeed be better to do so, but on the other hand this would place a requirement on all core developers to learn Kotlin regardless of whether they like it or not. Personally I would not mind doing so (especially in light of the neverending Oracle vs Google battle ). But we probably want to see what others think about it as well.

I ran across a blog post from Brian Button (an Agile leader based in the St Louis area) that talks about "Three Degrees of Unit Testing" that might be interesting to the current topic.

https://blog.brianbutton.io/index.php/2018/04/01/the-degrees-of-unit-testing/

I love his comment

Any amount of unit testing, done almost any way, adds value to a code base. Regardless of how and when the tests were written, as long as they are reliable and quick, and prove the code does what we think it does, I鈥檓 in favor of them.

Tests are now done in Kotlin, builds are passing, coverage is increasing and there's a nice CI pipeline to alpha releases. Thanks to everyone who helped with this :tada: :champagne:

Was this page helpful?
0 / 5 - 0 ratings