Android

Why my date formatters test fails in CI and passes locally?

The issue For new Android project I decided to go with Github Actions as CI environment – we use Github across organization and some backend projects are already running in Github workflows, creating new project with is a good idea. I’ve prepared configuration using following tutorial: How-to Github Actions: Building your Android App I’ve recently …

Why my date formatters test fails in CI and passes locally? Read More »

Testing Retrofit calls with OkHttp MockWebServer

Retrofit – probably the most popular networking client in Android development. Basically it allows to create HTTP client in an interface – you just add annotation with HTTP method, relative or absolute path and proper request is constructed. Retrofit does not generate code in compile time – it creates implementations in runtime. import okhttp3.ResponseBodyimport retrofit2.Callimport …

Testing Retrofit calls with OkHttp MockWebServer Read More »

An attempt to unit test generated DataBinding code

But why? I use databinding a lot in my Android projects. It fits nicely with ViewModel and general MVVM approach. I also make use of databinding in small layouts – such as RecyclerView row or reusable <include> layouts. How does databinding works in general? You enable special build feature in build.gradle: android { (…) buildFeatures …

An attempt to unit test generated DataBinding code Read More »

Building Unit Tests for ViewModel in TDD style

Your view model class usually has several functionalities. It somehow fetches data, it optionally maps your data entities to displayable entities, handles clicks and performs action for given events. You want to be sure that after refactor your code will still work perfectly. To achieve that you need to write and maintain unit tests. I …

Building Unit Tests for ViewModel in TDD style Read More »